raghavNCI
commited on
Commit
·
6a3e0a5
1
Parent(s):
2f96339
eliminated headlines
Browse files- app.py +0 -2
- nuse_modules/fetchHeadlines.py +0 -20
- routes/headlines.py +0 -9
app.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
from fastapi import FastAPI
|
2 |
from routes.category import router # routes.py must be in same folder
|
3 |
from routes.question import askMe
|
4 |
-
from routes.headlines import headlines
|
5 |
from routes.wa_gateway import wa_router
|
6 |
from dotenv import load_dotenv
|
7 |
from cache_init import fetch_and_cache_articles
|
@@ -13,7 +12,6 @@ load_dotenv()
|
|
13 |
app = FastAPI()
|
14 |
app.include_router(router)
|
15 |
app.include_router(askMe)
|
16 |
-
app.include_router(headlines)
|
17 |
app.include_router(wa_router)
|
18 |
|
19 |
app.add_middleware(
|
|
|
1 |
from fastapi import FastAPI
|
2 |
from routes.category import router # routes.py must be in same folder
|
3 |
from routes.question import askMe
|
|
|
4 |
from routes.wa_gateway import wa_router
|
5 |
from dotenv import load_dotenv
|
6 |
from cache_init import fetch_and_cache_articles
|
|
|
12 |
app = FastAPI()
|
13 |
app.include_router(router)
|
14 |
app.include_router(askMe)
|
|
|
15 |
app.include_router(wa_router)
|
16 |
|
17 |
app.add_middleware(
|
nuse_modules/fetchHeadlines.py
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
# nuse_modules/fetch_headline_articles.py
|
2 |
-
|
3 |
-
from nuse_modules.google_search import search_google_news_batch
|
4 |
-
|
5 |
-
def fetch_headline_articles():
|
6 |
-
queries = [
|
7 |
-
"India news", "US politics", "UK elections", "China economy",
|
8 |
-
"Tech layoffs", "Ukraine war", "AI regulation", "Africa development",
|
9 |
-
"South America inflation", "Global stock markets", "Climate change",
|
10 |
-
"Middle East", "EU summit", "Canada economy", "Australia news",
|
11 |
-
"Russia sanctions", "Elections 2025", "Big tech", "Trade wars",
|
12 |
-
"Global protests", "Public health", "Oil prices", "Space news",
|
13 |
-
"Cryptocurrency", "Cybersecurity"
|
14 |
-
]
|
15 |
-
|
16 |
-
print("[INFO] Fetching news articles from Google Custom Search...")
|
17 |
-
articles = search_google_news_batch(queries, results_per_query=30) # 30 per query × 25 queries = ~750 raw
|
18 |
-
|
19 |
-
print(f"[INFO] Retrieved {len(articles)} unique articles.")
|
20 |
-
return articles
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
routes/headlines.py
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
from fastapi import APIRouter
|
2 |
-
from nuse_modules.fetchHeadlines import fetch_headline_articles
|
3 |
-
|
4 |
-
headlines = APIRouter()
|
5 |
-
|
6 |
-
@headlines.get("/headlines")
|
7 |
-
def get_headlines():
|
8 |
-
articles = fetch_headline_articles()
|
9 |
-
return {"total-articles": len(articles), "articles": articles}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|