首页龙虾技能列表 › Weather In China — 中国城市天气

🌤️ Weather In China — 中国城市天气

v0.1.3

零配置中文天气查询:直接抓取中国天气网,无需 API 密钥,不消耗 Token,支持全国城市实时天气与预报。

4· 695·6 当前·6 累计
by @kenera·MIT-0
下载技能包
License
MIT-0
最后更新
2026/2/26
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
high confidence
This skill's code, instructions, and requirements are consistent with a simple China-weather scraper that fetches pages from weather.com.cn and parses them locally; it does not ask for secrets or perform unexpected actions.
评估建议
This skill appears coherent and straightforward: it reads a local city-code file and fetches/parses HTML from https://www.weather.com.cn using Python + requests. Before installing, ensure you are comfortable granting the skill network access to that site and that you have (or will install) the 'requests' package. Review the included weather-cn.py (it's short and readable) if you want to confirm there are no unexpected network endpoints or data-collection steps. Be aware the script uses regex-bas...
详细分析 ▾
用途与能力
名称/描述(通过 weather.com.cn 查询中文天气)与所含文件及运行需求一致:Python 脚本读取本地城市代码映射并抓取/解析 HTML。请求的 python 二进制与 pip 依赖 requests 均合理且适度。
指令范围
SKILL.md 指令仅涉及运行所含脚本、编辑本地城市代码文件及可选添加 shell 别名。未请求无关文件、凭证,也未向意外端点传输数据(仅访问 weather.com.cn 及可选公开备用地址)。
安装机制
未提供安装规范(仅指令),代码随技能打包。唯一运行时依赖为广泛使用的 requests 包(元数据中声明),无任意 URL 下载或解压操作。
凭证需求
技能未请求环境变量、凭证或除自身文件外的配置路径,符合简单网页抓取工具的预期。
持久化与权限
技能未请求 always:true,也未修改其他技能。建议用户可选地将别名添加至 shell rc(~/.zshrc 或 ~/.bash_profile);此操作由用户主动完成且非必需,但需注意其对 shell 配置的更改。
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv0.1.32026/2/25

- 转为 Python 实现(weather-cn.py),提升解析准确率与稳定性 - 新增 requirements:需 Python 与 requests 库 - 新增/更新城市代码映射表(weather_codes.txt),更易扩展新城市 - 更新文档说明,反映 Python 版用法与优势 - 继续无需API密钥,不依赖大模型,零Token消耗

● 无害

安装命令 点击复制

官方npx clawhub@latest install weather-zh
镜像加速npx clawhub@latest install weather-zh --registry https://cn.clawhub-mirror.com

技能文档

# 中文天气查询 (Weather in Chinese) 使用纯脚本方案查询中国天气网,完全不依赖大模型,稳定可靠。 ## 🎯 核心方案:weather-cn.py 脚本 ### 使用方法 ``bash python weather-cn.py 城市名 ` ### 示例 `bash # 查询成都天气 python weather-cn.py 成都 # 查询北京天气 python weather-cn.py 北京 # 查询上海天气 python weather-cn.py 上海 ` ### 输出格式 ` ═════════════════════════════════════════════════ 成都天气 ═════════════════════════════════════════════════ 📍 今日天气(2026-02-25) ☀️ 晴 | 温度:15/3℃ 📊 生活指数 🤧 感冒:较适宜 🏃 运动:较适宜 👔 穿衣:较冷 🚗 洗车:适宜 ☀️ 紫外线:强 ═════════════════════════════════════════════════ ` --- ## 📁 文件说明 ### 1. weather-cn.py 主脚本文件,负责: - 查找城市代码 - 获取天气数据 - 解析HTML内容 - 格式化输出 ### 2. weather_codes.txt 城市代码映射表,格式: ` 城市名,代码 成都,101270101 北京,101010100 ... ` --- ## 🏙️ 支持的城市 ### 预置城市(50+) | 地区 | 城市 | |------|------| | 直辖市 | 北京、上海、天津、重庆 | | 华东 | 杭州、南京、苏州、宁波、温州、厦门、福州、济南、青岛 | | 华南 | 广州、深圳、东莞、佛山、珠海、南宁、海口、三亚 | | 华中 | 武汉、长沙、南昌 | | 西南 | 成都、贵阳、昆明、拉萨 | | 西北 | 西安、兰州、银川、西宁、乌鲁木齐 | | 东北 | 哈尔滨、长春、沈阳、大连 | | 华北 | 太原、呼和浩特、石家庄 | ### 添加新城市 编辑 weather_codes.txt,添加城市代码: ` 城市名,101xxxxxx ` 获取城市代码:访问 https://www.weather.com.cn/ 搜索城市,查看URL中的代码。 --- ## 🔧 工作原理 ### 流程图 ` 用户输入 "成都" ↓ 查找城市代码 101270101 ↓ requests 获取HTML ↓ 正则表达式解析 ↓ 格式化输出 ` ### 核心优势 ✅ 零大模型依赖 - 完全使用Python正则表达式 ✅ 极速响应 - <1秒完成查询 ✅ 稳定可靠 - 不依赖外部API ✅ 原生中文 - 直接解析中国天气网 ✅ Token节省 - 除了初始设置,每次查询零Token消耗 ✅ 准确解析 - 使用精确的HTML结构匹配 --- ## 📊 Token消耗对比 | 方案 | 每次查询Token | 稳定性 | 准确性 | |------|-------------|--------|--------| | weather-cn.py | 0 🎉 | 100% ✅ | 100% ✅ | | web_fetch + 大模型 | ~4000 | 100% | ~80% | | wttr.in + 大模型 | ~4500 | ~50% | ~60% | --- ## 🚀 快速开始 ### 1. 使用脚本(推荐) `bash # 查询天气 ~/.openclaw/workspace/skills/weather-zh/weather-cn.py 成都 ` ### 2. 创建快捷命令(可选) `bash # 添加到 ~/.zshrc 或 ~/.bash_profile alias weather='~/.openclaw/workspace/skills/weather-zh/weather-cn.py' # 使用 weather 成都 ` --- ## 🛠️ 备用方案 如果中国天气网不可用,可使用以下备用方案: ### 方案1:web_fetch(需要大模型解析) `bash web_fetch "https://www.weather.com.cn/weather/101010100.shtml" ` ### 方案2:Open-Meteo API `bash curl -s "https://api.open-meteo.com/v1/forecast?latitude=39.9042&longitude=116.4074¤t_weather=true&daily=temperature_2m_max,temperature_2m_min,weathercode&timezone=Asia%2FShanghai" ` ### 方案3:wttr.in `bash curl -s "wttr.in/Beijing?T" `` --- ## 📝 使用场景 当用户询问以下问题时使用本skill: - "今天天气怎么样" - "明天天气如何" - "[城市名]天气" - "会不会下雨" - "气温多少" - "天气查询" --- ## ⚠️ 注意事项 1. 天气数据延迟:中国天气网数据可能略有延迟 2. 城市名称:使用标准城市名,如"成都"、"上海"而非"川" 3. 网络依赖:需要能够访问 www.weather.com.cn 4. 生活指数:指数为通用建议,仅供参考 --- ## 🎉 总结 weather-cn.py 是一个轻量、快速、零依赖的天气查询工具: - ✅ 完全不依赖大模型 - ✅ <1秒响应时间 - ✅ 50+ 预置城市 - ✅ 彩色格式化输出 - ✅ Token消耗:0(每次查询) - ✅ 准确的HTML结构解析 适合高频调用、自动化任务等场景。

数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务