Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -227,8 +227,12 @@ def fetch_news(query, num_results=20):
|
|
227 |
return []
|
228 |
|
229 |
@cache(expire=3600)
|
|
|
|
|
|
|
|
|
230 |
def analyze_news(query):
|
231 |
-
news_data =
|
232 |
|
233 |
if not news_data:
|
234 |
return "Failed to fetch news data.", []
|
|
|
227 |
return []
|
228 |
|
229 |
@cache(expire=3600)
|
230 |
+
def cached_fetch_news(query: str, timestamp: int):
|
231 |
+
return fetch_news(query)
|
232 |
+
|
233 |
+
|
234 |
def analyze_news(query):
|
235 |
+
news_data = cached_fetch_news(query)
|
236 |
|
237 |
if not news_data:
|
238 |
return "Failed to fetch news data.", []
|