news working
This commit is contained in:
@@ -14,7 +14,6 @@ import requests
|
||||
|
||||
from newsapi import NewsApiClient
|
||||
from dotenv import load_dotenv
|
||||
import urllib.parse as urlparse
|
||||
|
||||
load_dotenv()
|
||||
|
||||
@@ -34,8 +33,7 @@ def get_top_news_by_keyword(keyword):
|
||||
Returns:
|
||||
JSON/dict: dict containing articles
|
||||
"""
|
||||
keyword_url = urlparse.quote(keyword)
|
||||
top_headlines = newsapi.get_top_headlines(q=keyword_url, sources=str_sources, language='en')
|
||||
top_headlines = newsapi.get_everything(q=keyword, sources=str_sources, language='en')
|
||||
return top_headlines
|
||||
|
||||
def format_article(article):
|
||||
|
Reference in New Issue
Block a user