A web application that analyzes how news articles frame events through language choices, source selection, and emphasis patterns. The tool searches for articles on a given topic, extracts their content, and uses AI to identify framing signals including evaluative language, agent emphasis, quoted sources, causal framing, and headline framing.
- Article Discovery: Automatically finds relevant news articles using Google Custom Search API
- Content Extraction: Scrapes article content, headlines, authors, and publication dates
- Framing Analysis: Uses Google Gemini AI to analyze articles across 5 key framing dimensions:
- Evaluative language
- Agent emphasis
- Quoted sources
- Causal framing
- Headline framing
- Modern Web Interface: Clean, responsive frontend built with Tailwind CSS
- Backend: Flask (Python)
- Frontend: HTML, CSS, JavaScript (Tailwind CSS)
- APIs: Google Gemini AI, Google Custom Search API
- Web Scraping: newspaper3k, BeautifulSoup
- Python 3.7+
- Google Gemini API key
- Google Custom Search API key and Engine ID
-
Clone the repository
git clone <your-repo-url> cd news-framing-tool
-
Install dependencies
cd backend pip install -r requirements.txt -
Configure environment variables
Create a
.envfile in the project root:GEMINI_API_KEY=your_gemini_api_key GOOGLE_SEARCH_API_KEY=your_google_search_api_key GOOGLE_SEARCH_ENGINE_ID=your_search_engine_id -
Run the backend server
cd backend python app.pyThe API will run on
http://localhost:5000 -
Open the frontend
Open
frontend/index.htmlin your web browser, or serve it using a local web server.
- Enter a news topic in the search box (e.g., "2024 Paris Olympics opening ceremony")
- Click "Analyze Framing" to search for articles and analyze their framing
- View detailed framing analysis results for each article
GET /api/health- Health check endpointPOST /api/analyze- Analyze framing for a topic{ "topic": "2024 Paris Olympics opening ceremony" }
news-framing-tool/
├── backend/
│ ├── app.py # Flask application
│ ├── config.py # Configuration and API key management
│ ├── requirements.txt # Python dependencies
│ ├── services/
│ │ ├── article_finder.py # Google Search integration
│ │ ├── scraper.py # Article content extraction
│ │ └── analyzer.py # Gemini AI framing analysis
│ └── utils/
│ └── prompts.py # AI prompts for analysis
├── frontend/
│ ├── index.html # Main search interface
│ ├── results.html # Results display page
│ ├── script.js # Frontend JavaScript
│ └── style.css # Custom styles
└── README.md
This tool analyzes how articles frame events through language choices. It does not fact-check content or determine which framing is more accurate. The analysis is meant to help users understand different perspectives and framing techniques used in news media.
[Add your license here]