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

Filter date articles for all methods #106

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

v-cardona
Copy link
Contributor

Filter the news by date of the methods that do not support it, all of them except for ‘get_news(keyword’) and get_news_by_site(site)

In case the user has set the start_date, end_date or period, once the news is obtained, it is compared with the interval and if programmatically the news is added or not to the array of results.

If you do not want to use this method, simply do not specify a date value, or leave it to None.

@@ -200,7 +200,7 @@ def _clean(html):

def _process(self, item):
url = process_url(item, self._exclude_websites)
if url:
if url and (inspect.stack()[2][3] == 'get_news' or inspect.stack()[2][3] == 'get_news_by_site' or self._is_date_in_range(item.get("published", ""))):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @v-cardona can you please add test cases for this chnage? also can you please update README.md with example?

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

Successfully merging this pull request may close these issues.

2 participants