mcpField
A
ai-news-digest

ai-news-digest

github.com/konatatech生产力170 次安装37 周前更新
代码仓库

关于 ai-news-digest

ai-news-digest 汇总中英文 RSS 来源的 AI 新闻,去除相似文章并排序。它可生成 Markdown 摘要,也可通过邮件发送或保存到 Obsidian。

主要功能

  1. 01汇总多个 RSS 新闻源
  2. 02去除相似文章
  3. 03按时效和重要性排序
  4. 04生成 Markdown 和 HTML 摘要
  5. 05邮件发送并保存到 Obsidian
  6. 06选择小时、每日或每周范围

适用场景

  1. 01制作每日 AI 新闻摘要
  2. 02追踪近几小时的突发新闻
  3. 03生成每周 AI 新闻总结
  4. 04将摘要保存到 Obsidian

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/konatatech/ai-news-digest-skill --skill ai-news-digest

安装后在 Claude Code 中输入/ai-news-digest确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

requirements.txt
assets/
example_asset.txt
config/
output.json
sources.json
references/
advanced_usage.md
api_reference.md
scripts/
ai_helper.py
enhance_content.py
example.py
fetch_news.py
generate_digest.py
process_news.py
test_components.py
test_digest.py

详细介绍

AI 新闻摘要技能

概述

此技能会自动从 8 个以上的权威来源(包括英文和中文来源)聚合 AI 新闻,智能去重文章,按重要性排序,并通过电子邮件发送带有 Markdown 附件的格式化摘要。

主要功能:

  • 🌐 多来源聚合(基于 RSS,不存在抓取问题)
  • 🧹 智能去重(相似度检测)
  • 📊 智能排序(热度分数、时效性、重要性)
  • 📧 通过电子邮件发送,附带 HTML 内容和 Markdown 附件
  • 📝 自动保存到 Obsidian 知识库
  • ⏰ 灵活的时间范围(每小时、每天、每周)

快速开始

生成并通过电子邮件发送今日摘要
cd /data/workspace/TsunagiConfig/skills/ai-news-digest
python scripts/generate_digest.py

此操作将:

  1. 获取过去 24 小时的新闻
  2. 对文章去重并排序
  3. 生成 HTML 邮件和 Markdown 文件
  4. 发送到你配置的电子邮箱
  5. 保存到 Obsidian(如果已配置)
获取过去 6 小时的突发新闻
python scripts/generate_digest.py --hours 6
每周摘要(过去 7 天)
python scripts/generate_digest.py --days 7

新闻来源

来源类型RSS Feed语言
Hacker News科技新闻https://hn.algolia.com/api/v1/search_by_date?tags=story&query=AIEN
TechCrunch AI行业https://techcrunch.com/category/artificial-intelligence/feed/EN
The Verge AI消费科技https://www.theverge.com/ai-artificial-intelligence/rss/index.xmlEN
OpenAI Blog官方https://openai.com/blog/rss.xmlEN
机器之心研究https://www.jiqizhixin.com/rssCN
量子位行业https://www.qbitai.com/feedCN
AI科技评论学术(自定义 RSS)CN
36氪AI商业(自定义 RSS)CN

所有来源均使用 RSS Feed,以确保稳定性(避免网页抓取导致的 SSL 问题)。

使用示例

1. 手动生成一次摘要
# Default: last 24 hours, send email, save to Obsidian
python scripts/generate_digest.py

# Last 12 hours, no email
python scripts/generate_digest.py --hours 12 --no-email

# Last 3 days, custom output path
python scripts/generate_digest.py --days 3 --output ~/Desktop/ai_digest.md
2. 定时生成每日摘要(Cron)
# Add to crontab: Daily at 8 AM
0 8 * * * cd /data/workspace/TsunagiConfig/skills/ai-news-digest && python scripts/generate_digest.py --hours 24
3. 作为 Python 模块使用
from scripts.fetch_news import fetch_all_news
from scripts.process_news import deduplicate_and_rank

# Fetch news from last 48 hours
articles = fetch_all_news(hours=48)
print(f"Fetched {len(articles)} articles")

# Process and rank
top_articles = deduplicate_and_rank(articles, top_n=15)

# Generate Markdown
from scripts.generate_digest import format_markdown
markdown = format_markdown(top_articles)
print(markdown)
4. 仅发送电子邮件(不输出文件)
from scripts.generate_digest import send_digest_email

articles = [...]  # Your processed articles
send_digest_email(
    articles=articles,
    recipient="[email protected]",
    subject="AI News Digest - 2024-01-15"
)

配置

电子邮件设置(可选)

如果要添加电子邮件发送功能,请编辑 config/email.json:

{
  "smtp_host": "smtp.example.com",
  "smtp_port": 587,
  "sender": "[email protected]",
  "auth_code": "your-smtp-auth-code",
  "recipient": "[email protected]"
}

注意: 电子邮件功能为可选项。即使不配置,该技能也能正常运行,仅生成 Markdown 报告。

新闻来源

编辑 config/sources.json 以添加或移除来源:

{
  "sources": [
    {
      "name": "Hacker News",
      "url": "https://hn.algolia.com/api/v1/search_by_date?tags=story&query=AI",
      "type": "api",
      "language": "en",
      "enabled": true
    },
    {
      "name": "机器之心",
      "url": "https://www.jiqizhixin.com/rss",
      "type": "rss",
      "language": "zh",
      "enabled": true
    }
  ]
}
Obsidian 集成

编辑 config/obsidian.json:

{
  "vault_path": "/data/workspace/obsidian/Daily Notes",
  "enabled": true,
  "filename_format": "AI Digest - {date}.md"
}

输出格式

Markdown 结构
# AI News Digest - 2024-01-15

**Time Range:** Last 24 hours  
**Total Articles:** 38 → 15 after deduplication  
**Generated:** 2024-01-15 08:00:00

---

## 🔥 Top Stories (Score ≥ 8.0)

### 1. OpenAI Announces GPT-5 with Multimodal Reasoning
- **Source:** OpenAI Blog | **Published:** 2 hours ago
- **Score:** 9.2/10 | **Category:** Product Launch
- **Summary:** OpenAI unveiled GPT-5, featuring advanced multimodal reasoning capabilities across text, images, and audio. The model shows significant improvements in complex problem-solving tasks.
- **Link:** [Read More](https://openai.com/blog/gpt-5-announcement)

---

## 📊 Industry News (Score 6.0-7.9)

### 2. Google DeepMind's AlphaFold 3 Predicts Protein Structures
...

---

## 🌏 Chinese AI Updates

### 8. 字节跳动发布新一代大模型"豆包Pro"
- **来源:** 量子位 | **发布:** 5小时前
...

---

## 📈 Statistics
- Total sources checked: 8
- Articles fetched: 38
- After deduplication: 15
- English articles: 10
- Chinese articles: 5
电子邮件 HTML 格式
  • 简洁、响应式的 HTML 设计
  • 可点击的标题
  • 分类徽章(🔥 热门、📊 行业、🌏 中文)
  • 附加的 Markdown 文件,格式为 .md

命令行选项

python scripts/generate_digest.py [OPTIONS]

Options:
  --hours N          Time range in hours (default: 24)
  --days N           Time range in days (overrides --hours)
  --output PATH      Output Markdown file path
  --send-email       Send via email (default: true)
  --no-email         Skip email sending
  --save-obsidian    Save to Obsidian (default: true if configured)
  --top-n N          Number of top articles to include (default: 15)
  --min-score FLOAT  Minimum score threshold (default: 5.0)
  --debug            Enable debug logging

常见任务

测试新闻获取
python scripts/test_digest.py

输出:

✓ Fetched 16 articles from Hacker News
✓ Fetched 22 articles from 机器之心
✓ Total: 38 articles
✓ After deduplication: 15 articles
调试 RSS Feed 问题
from scripts.fetch_news import test_single_source

# Test a specific source
test_single_source("https://www.jiqizhixin.com/rss")
自定义评分算法

编辑 scripts/process_news.py:

def calculate_score(article):
    score = 0.0
    
    # Recency (0-3 points)
    hours_ago = (datetime.now() - article['published']).total_seconds() / 3600
    if hours_ago < 6:
        score += 3.0
    elif hours_ago < 24:
        score += 2.0
    else:
        score += 1.0
    
    # Keyword boost (0-4 points)
    hot_keywords = ['GPT', 'OpenAI', 'breakthrough', 'AGI']
    for keyword in hot_keywords:
        if keyword.lower() in article['title'].lower():
            score += 1.0
    
    # Source authority (0-3 points)
    authority_map = {
        'OpenAI Blog': 3.0,
        'Hacker News': 2.5,
        '机器之心': 2.5
    }
    score += authority_map.get(article['source'], 1.0)
    
    return min(score, 10.0)

故障排除

问题:未获取到文章
# Check internet connectivity
curl -I https://www.jiqizhixin.com/rss

# Test RSS parsing
python -c "import feedparser; print(feedparser.parse('https://www.jiqizhixin.com/rss'))"
问题:电子邮件未发送
# Test email config
node /data/workspace/send_report_email.js

# Check SMTP credentials in config/email.json
问题:重复文章过多

调整 scripts/process_news.py 中的相似度阈值:

SIMILARITY_THRESHOLD = 0.75  # Lower = stricter deduplication (default: 0.8)

快速参考

任务命令时间
每日摘要python scripts/generate_digest.py~10s
突发新闻(6 小时)python scripts/generate_digest.py --hours 6~8s
每周摘要python scripts/generate_digest.py --days 7~15s
测试获取python scripts/test_digest.py~5s
仅发送电子邮件python scripts/generate_digest.py --no-obsidian~10s

安装

使用此技能前,请安装所需依赖:

pip install -r requirements.txt

这将安装:

  • feedparser - RSS Feed 解析
  • beautifulsoup4 - HTML 内容提取
  • requests - HTTP 请求
  • python-dateutil - 日期和时间处理
  • numpy - 相似度计算

系统要求:

  • Python 3.8+
  • 互联网连接
  • 可选:Node.js 14+(通过 nodemailer 发送电子邮件)

后续步骤

  • API 参考和数据结构请参阅 references/api_reference.md
  • 高级自定义请参阅 references/advanced_usage.md
  • 要添加新的新闻来源,请编辑 config/sources.json
  • 要与其他工具集成,请使用 Python 模块 API

许可证

MIT 许可证 - 可免费使用和修改

评论

支持 Markdown