Loading...
Loading...
Compare original and translation side by side
pip install feedparser python-dateutilpip install feedparser python-dateutilhttps://feeds.reuters.com/Reuters/worldNewshttps://feeds.apnews.com/apnews/topnewshttp://feeds.bbci.co.uk/news/world/rss.xmlhttps://www.aljazeera.com/xml/rss/all.xmlhttps://www.theguardian.com/world/rsshttps://feeds.npr.org/1001/rss.xmlhttps://feeds.reuters.com/Reuters/worldNewshttps://feeds.apnews.com/apnews/topnewshttp://feeds.bbci.co.uk/news/world/rss.xmlhttps://www.aljazeera.com/xml/rss/all.xmlhttps://www.theguardian.com/world/rsshttps://feeds.npr.org/1001/rss.xmlhttps://news.google.com/rss/search?q=worldhttps://www.bing.com/news/search?q=world&format=RSShttps://hnrss.org/frontpagehttps://www.reddit.com/r/news/.rsshttps://news.google.com/rss/search?q=worldhttps://www.bing.com/news/search?q=world&format=RSShttps://hnrss.org/frontpagehttps://www.reddit.com/r/news/.rss// 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);
}
// Next step: add title-similarity clustering (same idea as Python section above)// 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部分一致)Use the News Aggregation skill.
Requirements:
1) Pull news from multiple predefined sources (news sites + aggregators).
2) Default to only the last 3 days unless user asks another time range.
3) Group similar headlines into one short topic.
4) Under each topic, list all main source links (not just one source).
5) If 3+ sources cover the same event, output one topic with all those links.
6) Keep summaries short and factual; avoid adding unsupported claims.使用新闻聚合技能。
要求:
1) 从多个预定义来源(新闻网站+聚合平台)获取新闻。
2) 默认仅获取过去3天的内容,除非用户指定其他时间范围。
3) 将相似标题归为一个简短主题。
4) 在每个主题下列出所有主要来源链接(而非仅一个来源)。
5) 若3个及以上来源报道同一事件,输出一个主题并附上所有相关链接。
6) 保持摘要简短且基于事实;避免添加无依据的主张。