A personalized AI-powered news aggregator that fetches, summarizes, and fact-checks news articles.
- Python 3.8+
- Node.js 16+
- npm or yarn
- Install Python dependencies:
pip install flask flask-cors requestsThis system uses LangGraph, Flask, and external AI services to fetch, analyze, and fact-check news articles.
| Endpoint | Method | Description |
|---|---|---|
/api/news |
GET | Search news articles by topic |
/api/analyze |
POST | Analyze a single article's credibility |
/api/summary |
POST | Generate bullet-point summaries |
/api/fake-news-detection |
POST | Detect if an article contains fake news |
The main processing workflow consists of five sequential steps:
-
fetch_news():
- Retrieves articles from GNews API based on search topic
- Transforms articles into a standardized format
- Handles errors from the API
-
detect_fake_news():
- Uses Gemini API to analyze article authenticity
- Generates a fake news score (0-1)
- Provides explanations for the score
-
generate_summary():
- Creates structured bullet-point summaries
- Focuses on key insights, context, and significance
- Uses Gemini API for natural language processing
-
fact_check():
- Performs detailed credibility analysis
- Evaluates source verification and content issues
- Provides reliability points and misinformation warnings
-
finalize_results():
- Compiles all analysis data into a complete response
- Marks the process as completed
- GNews API: Source of news articles using API key
GNEWS_API_KEY - Gemini AI API: Google's generative AI model providing analysis capabilities
- Uses model: gemini-1.5-flash
- Accessed via API key
GEMINI_API_KEY
- User submits request via one of the API endpoints
- For full topic searches:
process_topic()orchestrates the complete workflow- All five agent functions run sequentially
- For single article analysis:
- The appropriate agent function is called directly
- Results are returned to the user
- External API calls are made as needed
- Results are formatted as JSON and returned to the user
- Each agent function contains error handling to ensure graceful failure
- Default values are provided when external APIs fail
- Errors are logged and returned to the client