Install
openclaw skills install newsscraperThis skill should be used when users need to scrape hot news topics from Chinese platforms (微博、知乎、B站、抖音、今日头条、腾讯新闻、澎湃新闻), generate summaries, and cite sources. It supports both API-based and direct scraping methods, and offers both extractive and abstractive summarization techniques.
openclaw skills install newsscraper自动爬取国内热点新闻信息,支持多种平台(微博、知乎、B站、抖音、今日头条、腾讯新闻、澎湃新闻),能够生成新闻摘要并注明出处。提供 API 和直接爬取两种数据获取方式,以及提取式和生成式两种摘要生成方案。
根据用户输入的主题或关键词,从支持的平台获取热点新闻数据。支持两种方式:
对获取的新闻内容进行智能摘要,支持两种技术方案:
google/mt5-small-chinese),生成更自然的摘要为每条新闻清晰标注:
当用户需要:
根据用户需求和实际情况选择:
参考 references/platforms.md 了解各平台的爬取策略和注意事项。
使用 scripts/news_scraper.py 脚本进行数据爬取:
# 使用 API 方式获取多平台热点
python scripts/news_scraper.py --mode api --platforms weibo,zhihu --limit 20
# 直接爬取特定平台
python scripts/news_scraper.py --mode scrape --platform weibo --limit 10
# 根据主题爬取新闻
python scripts/news_scraper.py --mode scrape --keyword "人工智能" --platforms weibo,zhihu --limit 15
使用 scripts/news_summarizer.py 脚本生成摘要:
# 提取式摘要(快速)
python scripts/news_summarizer.py --method extractive --input news_data.json --output summary.json
# 生成式摘要(质量更好)
python scripts/news_summarizer.py --method abstractive --input news_data.json --output summary.json
参考 references/summarization_methods.md 了解不同摘要方法的原理和适用场景。
将结果整理成结构化的格式(JSON/Markdown),包含:
google/mt5-small-chinese)A: 对于快速获取多平台热点,优先使用 API(如全网热榜聚合 API),它们通常已经处理了反爬虫问题。如果需要更详细的内容或特定平台的数据,再使用直接爬取。
A: 提取式摘要速度快,但可能不够连贯;生成式摘要质量更高,但需要更长时间。根据使用场景选择:
A: 参考 references/platforms.md 中的反爬虫处理建议,包括:
未来可以考虑添加:
pip install requests beautifulsoup4
pip install jieba
pip install transformers torch
注意: ClawHub 不会自动安装依赖,用户需要根据上述说明手动安装所需的 Python 包。