闲社服务运行正常AI智能体自动化平台
c

中国新闻聚合

技能标识:china-news

中国新闻资讯聚合工具。Use when user wants to get latest news from Chinese sources. Supports multiple news sites (Sina, Sohu, NetEase, Tencent) via browser automation and RSS. Generates categorized news reports. 新闻资讯、热点新闻、每日新闻。

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.0.3
检测标记
后台标记通过
免费
免费获取
1
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

中国新闻聚合

China News

中国新闻资讯聚合工具,通过浏览器自动化和RSS订阅获取各大新闻网站内容,生成分类新闻报告。

功能特性

  • - 📰 多源聚合: 新浪、搜狐、网易、腾讯等主流媒体
  • 📂 智能分类: 时事、财经、科技、体育、娱乐
  • 🔄 双模式: 浏览器自动化 + RSS订阅
  • 🎨 精美排版: 专业新闻报告格式
  • ⚡ 实时更新: 获取最新新闻
  • 🌍 多语言: 中英文输出

触发条件

  • - 给我今天的新闻 / Todays news
  • 有什么热点新闻 / Whats trending
  • 看看科技新闻 / Tech news
  • 财经新闻 / Financial news
  • china-news

新闻来源

浏览器自动化模式

来源网址内容
新浪新闻news.sina.com.cn综合新闻
搜狐新闻
news.sohu.com | 深度报道 | | 网易新闻 | news.163.com | 热点新闻 | | 腾讯新闻 | news.qq.com | 快讯 |

RSS订阅模式

来源RSS地址内容
新浪新闻rss.sina.com.cn综合
搜狐新闻
rss.sohu.com | 综合 | | 凤凰新闻 | rss.ifeng.com | 时政 |

前置条件

OpenClaw版本要求

  • - OpenClaw v2026.3.22+ (浏览器自动化)

浏览器配置

  • - 配置好browser工具
  • 无需登录(新闻网站通常无需登录)

第一步:获取新闻(自动降级策略)

模式选择逻辑

检测浏览器是否可用
↓
可用 → 浏览器模式(更丰富)
↓
不可用 → 自动降级到RSS模式(默认)

代码实现

python
def checkbrowseravailable():
检测浏览器是否可用
try:
# 尝试调用浏览器
# 如果OpenClaw配置了browser工具且浏览器可用
return True
except:
return False

def getnewssources():
根据环境自动选择获取方式

if checkbrowseravailable():
# 浏览器模式:获取更丰富的新闻
print(🌐 使用浏览器模式)
return {
mode: browser,
sources: [
{name: 新浪新闻, url: https://news.sina.com.cn},
{name: 搜狐新闻, url: https://news.sohu.com},
{name: 网易新闻, url: https://news.163.com},
]
}
else:
# RSS模式(默认):轻量快速,无需浏览器
print(📡 浏览器不可用,使用RSS模式)
return {
mode: rss,
sources: [
{name: 36氪, url: https://36kr.com/feed},
{name: 搜狐新闻, url: https://news.sohu.com/rss/},
]
}

降级说明

环境模式新闻来源数据丰富度
有浏览器浏览器模式新浪/搜狐/网易⭐⭐⭐⭐⭐
无浏览器
RSS模式(默认) | 36氪/搜狐 | ⭐⭐⭐ |

RSS模式完全可用,无需浏览器即可获取新闻

浏览器模式(更丰富)

javascript
// 打开新闻网站
await browser.open({
url: https://news.sina.com.cn
})

// 等待加载
await browser.wait({ timeout: 5000 })

// 提取新闻标题和链接
const news = await browser.evaluate(() => {
const items = []

// 提取各类新闻区块
document.querySelectorAll(a).forEach(el => {
const text = el.innerText?.trim()
if (text && text.length > 10 && text.length < 100) {
// 过滤掉导航、广告等
if (!text.includes(登录) && !text.includes(注册) &&
!el.href.includes(javascript:) && el.href.startsWith(http)) {
items.push({
title: text,
url: el.href,
source: 新浪
})
}
}
})

return items.slice(0, 20)
})

RSS模式(轻量快速)

python
import requests
import xml.etree.ElementTree as ET

def fetchrss(url, sourcename):
获取RSS订阅内容
try:
response = requests.get(url, timeout=10, headers={
User-Agent: Mozilla/5.0
})

root = ET.fromstring(response.content)
items = []

for item in root.findall(.//item):
title = item.find(title)
link = item.find(link)

if title is not None and title.text:
items.append({
title: title.text.strip(),
url: link.text if link is not None else ,
source: source_name
})

return items[:15]
except:
return []



第二步:新闻分类

python
def categorizenews(newslist):
智能分类新闻

categories = {
时事: [政治, 国际, 外交, 政策, 政府, 两会, 选举],
财经: [股市, 基金, 经济, 金融, 投资, 银行, 房产],
科技: [AI, 人工智能, 芯片, 手机, 互联网, 新能源],
体育: [足球, 篮球, 奥运, 世界杯, NBA, 中超],
娱乐: [明星, 电影, 音乐, 综艺, 八卦, 热播],
社会: [事故, 案件, 民生, 教育, 医疗, 疫情]
}

categorized = {cat: [] for cat in categories}
categorized[其他] = []

for news in news_list:
matched = False
for category, keywords in categories.items():
if any(kw in news[title] for kw in keywords):
categorized[category].append(news)
matched = True
break
if not matched:
categorized[其他].append(news)

# 移除空分类
return {k: v for k, v in categorized.items() if v}



第三步:生成报告

python
def generatenewsreport(categorizednews, datestr):
生成精美新闻报告

output = []
output.append(f┌{─*50}┐)
output.append(f│ 📰 每日新闻速递)
output.append(f│ {date_str})
output.append(f└{─*50}┘)
output.append()

# 热点速递(取每个分类的第一条)
output.append(🔥 热点速递)
output.append(─ * 40)
for category, newslist in categorizednews.items():
if news_list and category != 其他:
topnews = newslist[0]
output.append(f【{category}】{top_news[title]})
output.append()

# 分类详情
for category, newslist in categorizednews.items():
if news_list:
output.append(f📌 {category}新闻)
output.append(─ * 40)
for i, news in enumerate(news_list[:5], 1):
output.append(f{i}. {news[title]})
if news.get(source):
output.append(f 来源:{news[source]})
output.append()

return \n.join(output)



第四步:完整流程

bash
python3 << PYEOF
import os
import requests
import xml.etree.ElementTree as ET
from datetime import datetime

class ChinaNews:
def init(self):
self.rss_sources = {
新浪国内: https://rss.sina.com.cn/news/china/roll.xml,
新浪国际: https://rss.sina.com.cn/news/world/roll.xml,
新浪财经: https://rss.sina.com.cn/finance/roll.xml,
新浪科技: https://rss.sina.com.cn/tech/roll.xml,
搜狐新闻: https://news.sohu.com/rss/
}

self.keywords = {
时事: [政治, 国际, 外交, 政策, 政府, 两会, 外交],
财经: [股市, 基金, 经济, 金融, 投资, 银行, 房产, A股],
科技:

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 china-news-1776027182 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 china-news-1776027182 技能

通过命令行安装

skillhub install china-news-1776027182

下载

⬇ 下载 china-news v1.0.3(免费)

文件大小: 5.55 KB | 发布时间: 2026-4-13 09:42

v1.0.3 最新 2026-4-13 09:42
修复依赖声明:移除未使用的curl,添加requests依赖
返回顶部