help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • Blog
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
news-summary-bot
RSK World
news-summary-bot
News Summary Bot - Python + Flask + OpenAI + NewsAPI + AI Summarization + Real-time News + News Aggregation
news-summary-bot
  • __pycache__
  • static
  • templates
  • .env459 B
  • .gitignore761 B
  • GITHUB_RELEASE_SUMMARY.md3.7 KB
  • INSTALLATION.md2.7 KB
  • PROJECT_SUMMARY.md9.5 KB
  • README.md11.4 KB
  • RELEASE_NOTES_v1.0.0.md6.7 KB
  • admin.py7.6 KB
  • analytics.py11 KB
  • app.py14.1 KB
  • auth.py15 KB
  • cache.py11.1 KB
  • export.py14.2 KB
  • news_bot.py4.7 KB
  • requirements.txt286 B
  • search.py16.8 KB
  • security.py14.4 KB
RELEASE_NOTES_v1.0.0.mdindex.htmlappointments.pynews_bot.py
RELEASE_NOTES_v1.0.0.md
Raw Download

RELEASE_NOTES_v1.0.0.md

# News Summary Bot v1.0.0 - Initial Release

## 🎉 First Official Release

We're excited to announce the first official release of the News Summary Bot - a comprehensive AI-powered news aggregation and summarization platform.

**Release Date:** January 2026
**Developer:** Molla Samser
**Design & Testing:** Rima Khatun
**Company:** RSK World
**Website:** https://rskworld.in

---

## ✨ Key Features

### Core Functionality
- ✅ **Real-time News Fetching** - Fetches top headlines from multiple sources using NewsAPI
- ✅ **AI Article Summarization** - Generates high-quality summaries using OpenAI GPT-3.5 Turbo
- ✅ **Multi-language Support** - Summarize news in English, Hindi, Spanish, French, German
- ✅ **Voice Search** - Search news using voice commands (Web Speech API)
- ✅ **Category Filtering** - Browse news in Business, Tech, Health, Science, Sports, etc.
- ✅ **Sentiment Analysis** - Analyze the sentiment of news articles with advanced NLP
- ✅ **Reliability Scoring** - Check the reliability and objectivity of news sources
- ✅ **Mobile Responsive** - Modern glassmorphism design that works on all devices

### Advanced Features
- ✅ **User Authentication System** - Complete user registration, login, and session management
- ✅ **Personalization** - User preferences, reading history, and personalized recommendations
- ✅ **Advanced Search** - Full-text search with filters, sorting, and suggestions
- ✅ **Caching System** - Intelligent caching for improved performance and reduced API costs
- ✅ **Analytics Dashboard** - Comprehensive admin panel with real-time analytics
- ✅ **Data Export** - Export data in JSON, CSV, XML formats with backup capabilities
- ✅ **Rate Limiting** - Advanced API rate limiting and security features
- ✅ **Admin Panel** - Complete admin interface for monitoring and management
- ✅ **Bookmarks/Favorites** - Save and manage favorite articles
- ✅ **PDF Export** - Export summaries as PDF documents

### Security Features
- ✅ **Input Validation** - Comprehensive input sanitization and validation
- ✅ **Rate Limiting** - Configurable rate limiting with exponential backoff
- ✅ **CSRF Protection** - Cross-site request forgery protection
- ✅ **Security Headers** - Complete security header implementation
- ✅ **API Key Authentication** - Secure API key validation
- ✅ **Session Management** - Secure session handling with expiration

---

## 📦 What's Included

### Backend Components
- `app.py` - Main Flask application (335+ lines)
- `news_bot.py` - Core news fetching and processing
- `analytics.py` - Advanced analytics and NLP processing (374 lines)
- `cache.py` - Intelligent caching system (374 lines)
- `auth.py` - User authentication and preferences (513 lines)
- `search.py` - Advanced search functionality (570 lines)
- `export.py` - Data export and reporting (484 lines)
- `security.py` - Security and rate limiting (487 lines)
- `admin.py` - Admin panel routes (262 lines)

### Frontend Components
- Modern glassmorphism UI design
- Responsive templates for all pages
- Interactive JavaScript with voice search
- Chart.js integration for analytics
- jsPDF integration for PDF export

### Documentation
- Comprehensive README.md
- Detailed INSTALLATION.md
- Complete PROJECT_SUMMARY.md
- Code comments and documentation

---

## 🚀 Getting Started

### Prerequisites
- Python 3.8 or higher
- pip (Python package manager)
- Valid API keys (NewsAPI and OpenAI)

### Quick Start
```bash
# Clone the repository
git clone https://github.com/rskworld/news-summary-bot.git
cd news-summary-bot

# Create virtual environment
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # Mac/Linux

# Install dependencies
pip install -r requirements.txt

# Configure environment variables
# Create .env file with your API keys

# Run the application
python app.py
```

### Access Points
- **Main Page:** http://localhost:5000
- **Demo Interface:** http://localhost:5000/demo
- **Admin Panel:** http://localhost:5000/admin

---

## 📊 Project Statistics

- **Total Files:** 26
- **Python Modules:** 8
- **HTML Templates:** 10
- **Lines of Code:** ~7,630+
- **Features Implemented:** 25+

---

## 🛠 Technologies Used

### Backend
- Python Flask
- OpenAI API (GPT-3.5 Turbo)
- NewsAPI.org
- SQLite (with full-text search)
- Custom caching system

### Frontend
- HTML5, CSS3, JavaScript
- Glassmorphism design
- Chart.js for analytics
- Font Awesome 6.0
- jsPDF for document export

---

## 🔒 Security

This release includes comprehensive security features:
- Secure password hashing with salt
- Session management with expiration
- CSRF token protection
- API key validation
- Rate limiting with exponential backoff
- Input validation and sanitization
- Security headers implementation

---

## 📤 Data Export

Supported export formats:
- **JSON** - Complete data structure
- **CSV** - Tabular data for spreadsheets
- **XML** - Structured data format
- **ZIP** - Multiple formats in one package

Export types:
- User data export (GDPR compliant)
- Analytics data export
- News articles export
- Full system backup

---

## 🐛 Known Issues

None at this time. This is a stable release.

---

## 📝 Changelog

### v1.0.0 (January 2026)
- Initial release
- All core features implemented
- Complete documentation
- Security features implemented
- Admin panel functional
- Export functionality working
- Voice search integrated
- PDF export working
- Bookmarks system implemented

---

## 🤝 Contributing

Contributions are welcome! Please ensure all code follows the project standards and includes proper documentation.

---

## 📄 License

© 2026 RSK World. All rights reserved.

---

## 📞 Support & Contact

For technical support and inquiries:
- **Email:** info@rskworld.com, support@rskworld.in
- **Phone:** +91 93305 39277
- **Website:** https://rskworld.in
- **Address:** Nutanhat, Mongolkote, Purba Burdwan, West Bengal, India, 713147

---

## 🙏 Acknowledgments

This project is part of the RSK World AI Chatbots collection. Visit https://rskworld.in for more projects and resources.

### Technologies Used
- [OpenAI](https://openai.com/) - AI-powered summarization
- [NewsAPI](https://newsapi.org/) - Real-time news data
- [Flask](https://flask.palletsprojects.com/) - Web framework
- [Chart.js](https://www.chartjs.org/) - Data visualization
- [Font Awesome](https://fontawesome.com/) - Icon library

---

**Thank you for using News Summary Bot!**

Developed by Molla Samser | Design & Testing by Rima Khatun
RSK World | https://rskworld.in
templates/index.html
Raw Download
Find: Go to:
<!DOCTYPE html>
<html lang="en">
<!--
    News Summary Bot - Landing Page
    Developer: Molla Samser
    Design & Testing: Rima Khatun
    Company: RSK World
    Year: 2026
    Website: https://rskworld.in
-->
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>News Summary Bot - AI Powered Updates</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap" rel="stylesheet">
</head>
<body>
    <nav>
        <div class="logo">
            <i class="fas fa-newspaper text-danger"></i> RSK NEWS BOT
        </div>
        <div class="nav-links">
            <a href="/demo" class="btn-premium">Live Demo</a>
        </div>
    </nav>

    <header class="hero">
        <h1 class="animate-up">Stay Informed, <br><span style="color: #dc3545;">Summarized</span>.</h1>
        <p>Our AI-powered News Summary Bot fetches the latest headlines from across the globe and compresses them into readable, bite-sized summaries for busy professionals.</p>
        <div class="hero-btns">
            <a href="/demo" class="btn-premium">Explore Real-time News</a>
        </div>
    </header>

    <section style="padding: 5rem 10%;" id="features">
        <h2 style="text-align: center; font-size: 2.5rem; margin-bottom: 3rem;">Core Features</h2>
        <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2rem;">
            <div class="glass-card">
                <i class="fas fa-bolt" style="font-size: 2rem; color: #dc3545; margin-bottom: 1rem;"></i>
                <h3>Real-time Fetching</h3>
                <p>Always get the latest news using high-performance APIs.</p>
            </div>
            <div class="glass-card">
                <i class="fas fa-brain" style="font-size: 2rem; color: #0d6efd; margin-bottom: 1rem;"></i>
                <h3>AI Summarization</h3>
                <p>Powered by OpenAI GPT-3.5 for high-quality article summaries.</p>
            </div>
            <div class="glass-card">
                <i class="fas fa-filter" style="font-size: 2rem; color: #ffc107; margin-bottom: 1rem;"></i>
                <h3>Category Filtering</h3>
                <p>Filter news by Business, Tech, Health, Science, and more.</p>
            </div>
        </div>
    </section>

    <footer>
        <p>&copy; 2026 <a href="https://rskworld.in" style="color: #dc3545; text-decoration: none;">RSK World</a>. All rights reserved.</p>
        <p>Developed by <strong>Molla Samser</strong> | Design & Testing by <strong>Rima Khatun</strong></p>
    </footer>

    <script src="{{ url_for('static', filename='js/script.js') }}"></script>
</body>
</html>
66 lines•2.9 KB
markup
news_bot.py
Raw Download
Find: Go to:
"""
News Bot Logic - Fetching and Summarizing News Articles
Developer: Molla Samser
Design & Testing: Rima Khatun
Company: RSK World
Year: 2026
Website: https://rskworld.in
"""

import os
import requests
from openai import OpenAI
from dotenv import load_dotenv

load_dotenv()

class NewsBot:
    def __init__(self):
        self.news_api_key = os.getenv("NEWS_API_KEY")
        self.openai_api_key = os.getenv("OPENAI_API_KEY")
        self.client = OpenAI(api_key=self.openai_api_key) if self.openai_api_key else None

    def fetch_news(self, category="general", query=None):
        """Fetches news from NewsAPI."""
        if not self.news_api_key:
            return {"error": "News API Key not configured. Please add it to your .env file."}
        
        url = "https://newsapi.org/v2/top-headlines"
        params = {
            "apiKey": self.news_api_key,
            "country": "us",
            "category": category,
            "pageSize": 10
        }
        if query:
            url = "https://newsapi.org/v2/everything"
            params = {"apiKey": self.news_api_key, "q": query, "pageSize": 10}

        try:
            response = requests.get(url, params=params)
            response.raise_for_status()
            return response.json()
        except Exception as e:
            return {"error": str(e)}

    def summarize_article(self, content, language="English"):
        """Summarizes an article using OpenAI API with language support."""
        if not self.client:
            return "OpenAI API Key not configured. Cannot generate summary."

        try:
            prompt = f"Summarize the following news article briefly and concisely in {language}. Provide only the summary."
            response = self.client.chat.completions.create(
                model="gpt-3.5-turbo",
                messages=[
                    {"role": "system", "content": "You are a helpful news assistant."},
                    {"role": "user", "content": f"{prompt}\n\nArticle: {content}"}
                ],
                max_tokens=250
            )
            return response.choices[0].message.content.strip()
        except Exception as e:
            return f"Error during summarization: {str(e)}"

    def analyze_sentiment(self, content):
        """Analyzes the sentiment of an article snippet."""
        if not self.client:
            # Fallback simple logic if no OpenAI client
            content_lower = content.lower()
            positive_words = ['great', 'good', 'success', 'breakthrough', 'positive', 'win', 'improve']
            negative_words = ['fail', 'crisis', 'bad', 'death', 'crash', 'negative', 'loss', 'decline']
            
            p_count = sum(1 for w in positive_words if w in content_lower)
            n_count = sum(1 for w in negative_words if w in content_lower)
            
            if p_count > n_count: return "Positive"
            if n_count > p_count: return "Negative"
            return "Neutral"

        try:
            response = self.client.chat.completions.create(
                model="gpt-3.5-turbo",
                messages=[
                    {"role": "system", "content": "Analyze the sentiment of the following news headline/snippet. Respond with exactly one word: Positive, Negative, or Neutral."},
                    {"role": "user", "content": content}
                ],
                max_tokens=10
            )
            sentiment = response.choices[0].message.content.strip().replace('.', '')
            return sentiment if sentiment in ["Positive", "Negative", "Neutral"] else "Neutral"
        except:
            return "Neutral"

    def analyze_reliability(self, content):
        """Analyzes the reliability and objectivity of a news snippet."""
        if not self.client:
            return 75  # Default dummy score

        try:
            response = self.client.chat.completions.create(
                model="gpt-3.5-turbo",
                messages=[
                    {"role": "system", "content": "Analyze the reliability and objectivity of the following news headline/snippet. Respond with exactly one number between 0 and 100, where 100 is highly reliable and objective."},
                    {"role": "user", "content": content}
                ],
                max_tokens=5
            )
            score_str = response.choices[0].message.content.strip()
            # Extract number
            import re
            match = re.search(r'\d+', score_str)
            return int(match.group()) if match else 75
        except:
            return 75

# Developer Details in comment
# Created by Molla Samser (RSK World)
# 2026
119 lines•4.7 KB
python

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer