name: 新闻聚合 description: 从多个来源聚合并去重最新新闻,生成简洁的主题摘要。
新闻聚合(多源,3天窗口)
从多个站点和聚合器收集最新新闻,将相似故事合并为简短主题,并在每个主题下列出所有主要来源链接。
使用时机
- 您希望从多个渠道获得一个简洁的简报。
- 您需要去重覆盖(同一故事来自多个站点)。
- 您希望来源透明(显示所有原始链接)。
- 您希望默认时间窗口为最近3天,除非另有指定。
所需工具 / API
- 基本RSS工作流无需API密钥。
- Python 3.10+
安装:
pip install feedparser python-dateutil
来源(新闻站点 + 聚合器)
使用混合来源列表以获得更好覆盖。
新闻站点(RSS)
- Reuters World:
https://feeds.reuters.com/Reuters/worldNews - AP Top News:
https://feeds.apnews.com/apnews/topnews - BBC World:
http://feeds.bbci.co.uk/news/world/rss.xml - Al Jazeera:
https://www.aljazeera.com/xml/rss/all.xml - The Guardian World:
https://www.theguardian.com/world/rss - NPR News:
https://feeds.npr.org/1001/rss.xml
聚合器(RSS/API)
- Google News(主题馈送):
https://news.google.com/rss/search?q=world - Bing News(RSS查询):
https://www.bing.com/news/search?q=world&format=RSS - Hacker News(科技):
https://hnrss.org/frontpage - Reddit News(社区信号):
https://www.reddit.com/r/news/.rss
技能
Node.js 快速获取 + 分组入门
// npm install rss-parser
const Parser = require('rss-parser');
const parser = new Parser();
const SOURCES = {
Reuters: 'https://feeds.reuters.com/Reuters/worldNews',
AP: 'https://feeds.apnews.com/apnews/topnews',
BBC: 'http://feeds.bbci.co.uk/news/world/rss.xml',
'Google News': 'https://news.google.com/rss/search?q=world'
};
async function fetchRecent(days = 3) {
const cutoff = Date.now() - days * 24 * 60 * 60 * 1000;
const all = [];
for (const [source, url] of Object.entries(SOURCES)) {
const feed = await parser.parseURL(url);
for (const item of feed.items || []) {
const ts = new Date(item.pubDate || item.isoDate || 0).getTime();
if (!ts || ts < cutoff) continue;
all.push({ source, title: item.title || '', link: item.link || '', ts });
}
}
return all.sort((a, b) => b.ts - a.ts);
}
// 下一步:添加标题相似性聚类(与上方Python部分相同思想)
代理提示
使用新闻聚合技能。
要求:
1) 从多个预定义来源(新闻站点 + 聚合器)拉取新闻。
2) 默认仅最近3天,除非用户要求其他时间范围。
3) 将相似标题分组为一个简短主题。
4) 在每个主题下,列出所有主要来源链接(不仅一个来源)。
5) 如果3个或更多来源覆盖同一事件,输出一个主题并包含所有链接。
6) 保持摘要简短和事实性;避免添加无支持的主张。
最佳实践
- 保持来源多样性(通讯社 + 出版商 + 聚合器)以减少偏见。
- 按独立来源数量对分组主题进行排名。
- 尽可能包含发布时间戳。
- 保持分组阈值保守,避免合并无关故事。
- 当用户请求时,允许自定义来源列表和时间窗口。
故障排除
- 空结果:某些馈送可能不可用;重试并轮换来源。
- 太多重复:增加相似性阈值(例如,0.35 -> 0.45)。
- 分组不足:降低阈值(例如,0.35 -> 0.28)。
- 速率限制:以小延迟顺序获取馈送。