fetching news by keywords

This commit is contained in:
Rripped 2022-03-29 12:28:28 +02:00
parent 4bd53c0116
commit 4005e8dccf
2 changed files with 3 additions and 3 deletions

View File

@ -247,7 +247,7 @@ def send_news(message):
keywords = api_handler.get_user_keywords(user_id)
keywords_search = ' OR '.join(keywords)
print(keywords_search)
news_list = news.get_top_news_by_keyword(keywords_search)["articles"]
news_list = news.get_all_news_by_keyword(keywords_search)["articles"][:5]
if news_list:
for article in news_list:

View File

@ -25,8 +25,8 @@ sources = source_json["sources"]
str_sources = ",".join([source["id"] for source in sources])
def get_top_news_by_keyword(keyword):
"""get top news to keyword
def get_all_news_by_keyword(keyword, from_date="2022-01-01", to_date="2022-03-29"): # hard coded will change soon
"""get all news to keyword
Args:
keyword (String): keyword for search