📰 News Summary Bot

Advanced AI-powered news summary bot that fetches real-time news articles and provides concise summaries using OpenAI GPT-3.5 Turbo. Features real-time news fetching from NewsAPI, AI-powered article summarization, multi-language support (English, Hindi, Spanish, French, German), voice search, category filtering, sentiment analysis, reliability scoring, user authentication, advanced analytics, intelligent caching, and beautiful web interface.
Try Interactive Demo

📖 Project Overview

News Summary Bot is an advanced AI-powered application that integrates OpenAI GPT-3.5 Turbo and NewsAPI with Flask to create an intelligent news summarization system. This project offers real-time news fetching from multiple sources, AI-powered article summarization, multi-language support for summaries (English, Hindi, Spanish, French, German), voice search capability, category-based filtering (Business, Tech, Health, Science, Sports, etc.), sentiment analysis of news articles, reliability scoring of news sources, user authentication and personalization, advanced analytics dashboard, intelligent caching for improved performance, comprehensive search functionality, and data export capabilities. Perfect for news aggregation, content curation, information management, and businesses requiring intelligent news summarization.

⚡ Quick Facts

🎯 Type: News Summary Bot with AI Summarization
🤖 AI Features: OpenAI GPT-3.5 Turbo, NewsAPI, News Fetching, Article Summarization, Sentiment Analysis, Reliability Scoring
⚡ Setup Time: ~5 minutes
📦 Backend: Python with Flask
🎨 Frontend: HTML5, CSS3, JavaScript
🧠 AI Model: OpenAI GPT-3.5 Turbo
📱 Platform: Web Browser
🔧 Technologies: Python, Flask, OpenAI API, NewsAPI, SQLite
25+
Files
5000+
Lines of Code
20+
Advanced Features
200K
Context Tokens
Developer: Molla Samser | Website: rskworld.in | Email: help@rskworld.in
Difficulty Level: Intermediate - Perfect for developers learning Python, Flask, OpenAI API integration, NewsAPI, news processing, sentiment analysis, and AI-powered summarization development.

✨ Features

Core Features

⚡ Real-time News Fetching

Fetches top headlines from multiple sources using NewsAPI with support for various categories including Business, Tech, Health, Science, Sports, and more.

🤖 AI Article Summarization

Generates high-quality summaries using OpenAI GPT-3.5 Turbo with intelligent content compression and key point extraction.

🌍 Multi-language Summaries

Summarize news articles in multiple languages including English, Hindi, Spanish, French, and German for global audiences.

🔍 Category Filtering

Browse news by categories (Business, Tech, Health, Science, Sports, Entertainment, etc.) with easy filtering and sorting options.

Advanced Features

🎤 Voice Search

Search news using voice commands with Web Speech API for hands-free news browsing.

😊 Sentiment Analysis

Analyze the sentiment of news articles (Positive, Negative, Neutral) using advanced NLP techniques.

⭐ Reliability Scoring

Check the reliability and objectivity of news sources with AI-powered scoring system.

👤 User Authentication

Complete user registration, login, and session management with secure password hashing.

🔍 Advanced Search

Full-text search with filters, sorting, and suggestions for finding specific news articles quickly.

📈 Analytics Dashboard

Comprehensive admin panel with real-time analytics, sentiment trends, and category distribution.

💾 Intelligent Caching

Multi-level caching system for improved performance and reduced API costs with SQLite backend.

📊 Reading History

Track reading history with personalized recommendations and user preferences management.

📤 Data Export

Export data in JSON, CSV, XML formats with backup capabilities for data management.

🔒 Rate Limiting

Advanced API rate limiting and security features with configurable limits and exponential backoff.

📱 Mobile Responsive

Modern glassmorphism design that works seamlessly on desktop, tablet, and mobile devices.

⚡ Fast Performance

Optimized Python and Flask performance with intelligent caching for < 200ms response times.

🛠️ Technologies

Python

Core programming language for educational platform

Language

Flask

Python web framework for backend API

Framework

OpenAI API

GPT-3.5 Turbo for AI-powered article summarization

AI API

NewsAPI

Real-time news data from multiple sources and categories

News API

SQLite

Database for users, cache, analytics, and full-text search

Database

python-dotenv

Environment variable management for configuration

Config

Chart.js

Data visualization for analytics dashboard and reporting

Visualization

Modular Architecture

Clean, modular code structure for easy extension

Architecture

📦 Installation Guide - Step by Step

⏱️ Installation Time: ~5 minutes

Follow these simple steps to set up the News Summary Bot on your system.

📋 Prerequisites

🐍 Python 3.8+

Python 3.8 or higher required for the news summary bot

Download: Python

🌐 Web Browser

Modern web browser (Chrome, Firefox, Safari, Edge) for accessing the news summary interface

Recommended: Latest version of Chrome or Firefox

🔑 OpenAI API Key

Get your API key from OpenAI Platform (required for AI summarization)

Get Key: OpenAI Platform

📰 NewsAPI Key

Get your API key from NewsAPI.org (required for news fetching)

Get Key: NewsAPI.org

🌐 Internet Connection

Required for Flask server, OpenAI API, and NewsAPI calls

🚀 Step-by-Step Installation

📌 Step 1: Download or Clone the Project

Option A: Download ZIP

  1. Download the project ZIP file from the repository
  2. Extract it to your desired location (e.g., C:\Projects\news-summary-bot or ~/Projects/news-summary-bot)
  3. Navigate to the extracted folder

Option B: Clone with Git

git clone https://github.com/rskworld/news-summary-bot.git
cd news-summary-bot
✅ Step 2: Install Python Dependencies

Install required Python packages using pip.

# Install dependencies
pip install -r requirements.txt
🔑 Step 3: Set Up API Keys

Configure your OpenAI API key in the environment file.

  1. Create a .env file in the project root
  2. Edit .env and add your API keys:
    • NEWS_API_KEY=your_newsapi_key_here
    • OPENAI_API_KEY=sk-your-openai-key-here
    • SECRET_KEY=your-secret-key-here
    • PORT=5000 (optional, default is 5000)
    • DEBUG=True (optional, for development)
  3. Get your NewsAPI key from NewsAPI.org
  4. Get your OpenAI API key from OpenAI Platform
  5. Make sure your API keys have sufficient credits for testing
🚀 Step 4: Start the Flask Server

Start the Flask backend server by running app.py.

# Start Flask server
python app.py

# The server will start on http://localhost:5000
🌐 Step 5: Open Frontend

Open the HTML file in your browser or use a local web server.

Method 1: Direct File Opening

  1. Open index.html in your browser

Method 2: Using Local Web Server (Recommended)

# In a new terminal, start HTTP server
python -m http.server 8000

# Then open: http://localhost:8000

✅ Installation Complete!

Congratulations! You've successfully set up the News Summary Bot. The bot is ready to use with all features including:

  • Real-time news fetching from NewsAPI
  • AI-powered article summarization using OpenAI GPT-3.5 Turbo
  • Multi-language support for summaries (English, Hindi, Spanish, French, German)
  • Voice search capability with Web Speech API
  • Category filtering (Business, Tech, Health, Science, Sports, etc.)
  • Sentiment analysis of news articles
  • Reliability scoring of news sources
  • User authentication and personalization
  • Advanced analytics dashboard
  • Intelligent caching for improved performance

Next Steps:

  1. Ensure the Flask server is running (Step 4)
  2. Open the frontend in your browser (Step 5)
  3. Fetch news articles and test summarization features
  4. Explore all the features, categories, and customization settings!

🔧 Troubleshooting Installation

❌ API Key Issues

Solution: Ensure your .env file contains valid NEWS_API_KEY and OPENAI_API_KEY (starting with sk-). Check API keys have sufficient credits.

❌ Flask Server Not Starting

Solution: Check Python version (3.8+), verify dependencies installed with pip install -r requirements.txt, ensure port 5000 is available.

❌ Connection Errors

Solution: Verify Flask server is running on port 5000, check API endpoints in script.js, ensure CORS is enabled in Flask, verify NewsAPI and OpenAI API connectivity.

❌ Import Errors

Solution: Reinstall dependencies with pip install -r requirements.txt, check virtual environment is activated, verify all packages (flask, openai, requests, etc.) are installed.

📚 Usage Guide - Step by Step

🎯 Getting Started with News Summary Bot

Step-by-Step Usage Instructions

📝 Step 1: Start Backend Server

  1. Ensure Flask server is running: python app.py
  2. Check server status at http://localhost:5000
  3. You should see the News Summary Bot interface

🌐 Step 2: Open Frontend

  1. Open http://localhost:5000 in your web browser
  2. You should see the News Summary Bot interface with:
    • News articles display area
    • Category filter buttons (Business, Tech, Health, etc.)
    • Search input field
    • Voice search button
    • Language selection for summaries
    • Summarize button
    • Analytics dashboard
    • User authentication options

📰 Step 3: Fetch and Summarize News

  1. Fetch News: Click on a category button (Business, Tech, Health, etc.) to fetch news articles
  2. View Articles: Browse through the fetched news articles with headlines and descriptions
  3. Summarize: Click on "Summarize" button to generate AI-powered summaries
  4. Try These:
    • Click "Tech" category to fetch technology news
    • Click "Business" category to fetch business news
    • Search for specific topics using the search bar
    • Use voice search to find news articles
    • Select a language (English, Hindi, Spanish, etc.) for summaries
  5. View Summaries: Read AI-generated summaries of news articles

⚙️ Step 4: Explore Features

Try out the news summary bot features:

  • Category Filtering: Filter news by Business, Tech, Health, Science, Sports, etc.
  • Search: Use advanced search with filters and sorting
  • Voice Search: Search news using voice commands
  • Multi-language Summaries: Get summaries in English, Hindi, Spanish, French, German
  • Sentiment Analysis: Check sentiment of news articles (Positive, Negative, Neutral)
  • Reliability Scoring: Check reliability and objectivity of news sources
  • User Account: Register/login to save reading history and preferences
  • Analytics: View analytics dashboard with trends and insights

💻 Using the News Summary Bot

You can interact with the News Summary Bot through the web interface:

# Example Usage 1. Fetch News: Click "Tech" category → Fetches latest technology news from NewsAPI 2. View Articles: Browse through headlines → Displays news articles with titles, descriptions, sources 3. Summarize Article: Click "Summarize" on any article → AI generates concise summary using OpenAI GPT-3.5 Turbo 4. Language Selection: Choose "Hindi" for summary language → Summary is generated in Hindi 5. Sentiment Analysis: Click "Analyze Sentiment" → Returns: Positive, Negative, or Neutral 6. Search: Type "artificial intelligence" in search → Returns relevant news articles with AI content 7. Voice Search: Click microphone icon → Speak search query and get results
# Quick Action Buttons - Business: Fetch business news - Tech: Fetch technology news - Health: Fetch health news - Science: Fetch science news - Sports: Fetch sports news - Search: Advanced search with filters - Voice: Voice search for news - Summarize: Generate AI summaries

📊 Features Usage

⚡ Real-time News

Fetch latest news from multiple sources using NewsAPI - always get up-to-date headlines

🤖 AI Summarization

Generate concise summaries of news articles using OpenAI GPT-3.5 Turbo - save time reading

🌍 Multi-language Summaries

Get summaries in English, Hindi, Spanish, French, or German - choose your preferred language

🔍 Category Filtering

Browse news by categories (Business, Tech, Health, Science, Sports, etc.) - find what interests you

🎤 Voice Search

Search for news using voice commands with Web Speech API - hands-free news browsing

😊 Sentiment Analysis

Analyze sentiment of news articles (Positive, Negative, Neutral) - understand news tone

⭐ Reliability Scoring

Check reliability and objectivity of news sources - verify information credibility

📊 Analytics Dashboard

Track news trends, sentiment distribution, category analytics, and user behavior metrics

🚀 Advanced Features & Capabilities

The News Summary Bot includes advanced AI capabilities, news processing, and intelligent summarization features. Here's what you can do:

⚡ Real-time News Intelligence

The bot excels at fetching latest news from multiple sources using NewsAPI with category filtering, search capabilities, and intelligent caching. Always get up-to-date headlines from reliable sources.

🤖 Advanced AI Summarization

Generate high-quality summaries using OpenAI GPT-3.5 Turbo with intelligent content compression and key point extraction. Summarize articles in multiple languages with cultural context awareness.

📊 Analytics Intelligence

Comprehensive analytics dashboard with sentiment trends, category distribution, user behavior tracking, and performance metrics. Understand news patterns and user preferences.

🔍 Advanced Search & Filtering

Full-text search with multiple filters (category, sentiment, language, reliability score, date range) and sorting options. Find specific news articles quickly and efficiently.

💻 Code Examples

Basic News Summary Bot Integration

// Python Flask backend - app.py from flask import Flask, request, jsonify from news_bot import NewsBot from cache import news_cache app = Flask(__name__) bot = NewsBot() @app.route('/api/news', methods=['GET']) def get_news(): category = request.args.get('category', 'general') query = request.args.get('q') # Check cache first cached_news = news_cache.get_news(category, query) if cached_news: return jsonify(cached_news) # Fetch fresh data news_data = bot.fetch_news(category=category, query=query) # Cache the results if 'articles' in news_data: news_cache.set_news(category, query, news_data) return jsonify(news_data) @app.route('/api/summarize', methods=['POST']) def summarize(): data = request.get_json() content = data.get('content') language = data.get('language', 'English') if not content: return jsonify({"error": "No content provided"}), 400 # Generate summary summary = bot.summarize_article(content, language=language) return jsonify({"summary": summary}) if __name__ == '__main__': app.run(debug=True, port=5000)

JavaScript Frontend Integration

// Frontend JavaScript - script.js async function fetchNews(category = 'general', query = null) { const url = new URL('http://localhost:5000/api/news'); url.searchParams.set('category', category); if (query) url.searchParams.set('q', query); const response = await fetch(url); const data = await response.json(); return data; } async function summarizeArticle(content, language = 'English') { const response = await fetch('http://localhost:5000/api/summarize', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ content: content, language: language }) }); const data = await response.json(); return data.summary; } // Usage fetchNews('tech').then(data => { console.log('News Articles:', data.articles); // Display articles in UI }); summarizeArticle('Long news article content...', 'English').then(summary => { console.log('Summary:', summary); // Display summary in UI });

Complete News Summary Bot Example

// News Summary Bot Class class NewsSummaryBot { constructor(apiUrl) { this.apiUrl = apiUrl || 'http://localhost:5000'; this.readingHistory = []; this.currentCategory = 'general'; } async fetchNews(category = 'general', query = null) { const url = new URL(`${this.apiUrl}/api/news`); url.searchParams.set('category', category); if (query) url.searchParams.set('q', query); const response = await fetch(url); const data = await response.json(); // Update reading history if (data.articles) { this.readingHistory.push({ category: category, query: query, articles: data.articles, timestamp: new Date() }); } this.currentCategory = category; return data; } async summarizeArticle(content, language = 'English') { const response = await fetch(`${this.apiUrl}/api/summarize`, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ content: content, language: language }) }); const data = await response.json(); return data.summary; } async analyzeSentiment(content) { const response = await fetch(`${this.apiUrl}/api/analyze`, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ content: content }) }); const data = await response.json(); return data.sentiment; } clearHistory() { this.readingHistory = []; } } // Usage const newsBot = new NewsSummaryBot(); newsBot.fetchNews('tech').then(data => { console.log('Tech News:', data.articles); // Display articles }); newsBot.summarizeArticle('Article content...', 'English').then(summary => { console.log('Summary:', summary); });

Configuration Example

// Frontend config - script.js const NewsBotConfig = { api: { baseUrl: 'http://localhost:5000', endpoints: { news: '/api/news', summarize: '/api/summarize', analyze: '/api/analyze', reliability: '/api/reliability', search: '/api/search', trending: '/api/trending' } }, categories: { supported: ['general', 'business', 'technology', 'health', 'science', 'sports', 'entertainment'], default: 'general' }, languages: { supported: ['English', 'Hindi', 'Spanish', 'French', 'German'], default: 'English' }, model: { default: 'gpt-3.5-turbo', maxTokens: 250, temperature: 0.7 }, ui: { animationDuration: 300, cacheTimeout: 300000 // 5 minutes } }; // Access configuration console.log(NewsBotConfig.categories.supported);
# Backend config - .env file NEWS_API_KEY=your_newsapi_key_here OPENAI_API_KEY=sk-your-openai-key-here SECRET_KEY=your-secret-key-here PORT=5000 DEBUG=True # Python config - config.py import os from dotenv import load_dotenv load_dotenv() class Config: NEWS_API_KEY = os.getenv('NEWS_API_KEY') OPENAI_API_KEY = os.getenv('OPENAI_API_KEY') SECRET_KEY = os.getenv('SECRET_KEY', 'your-secret-key-here') DEFAULT_MODEL = 'gpt-3.5-turbo' DEFAULT_MAX_TOKENS = 250 DEFAULT_TEMPERATURE = 0.7 SUPPORTED_LANGUAGES = ['English', 'Hindi', 'Spanish', 'French', 'German'] DEFAULT_LANGUAGE = 'English' NEWS_CACHE_TTL = 300 # 5 minutes

🔗 API Integration

OpenAI & NewsAPI Integration

The application integrates with OpenAI's GPT-3.5 Turbo API for AI-powered article summarization and NewsAPI for real-time news fetching. The backend uses Python Flask to handle API calls, news fetching, summarization, sentiment analysis, and caching, while the frontend uses JavaScript for user interactions and news display.

Available APIs & Technologies

API/Technology Type Description
OpenAI GPT-3.5 Turbo API AI API AI-powered article summarization and sentiment analysis
NewsAPI News API Real-time news data from multiple sources and categories
SQLite Database Storage for users, cache, analytics, and full-text search
Flask REST API Backend Python Flask server for API endpoints
LocalStorage Browser API Store settings and reading history
Web Speech API Browser API Voice search for news articles

Backend API Endpoints

# Flask Backend - app.py @app.route('/api/news', methods=['GET']) @rate_limit(limit=100, window=3600) def get_news(): category = request.args.get('category', 'general') query = request.args.get('q') country = request.args.get('country', 'us') # Check cache first cached_news = news_cache.get_news(category, query, country) if cached_news: return jsonify(cached_news) # Fetch fresh data news_data = bot.fetch_news(category=category, query=query) news_cache.set_news(category, query, country, news_data) return jsonify(news_data) @app.route('/api/summarize', methods=['POST']) @rate_limit(limit=50, window=3600) def summarize(): data = request.get_json() content = data.get('content') language = data.get('language', 'English') if not content: return jsonify({"error": "No content provided"}), 400 # Check cache content_hash = hashlib.md5(content.encode()).hexdigest() cached_summary = news_cache.get_summary(content_hash, language) if cached_summary: return jsonify({"summary": cached_summary, "cached": True}) # Generate summary summary = bot.summarize_article(content, language=language) news_cache.set_summary(content_hash, language, summary) return jsonify({"summary": summary, "cached": False}) @app.route('/api/analyze', methods=['POST']) @rate_limit(limit=50, window=3600) def analyze(): data = request.get_json() content = data.get('content') sentiment = bot.analyze_sentiment(content) return jsonify({"sentiment": sentiment}) @app.route('/api/search', methods=['GET']) @rate_limit(limit=200, window=3600) def search_articles(): query = request.args.get('q', '') filters = SearchFilters.validate_filters(request.args.to_dict()) results = advanced_search.search(query, filters) return jsonify(results) @app.route('/api/health', methods=['GET']) def health(): return jsonify({ 'status': 'healthy', 'newsapi_configured': bool(os.getenv('NEWS_API_KEY')), 'openai_configured': bool(os.getenv('OPENAI_API_KEY')) })
// Frontend JavaScript - API Integration async function fetchNews(category = 'general', query = null) { try { const url = new URL('http://localhost:5000/api/news'); url.searchParams.set('category', category); if (query) url.searchParams.set('q', query); const response = await fetch(url); if (!response.ok) { throw new Error('API request failed'); } const data = await response.json(); return { articles: data.articles || [], totalResults: data.totalResults || 0, category: category, cached: data.cached || false }; } catch (error) { console.error('Error:', error); return {error: error.message}; } } // Summarize article async function summarizeArticle(content, language = 'English') { const response = await fetch('http://localhost:5000/api/summarize', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ content: content, language: language }) }); return await response.json(); } // Analyze sentiment async function analyzeSentiment(content) { const response = await fetch('http://localhost:5000/api/analyze', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ content: content }) }); return await response.json(); } // Search articles async function searchArticles(query, filters = {}) { const url = new URL('http://localhost:5000/api/search'); url.searchParams.set('q', query); Object.keys(filters).forEach(key => { url.searchParams.set(key, filters[key]); }); const response = await fetch(url); return await response.json(); }

Browser Compatibility

// Check News Summary Bot API Connection async function checkHealth() { try { const response = await fetch('http://localhost:5000/api/health'); const data = await response.json(); console.log('Server Status:', data.status); console.log('NewsAPI Configured:', data.newsapi_configured); console.log('OpenAI Configured:', data.openai_configured); return data.newsapi_configured && data.openai_configured; } catch (error) { console.error('Health check failed:', error); return false; } } // Get trending topics async function getTrendingTopics(days = 7) { const response = await fetch(`http://localhost:5000/api/trending?days=${days}`); const data = await response.json(); return data.trending; } // Recommended setup: // - Backend: Python 3.8+ with Flask, OpenAI SDK, requests // - Frontend: Modern browsers (Chrome, Edge, Safari, Firefox) // - Voice Features: Chrome/Edge for Web Speech API support // - APIs: NewsAPI key (required) + OpenAI API key (required)

⚙️ Configuration

Configuration in this application is handled through environment variables and settings files:

Environment Variables

Create a .env file in the project root:

# .env file NEWS_API_KEY=your_newsapi_key_here OPENAI_API_KEY=sk-your-openai-api-key-here SECRET_KEY=your-secret-key-here PORT=5000 DEBUG=True # Admin Credentials (optional) ADMIN_USERNAME=admin ADMIN_PASSWORD=admin123

Note: Get your API keys from NewsAPI.org and OpenAI Platform. Never commit your .env file to version control.

Python Configuration

The app.py file uses environment variables for configuration:

# app.py configuration import os from dotenv import load_dotenv load_dotenv() # Environment variables NEWS_API_KEY = os.getenv('NEWS_API_KEY') OPENAI_API_KEY = os.getenv('OPENAI_API_KEY') SECRET_KEY = os.getenv('SECRET_KEY', 'your-secret-key-here') PORT = int(os.getenv('PORT', 5000)) DEBUG = os.getenv('DEBUG', 'True') == 'True' # App configuration app = Flask(__name__) app.secret_key = SECRET_KEY # Model settings DEFAULT_MODEL = 'gpt-3.5-turbo' DEFAULT_MAX_TOKENS = 250 DEFAULT_TEMPERATURE = 0.7 # Supported languages for summaries SUPPORTED_LANGUAGES = ['English', 'Hindi', 'Spanish', 'French', 'German'] DEFAULT_LANGUAGE = 'English' # Cache settings NEWS_CACHE_TTL = 300 # 5 minutes SUMMARY_CACHE_TTL = 3600 # 1 hour

Frontend Configuration

Edit script.js to configure API endpoint:

// script.js const API_BASE_URL = 'http://localhost:5000'; const DEFAULT_MODEL = 'gpt-3.5-turbo'; const DEFAULT_MAX_TOKENS = 250; const DEFAULT_TEMPERATURE = 0.7; const SUPPORTED_CATEGORIES = ['general', 'business', 'technology', 'health', 'science', 'sports', 'entertainment']; const SUPPORTED_LANGUAGES = ['English', 'Hindi', 'Spanish', 'French', 'German']; const DEFAULT_CATEGORY = 'general'; const DEFAULT_LANGUAGE = 'English'; const CACHE_TIMEOUT = 300000; // 5 minutes

Browser LocalStorage Settings

User settings are automatically saved to browser's local storage:

// Settings are saved automatically localStorage.setItem('newsBotSettings', JSON.stringify({ category: 'general', language: 'English', autoFetch: true, voiceSearchEnabled: false, darkMode: false, readingHistory: [] })); // Load settings const settings = JSON.parse(localStorage.getItem('newsBotSettings'));

Runtime Configuration

Configure settings through the web interface:

  • Category: Select news category (Business, Tech, Health, Science, Sports, etc.)
  • Language: Select summary language (English, Hindi, Spanish, French, German)
  • Auto-fetch: Enable/disable automatic news fetching on category selection
  • Voice Search: Enable/disable voice search functionality
  • Search Filters: Filter by category, sentiment, language, reliability score, date range
  • Sentiment Analysis: Enable/disable sentiment detection for articles

All settings are saved automatically and persist across browser sessions.

📁 Project Structure

The Multi-language Chatbot follows a clean, organized structure for easy navigation and maintenance.

news-summary-bot/
├── news-summary-bot/
│   ├── templates/
│   │   ├── index.html      # Landing page
│   │   ├── demo.html       # Demo interface
│   │   ├── login.html      # User login
│   │   ├── register.html   # User registration
│   │   └── admin/          # Admin panel templates
│   │       ├── dashboard.html
│   │       ├── analytics.html
│   │       ├── users.html
│   │       └── ...
│   ├── static/
│   │   ├── css/
│   │   │   └── style.css   # Modern styling
│   │   └── js/
│   │       └── script.js   # Frontend logic
│   ├── app.py              # Main Flask application
│   ├── news_bot.py         # Core news fetching and processing
│   ├── analytics.py        # Advanced analytics and NLP
│   ├── cache.py            # Intelligent caching system
│   ├── auth.py             # User authentication
│   ├── search.py           # Advanced search functionality
│   ├── export.py           # Data export and reporting
│   ├── security.py         # Security and rate limiting
│   ├── admin.py            # Admin panel routes
│   └── requirements.txt    # Python dependencies
├── demo/
│   ├── index.html          # Documentation page
│   ├── demo.html           # Interactive demo
│   ├── style.css           # Demo styling
│   └── script.js           # Demo scripts
├── .env                    # Environment variables
├── README.md               # Project documentation
├── INSTALLATION.md         # Installation guide
└── PROJECT_SUMMARY.md      # Project summary

📄 Frontend Files

Location: news-summary-bot/templates/ and news-summary-bot/static/

  • templates/index.html - Landing page
  • templates/demo.html - Demo interface
  • static/css/style.css - Modern glassmorphism styling
  • static/js/script.js - JavaScript functionality

🐍 Backend Files

Location: news-summary-bot/

  • app.py - Main Flask application with routes
  • news_bot.py - Core news fetching and processing
  • analytics.py - Advanced analytics and NLP
  • cache.py - Intelligent caching system
  • auth.py - User authentication
  • search.py - Advanced search functionality
  • export.py - Data export and reporting
  • security.py - Security and rate limiting
  • admin.py - Admin panel routes

⚙️ Configuration

Setup: Configure these files for your environment

  • .env - Environment variables (NEWS_API_KEY, OPENAI_API_KEY)
  • requirements.txt - Python dependencies (flask, openai, requests)
  • README.md - Project documentation
  • INSTALLATION.md - Installation guide

🔧 Troubleshooting

API Key Issues

  • Ensure your .env file contains valid NEWS_API_KEY and OPENAI_API_KEY (starting with sk-)
  • Check that both API keys are correctly formatted and not expired
  • Verify your NewsAPI key has sufficient credits at NewsAPI.org
  • Verify your OpenAI API key has sufficient credits at OpenAI Platform
  • Make sure the .env file is in the project root directory
  • Restart the Flask server after updating the API keys

Flask Server Issues

  • Server not starting: Check Python version (3.8+), verify dependencies installed with pip install -r requirements.txt
  • Port 5000 in use: Change port in .env file or stop other applications using port 5000
  • Import errors: Ensure virtual environment is activated, reinstall dependencies (flask, openai, requests, flask-cors)
  • CORS errors: Verify Flask-CORS is installed and enabled in app.py
  • Connection refused: Check firewall settings, ensure server is running on correct port
  • Database errors: Check file permissions for SQLite database files

Frontend Connection Issues

  • Failed to fetch: Ensure Flask server is running, check API_BASE_URL in script.js
  • CORS errors: Make sure Flask-CORS is installed and configured in backend
  • Server offline indicator: Check server status at http://localhost:5000
  • Port mismatch: Verify frontend API_BASE_URL matches backend port
  • News not fetching: Check NewsAPI key validity and credits, verify API endpoint
  • Summarization errors: Check OpenAI API key validity and credits, verify API endpoint

Common Issues

  • API key not found: Create .env file and add your NEWS_API_KEY and OPENAI_API_KEY
  • Module not found: Install dependencies with pip install -r requirements.txt
  • News fetching errors: Check NewsAPI key, verify internet connection, check API quota
  • Summarization errors: Check OpenAI API key, verify credits, check API status
  • Cache errors: Clear cache database or restart server to reset cache
  • Search not working: Verify SQLite database files exist and have proper permissions
  • Voice search not working: Check browser compatibility (Chrome/Edge recommended for Web Speech API)

📋 Requirements

Backend Requirements: - Python 3.8 or higher - Flask web framework - OpenAI Python SDK (for summarization) - Flask-CORS for CORS support - requests library (for NewsAPI) - python-dotenv for environment variables - SQLite (built-in, for databases) Frontend Requirements: - Modern Web Browser (Chrome, Edge, Safari, Firefox) - JavaScript ES6+ support - LocalStorage API - Web Speech API (for voice search, optional) API Requirements: - NewsAPI Key (get from newsapi.org - required) - OpenAI API Key (get from platform.openai.com - required) - Active internet connection for API calls Python Dependencies (see requirements.txt): - flask - flask-cors - openai - requests - python-dotenv Database: - SQLite (built-in Python, no installation needed) - Creates databases automatically (users.db, cache.db, analytics.db, etc.) Optional Dependencies: - Voice search requires Web Speech API (Chrome/Edge recommended) - Chart.js for analytics visualization (CDN)

Browser Compatibility: Chrome, Edge, Safari, or Firefox (Chrome/Edge recommended for voice search).

Python Version: Python 3.8 or higher required for backend server.

Internet Connection: Required for NewsAPI, OpenAI API calls, and CDN resources.

🎯 Use Cases

📰 News Aggregation

Aggregate news from multiple sources using NewsAPI with category filtering and search capabilities

🤖 Content Curation

Curate and summarize news articles for content creation, research, and information management

💼 Business Intelligence

Monitor business news, analyze trends, and get AI-powered summaries for decision making

📱 Mobile News Apps

Integrate news summarization capabilities into mobile applications for quick news consumption

🌐 Website Integration

Add news summary features to websites for automated content generation and news display

📊 Analytics & Insights

Track news trends, sentiment distribution, category analytics, and user reading patterns

🎓 Educational Platforms

Provide summarized news for educational purposes with multi-language support

🔍 Research Tools

Quick news research with AI summarization, sentiment analysis, and reliability scoring

💬 Support

For support, questions, or more projects:

📄 License

This project is provided as-is for educational and development purposes.

MIT License - See LICENSE file for details.