Skip to content

Filter date articles for all methods#106

Open
v-cardona wants to merge 3 commits into
ranahaani:masterfrom
v-cardona:filter_date_articles_for_all_methods
Open

Filter date articles for all methods#106
v-cardona wants to merge 3 commits into
ranahaani:masterfrom
v-cardona:filter_date_articles_for_all_methods

Conversation

@v-cardona
Copy link
Copy Markdown
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.

Comment thread gnews/gnews.py
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
Copy Markdown
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