跳到正文
GitHub·· 7 天前AI 评分34

aiconsy/ai-news-agent:每小时自动生成播客式新闻简报的开源流水线

aiconsy/ai-news-agent

AI 导读

aiconsy/ai-news-agent 是一个开源自动化新闻情报流水线,每小时抓取 220+ RSS 源,经去重、深度阅读、LLM 综合后由 Edge-TTS 生成 700–1,600 字播客式音频简报并推送至 Telegram。

正文

Autonomous hourly news intelligence pipeline

Turn 220+ RSS feeds into a concise, podcast-style audio briefing — every hour, fully hands-free.

License: MIT Python 3.10+ PRs Welcome


What It Does

📰 220+ RSS Feeds         🎧 Audio Briefing
       │                       │
       ▼                       ▼
  ┌─────────┐   ┌──────────┐   ┌──────┐   ┌───────────┐   ┌─────┐
  │  Fetch   │──▶│  Dedup   │──▶│ Deep │──▶│  LLM      │──▶│ TTS │──▶ 📱 Telegram
  │ + Classify│   │ (12h +   │   │ Read │   │ Synthesize│   │Audio│
  │          │   │  fuzzy)  │   │      │   │           │   │     │
  └─────────┘   └──────────┘   └──────┘   └───────────┘   └─────┘

Pass 1 — Fetch recent headlines, drop anything older than 36 hours, collapse duplicate stories, and rank them. Keywords handle the obvious cases; the model only sees a short list of ambiguous headlines.

Pass 2 — Deep-read the few stories that can make the briefing (requests → trafilatura → readability fallback) and keep a short lead, not the whole article.

Synthesis — One LLM call writes a 700–1,600 word briefing from those leads. If nothing noteworthy is new, the run stops before calling a model.

Delivery — Edge-TTS converts to audio (OGG/Opus), sends both text and voice message to Telegram.

✨ Features

  • 🆓 Zero-cost operation — Uses Ollama Cloud subscription models, no per-token charges
  • 🎧 Podcast-style audio — Natural-sounding TTS briefings delivered as Telegram voice messages
  • 📰 220+ global feeds — Geopolitics, tech, AI, finance, cybersecurity, science (fully customizable)
  • 🔄 Hourly automation — Run as a cron job or Hermes Agent skill
  • 🧠 Smart dedup — 12h rolling window + fuzzy matching (0.6 threshold) — no repeated stories
  • 📊 Source tiers — Reuters/BBC/NYT → Tier 1 (highest trust), everything else → Tier 2–3
  • 🌙 Quiet hours — Pauses during configurable hours (default 22:00–06:00)
  • 🔒 Auto fallback — If Ollama is down, falls back to OpenRouter automatically
  • 🛡️ Robust HTTP — SSL retry, browser UA, trafilatura + readability extraction

🚀 Quick Start

Prerequisites

  • Python 3.10+
  • Ollama (local or cloud subscription)
  • ffmpeg (for audio conversion)
  • A Telegram bot token (@BotFather)

Install

git clone https://github.com/AI-Consy/ai-news-agent.git
cd ai-news-agent
pip install -e .

Configure

cp .env.example .env
# Edit .env with your settings:
#   LLM_API_KEY=your_ollama_key
#   TELEGRAM_BOT_TOKEN=your_bot_token
#   TELEGRAM_CHAT_ID=your_chat_id

💡 LLM Provider? By default, it uses local Ollama. For Ollama Cloud, just change LLM_BASE_URL. For OpenRouter, set FALLBACK_API_KEY. The default feeds are just starting points — edit config/feeds.json to match your interests.

Run

# One-shot run
ai-news run

# Text only (skip TTS)
ai-news run --text-only

# Force (ignore dedup/quiet hours)
ai-news run --force

# Skip Telegram delivery
ai-news run --no-deliver

Automate (Hermes Agent)

hermes cron create \
  --name "Hourly News Briefing" \
  --schedule "0 * * * *" \
  --prompt "Run the news briefing: cd ~/ai-news-agent && python -m ai_news_agent.main" \
  --deliver telegram

Or add to crontab:

0 * * * * /path/to/ai-news-agent/scripts/run_hourly.sh

📡 Feed Categories

The included config/feeds.json gives you 220 curated feeds:

Category Count Examples
🌍 World News 59 BBC, Al Jazeera, NPR, FT, NYT
💻 Tech & Science 52 Ars Technica, The Verge, Wired, MIT Tech Review
💰 Business & Investment 37 Bloomberg, CNBC, The Economist
🪙 Cryptocurrency 26 CoinDesk, The Block
🌍 Regional 21 BBC UK, SRF, Hungary Today
🤖 AI 17 AI News, MIT News, Google AI Blog
🔒 Cybersecurity 8 Krebs on Security, The Record, Dark Reading

🎯 Your feeds, your rules — These are defaults. Remove, add, or recategorize feeds in config/feeds.json to match your interests.

⚙️ Configuration

All settings live in .env (see .env.example for full docs):

Variable Default What it does
LLM_PROVIDER ollama Primary LLM provider
LLM_BASE_URL http://localhost:11434/api/chat Primary endpoint (local Ollama)
LLM_API_KEY — Your Ollama / OpenAI key
MODEL_CLASSIFY minimax-m2.7:cloud Classification model
MODEL_SYNTHESIS glm-5.1:cloud Briefing synthesis model
TTS_VOICE en-GB-RyanNeural Edge-TTS voice
TELEGRAM_BOT_TOKEN — From @BotFather
MAX_DEEP_READ 10 Max articles to deep-read
MAX_NOTEWORTHY 20 Max HIGH/MEDIUM stories in the briefing
DEDUP_HOURS 12 How long to remember headlines
MAX_ARTICLE_AGE_HOURS 36 Ignore RSS items older than this (0 disables)
MAX_LLM_CLASSIFY 24 Ambiguous headlines that may reach the classifier
MAX_CONTEXT_CHARS 12000 Hard cap on the synthesis prompt
QUIET_HOUR_START 22 Pause start (24h)
QUIET_HOUR_END 6 Pause end (24h)

🏗️ Architecture

ai-news-agent/
├── ai_news_agent/          # Core pipeline package
│   ├── main.py              # Orchestrator + CLI
│   ├── config.py            # All settings from .env
│   ├── feeds.py             # RSS fetch & parse
│   ├── dedup.py             # Exact + fuzzy dedup
│   ├── deepread.py          # Article text extraction
│   ├── classify.py          # Topic & priority classification
│   ├── synthesize.py        # LLM briefing generation
│   ├── tts.py               # Edge-TTS → OGG audio
│   ├── deliver.py           # Telegram delivery
│   └── db.py                # SQLite persistence
├── config/
│   └── feeds.json           # Curated RSS feeds (edit to customize)
├── scripts/
│   └── run_hourly.sh        # Cron wrapper
├── tests/
│   └── test_pipeline.py     # Unit tests + redaction guards
├── docs/
│   └── architecture.md      # Detailed architecture docs
├── .env.example             # Configuration template
├── pyproject.toml           # Package definition
└── requirements.txt          # Python dependencies

🔌 Using as a Plugin

Hermes Agent

# In ~/.hermes/config.yaml
skills:
  - ai-news-agent

OpenClaw

{
  "plugins": [{
    "name": "ai-news-agent",
    "command": "python -m ai_news_agent.main"
  }]
}

Standalone

# Just run it — no agent needed
python -m ai_news_agent.main

🎨 Adding Custom Feeds

Edit config/feeds.json:

{
  "feeds": [
    {
      "name": "My Custom Feed",
      "url": "https://example.com/rss",
      "category": "Tech&Science",
      "tier": 2
    }
  ]
}

Categories: World News, Tech&Science, Business and investment, Cryptocurrency, A.I., Cybersecurity

Tier: 1 (wire services), 2 (established outlets), 3 (everything else)

🤝 Contributing

Contributions are welcome! Please:

  1. Fork the repo
  2. Create a feature branch (git checkout -b feature/my-feature)
  3. Commit your changes (git commit -m 'Add my feature')
  4. Push to the branch (git push origin feature/my-feature)
  5. Open a Pull Request

📄 License

MIT License — Copyright © 2026 AI Consy

Free to use, modify, and distribute. The only requirement: include the original copyright notice (attribution to "AI Consy") in any copy or substantial portion of the Software.

See LICENSE for the full text.


Brought to you by AI Consy — built with ❤️ and too many RSS feeds

## Built with - Python 3.10+, Hermes Agent fleet automation on the AI Consy mesh

来源:GitHub · github.com