Skip to content

WaydeWan/AI-Newsketch

Repository files navigation

AI Newsketcher - Intelligent News Summarization System

An AI-powered daily news summarization system based on Claude AI, supporting multi-domain classification (Politics, Finance, Entertainment, Health, Sports).

✨ Features

  • 📰 Multi-source RSS News Collection - Automatically collects news from Reuters, Politico, WSJ, ESPN, and other major US media sources
  • 🤖 AI-Powered Summarization - Uses Claude API to generate professional news summaries
  • 📊 Multi-Domain Classification - Supports 5 built-in domains: Politics, Finance, Entertainment, Health, Sports
  • 🔍 Custom Domains - Add custom news domains with AI-recommended RSS feeds
  • Time-based Filtering - Morning briefing (previous day 6 PM - today 6 AM), Evening briefing (today 6 AM - 6 PM), and Search news (last 6 hours)
  • 📅 History Management - Automatically saves historical summaries with separate daily and search records
  • 💾 Smart Caching - Caches daily briefings to avoid redundant API calls
  • 📊 Progress Tracking - Real-time progress bar during summary generation
  • 📄 Export Functionality - Export summaries as Markdown or PDF
  • 🎨 Modern UI - Beautiful responsive design with mobile support
  • ⚙️ Detail Level Control - Adjustable summary detail level (concise/standard/detailed)
  • 🔄 Scheduled Tasks - Automatic daily briefings at 6:00 AM and 6:00 PM

🚀 Quick Start

1. Install Dependencies

pip install -r requirements.txt

2. Configure API Key

Create a .env file:

# Windows
copy .env.example .env

# Linux/Mac
cp .env.example .env

Edit the .env file and add your Anthropic API key:

ANTHROPIC_API_KEY=your_api_key_here

💡 Get API key: https://console.anthropic.com/

3. Run the Service

Windows:

python main.py
# Or double-click start.bat

Linux/Mac:

python main.py
# Or
chmod +x start.sh
./start.sh

4. Access the Application

Open your browser and visit: http://localhost:8000

📖 Usage

  1. Select Briefing Type: Morning Briefing (previous day 6 PM - today 6 AM), Evening Briefing (today 6 AM - 6 PM), or Search News (last 6 hours)
  2. Select Domain: Choose a specific domain or "All Domains"
  3. Adjust Detail Level: Select concise, standard, or detailed summary length
  4. Click "Generate Summary": The system will automatically collect news and generate AI summaries
  5. View History: Click "View History Daily Briefings" or "View Search Records" to browse previous summaries
  6. Export: Export summaries as Markdown or PDF files
  7. Custom Domains: Add custom news domains with AI-recommended RSS feeds

🏗️ Tech Stack

  • Backend: FastAPI + Python 3.11+
  • AI Model: Anthropic Claude 3 Haiku
  • Frontend: HTML5 + CSS3 + Vanilla JavaScript
  • Database: SQLite
  • RSS Parsing: feedparser
  • Content Processing: BeautifulSoup4
  • Task Scheduling: APScheduler
  • Export: markdown, reportlab

📁 Project Structure

ai-newsketcher/
├── main.py              # Backend main file (all logic)
├── index.html           # Frontend page
├── requirements.txt     # Python dependencies
├── .env                 # Environment variables (create this)
├── .env.example         # Environment variable example
├── news_brief.db        # SQLite database (auto-created)
└── README.md            # This file

🔧 Configuration

RSS Feed Configuration

You can modify RSS feeds in the RSS_FEEDS dictionary in main.py:

RSS_FEEDS = {
    "politics": ["https://feeds.reuters.com/reuters/politicsNews"],
    "finance": ["https://feeds.reuters.com/reuters/businessNews"],
    # ... more sources
}

API Model Selection

Default uses claude-3-haiku-20240307 (low cost, fast)

You can modify it in the summarize_news function in main.py:

model="claude-3-5-sonnet-20241022"  # Higher quality but more expensive

Custom Domains

You can add custom news domains through the UI:

  1. Click "Custom Domain" button
  2. Enter domain name (e.g., "technology", "crypto")
  3. Click "Let AI Recommend Sources" to get AI-suggested RSS feeds
  4. Add the domain with selected feeds

⚠️ Notes

  1. API Costs: Each summary generation calls Claude API, monitor your usage
  2. Network Requirements: Must be able to access RSS feeds and Anthropic API
  3. First Run: May take 30-60 seconds to generate summaries (depends on news quantity)
  4. Caching: Daily briefings are cached to avoid redundant API calls for the same day/type/domain

🐛 Troubleshooting

Issue: API Call Failed

  • Check if API key in .env file is correct
  • Verify network connection is normal
  • Check if API quota is sufficient

Issue: RSS Collection Failed

  • Some RSS feeds may require proxy access
  • Check network connection
  • Try replacing with other RSS feeds

Issue: Page Won't Load

  • Confirm service is started (check terminal output)
  • Confirm port 8000 is not occupied
  • Try accessing http://127.0.0.1:8000

📝 Features Implemented

  • ✅ Scheduled tasks for automatic daily briefings (APScheduler)
  • ✅ Smart caching mechanism
  • ✅ Progress tracking with real-time progress bar
  • ✅ Export functionality (Markdown/PDF)
  • ✅ Custom domain support with AI-recommended RSS feeds
  • ✅ Detail level control (concise/standard/detailed)
  • ✅ History management (daily briefings and search records)
  • ✅ Delete functionality for history records

📄 License

MIT License

🙏 Acknowledgments

  • Anthropic - Claude AI
  • RSS feed providers: Reuters, Politico, WSJ, ESPN, CBS Sports, Variety, STAT News, etc.

About

AI-generated multi-domain news briefs that reveal global sentiment at a glance. Build for first UCI Anthropic AI Hackathon.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages