Spaces:
Running
Running
Update gather_news.py
Browse files- gather_news.py +4 -2
gather_news.py
CHANGED
@@ -9,8 +9,9 @@ from extract_news import extract_news_articles, create_dataframe, save_to_csv
|
|
9 |
def fetch_newsapi_top_headlines(min_length=100, max_articles=30):
|
10 |
import config
|
11 |
url = 'https://newsapi.org/v2/top-headlines'
|
|
|
12 |
params = {
|
13 |
-
'apiKey':
|
14 |
'language': 'en',
|
15 |
'pageSize': max_articles
|
16 |
}
|
@@ -62,8 +63,9 @@ def fetch_newsapi_top_headlines(min_length=100, max_articles=30):
|
|
62 |
def fetch_newsapi_everything(topic, min_length=100, max_articles=50):
|
63 |
import config
|
64 |
url = 'https://newsapi.org/v2/everything'
|
|
|
65 |
params = {
|
66 |
-
'apiKey':
|
67 |
'language': 'en',
|
68 |
'q': topic,
|
69 |
'pageSize': max_articles,
|
|
|
9 |
def fetch_newsapi_top_headlines(min_length=100, max_articles=30):
|
10 |
import config
|
11 |
url = 'https://newsapi.org/v2/top-headlines'
|
12 |
+
api_key = os.environ.get("api_key")
|
13 |
params = {
|
14 |
+
'apiKey': api_key,
|
15 |
'language': 'en',
|
16 |
'pageSize': max_articles
|
17 |
}
|
|
|
63 |
def fetch_newsapi_everything(topic, min_length=100, max_articles=50):
|
64 |
import config
|
65 |
url = 'https://newsapi.org/v2/everything'
|
66 |
+
api_key = os.environ.get("api_key")
|
67 |
params = {
|
68 |
+
'apiKey': api_key,
|
69 |
'language': 'en',
|
70 |
'q': topic,
|
71 |
'pageSize': max_articles,
|