The News Summarization API is a powerful tool built using Python, Flask, and Google Gemini. It provides summarized news articles from multiple publications and topics, including world news, sports, entertainment, and weather. Additionally, it supports translation of articles and summaries into most languages.
Deployed API to ping Deployed Frontend: API currently in use for a AI powered News Site
newsAPI/
├── app.py
├── config.py
├── methods/
| ├── cache.py
│ ├── entertainment_news.py
│ ├── fashion_news.py
│ ├── finance_news.py
│ ├── gemini.py
│ ├── sports_news.py
│ ├── tech_news.py
│ ├── weather_news.py
│ ├── scraping_template.py
│ └── world_news.py
├── routes/
│ ├── entertainment_news_route.py
│ ├── fashion_news_route.py
│ ├── finance_news_route.py
│ ├── sports_news_route.py
│ ├── tech_news_route.py
│ ├── weather_news_route.py
│ └── world_news_route.py
├── templates/
│ └── index.html
└── tests/
├── test_routes.py
├── test_cache.py
├── test_scraping.py
└── test_time_cache.py
- Multi-Publication Support: Fetch news from a variety of sources like Wired, AP, Vogue, Yahoo Sports, and more.
- AI-Powered Summaries: Get concise summaries of articles using Google Gemini.
- Language Translation: Translate articles or summaries into your preferred language.
- Raw Article Text: Option to retrieve the full article text without AI summarization.
- Article Caching: Cache summaries to improve performance.
You can either host the API yourself or use the deployed version. Simply make requests to the supported API routes.
To translate an article or summary, append ?language=your_language to the API endpoint. The default language is English.
Example:
/wired-pick-of-day?language=spanish returns the Wired pick of the day in Spanish.
If you want the full article text without an AI summary, add -text to the end of the API call.
Example:
/wired-pick-of-day-text returns the full article text from Wired.
AI Summary API endpoints return JSON objects in the following format:
{
"article_link": "https://example.com/article",
"article_tags": "technology, AI, innovation",
"article_title": "Article Title",
"article_text": "Summarized or full article text..."
}Topic Routes (such as /world-news) Return a list of multiple JSON object in the following format:
[
{
"article_link": "https://example.com/article1",
"article_tags": "technology, AI, innovation",
"article_title": "Article Title1",
"article_text": "Summarized or full article text..."
},
{
"article_link": "https://example.com/article2",
"article_tags": "technology, AI, innovation",
"article_title": "Article Title2",
"article_text": "Summarized or full article text..."
},
{
"article_link": "https://example.com/article3",
"article_tags": "technology, AI, innovation",
"article_title": "Article Title3",
"article_text": "Summarized or full article text..."
}
]Below is a list of all supported API routes:
| Route | Description |
|---|---|
/wired-pick-of-day |
Wired's pick of the day |
/AP-pick-of-day |
Associated Press's pick of the day |
/vogue-pick-of-day |
Vogue's pick of the day |
/rolling-stone-movies-tv-pick-of-day |
Rolling Stone's movies/TV pick of the day |
/yahoo-sports |
Yahoo Sports (breaking news and pick of the day) |
/democracy-now-pick-of-day |
Democracy Now's pick of the day |
/BBC-now-pick-of-day |
BBC pick of the day |
/NPR-now-pick-of-day |
NPR pick of the day |
/japan-times-now-pick-of-day |
Japan Times pick of the day |
/world-news |
Top world news stories |
/SCMP-pick-of-day |
South China Morning Post's pick of the day |
/SCMP-china-top-story |
SCMP's top China story |
/cosmo-style-pick-of-day |
Cosmopolitan's style pick of the day |
/fashion-news |
Latest fashion news |
/techcrunch-pick-of-day |
TechCrunch's pick of the day |
/zdnet-pick-of-day |
ZDNet's pick of the day |
/techreport-pick-of-day |
Techreport' pick of the day |
/infoq-pick-of-day |
Infoq' pick of the day |
/forbes-pick-of-day |
Forbes' pick of the day |
/tech-news |
Top tech news |
/weather-channel-pick-of-day |
The Weather Channel's pick of the day |
/weather-gov-pick-of-day |
Weather.gov's pick of the day |
/weather-news |
Latest weather news |
/yahoo-finance-pick-of-day |
Yahoo Finance's pick of the day |
/economist-pick-of-day |
The Economist's pick of the day |
/forbes-pick-of-day |
Forbes' pick of the day |
/investopedia-pick-of-day |
Investopedia' pick of the day |
/finance-news |
Top finance news |
/yahoo-sports-recap |
Top articles for major sports leagues |
/people-pick-of-day |
People's pick of the day |
/entertainment-news |
Latest entertainment news |
-
Get Wired's pick of the day in Spanish:
GET /wired-pick-of-day?language=spanish -
Get full article text from AP:
GET /AP-pick-of-day-text -
Get Yahoo Sports recap:
GET /yahoo-sports-recap
You can deploy this API on your preferred platform (e.g., Heroku, AWS, Google Cloud). Ensure you have the required environment variables set up, including your Google Gemini API key.
Contributions are welcome! If you'd like to add new features, fix bugs, or improve documentation, please open an issue or submit a pull request.
Enjoy using the News Summarization API! For any questions or issues, feel free to open an issue on GitHub.