Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting older articles #245

Open
tehnar opened this issue May 10, 2016 · 9 comments
Open

Getting older articles #245

tehnar opened this issue May 10, 2016 · 9 comments
Labels

Comments

@tehnar
Copy link

tehnar commented May 10, 2016

Hello, is there any way to get more articles from a particular website? I get only the latest (amount and beginning date depends on site) news, not all of them. Caching is disabled, but it doesn't help.

@yprez
Copy link
Collaborator

yprez commented May 10, 2016

@tehnar can you provide a specific example?

@tehnar
Copy link
Author

tehnar commented May 10, 2016

@yprez
For example, http://blog.jetbrains.com/ruby/
Newspaper thinks that there are only 94 articles while the real amount is much larger. The latest article downloaded by newspaper is dated autumn 2015.

Also, there is an additional trouble with this website: if I try some other blog (for example, http://blog.jetbrains.com/pycharm/), I'll get 0 articles. I've managed to fix it by manually deleting contents of ~/.newspaper/feed_category_cache, but it's a strange hack.

@yprez
Copy link
Collaborator

yprez commented May 11, 2016

Did you try disabling cache?
e.g. newspaper.build('http://blog.jetbrains.com/ruby/', memoize_articles=False)

I'm getting 127 articles from http://blog.jetbrains.com/ruby/, not sure if it's all of them or not.
I think you're getting 0 on the 2nd result because the articles are cached by the domain...

@yprez yprez added the question label May 11, 2016
@tehnar
Copy link
Author

tehnar commented May 11, 2016

@yprez
I'm still getting only 95 articles (I disabled caching and removed ~/.newspaper_scraper). There are 32 pages (the last page http://blog.jetbrains.com/ruby/page/32/), 10 articles on each, 320 articles in total, the first article is published in 2010, while I'm getting only articles published in 2015-2016

@tehnar
Copy link
Author

tehnar commented May 13, 2016

Also, publish dates are not extracted properly for all the articles.
For example, publish date for this article http://blog.jetbrains.com/ruby/2016/05/rubymine-2016-1-1-security-update/ is not recognized while for this article http://blog.jetbrains.com/ruby/2015/12/20-years-of-ruby/ it's extracted properly. It looks like a bug.

@yprez
Copy link
Collaborator

yprez commented May 13, 2016

Funny, but the bug with parsing the date is actually in the 2nd article where it succeeds...

It parses the date from the URL (I couldn't find any meta date attributes in these articles), so 2015/12/20 part is parsed as a date, and the result is wrong too (20/05/2015 instead of the 22nd)

@tehnar
Copy link
Author

tehnar commented May 13, 2016

@yprez
Oh, really funny bug :)
How about adding some more regexps for different date formats? I suppose that not so many sites represent date as year/month/day. Actually, I think that most of websites put the year as the last part of publish date (but I might be wrong).
And what about a low amount of downloaded articles? Is that a king of bug, or what?

@yprez
Copy link
Collaborator

yprez commented May 14, 2016

There was a ticket about trying to find dates with regex within the article - #168, and a closed pull-request somewhere. Can't really get it from the URL if it only has the year and month.

Regarding the amount of articles, newspaper combines several strategies to get a list of articles, e.g. links from the page, categories, rss feeds, etc. It doesn't go over the pages of paginated results...
The first page http://blog.jetbrains.com/ruby/ only has articles from January 2016, same about the rss feed at: http://blog.jetbrains.com/ruby/feed/

To get all the articles you would need to paginate over all result pages, I don't think that's currently possible with newspaper...

@tehnar
Copy link
Author

tehnar commented May 14, 2016

Ok, I've got it. Thank for the clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants