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

🌤️ 中国城市天气Weather in China — 技能工具

v1.0.1

中国天气查询服务,提供实时天气信息和预报。

3· 1,793·22 当前·25 累计
by @kenera·MIT-0
下载技能包
License
MIT-0
最后更新
2026/4/11
安全扫描
VirusTotal
可疑
查看报告
OpenClaw
可疑
high confidence
该技能用于查询中国地区天气信息,代码和指令与其声明目的一致。
评估建议
此技能用于获取天气数据,需要网络连接访问天气API。...
详细分析 ▾
用途与能力
Name/description match the implementation: the skill is a bash script that fetches weather from weather.com.cn using curl/grep and a local city->code map. Required binaries (curl, grep) and files (weather_codes.txt) are appropriate and proportional.
指令范围
SKILL.md instructs running the bundled script, which fetches remote HTML and parses it locally. The script outputs key=value lines and then uses eval "$data" in format_output — evaluating untrusted content from the network (or a modified local file) can lead to arbitrary shell command execution. Parsing HTML with grep/sed is brittle and may produce unexpected strings that make eval dangerous. This is scope-consistent but contains an unsafe coding pattern.
安装机制
No install spec (instruction-only); there are no remote downloads or installs. That limits install-time risk. Shipping a script file is expected for this kind of skill.
凭证需求
The skill requests no environment variables or credentials. Network access to www.weather.com.cn is required and expected. No unrelated secrets or config paths are requested.
持久化与权限
always is false and the skill does not request persistent/system-wide changes or elevated privileges. It's user-invokable and behaves like a normal, ephemeral script.
安全有层次,运行前请审查代码。

License

MIT-0

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

运行时依赖

无特殊依赖

版本

latestv1.0.12026/2/13

- 更新使用示例中的脚本路径为用户主目录下的标准路径,提升通用性 - 其余内容保持不变,无代码或功能变动

● 可疑

安装命令 点击复制

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

技能文档

使用纯脚本方案查询中国天气网,完全不依赖大模型,稳定可靠。

🎯 核心方案:weather-cn.sh 脚本

使用方法

./weather-cn.sh 城市名

示例

# 查询成都天气
./weather-cn.sh 成都

# 查询北京天气 ./weather-cn.sh 北京

# 查询上海天气 ./weather-cn.sh 上海

输出格式

═════════════════════════════════════════════════
  成都天气
═════════════════════════════════════════════════

📍 今日天气(2026-02-11) ☀️ 晴 | 温度:15/3℃

📊 生活指数 🤧 感冒:极易发 🏃 运动:较适宜 👔 穿衣:较冷 🚗 洗车:适宜 ☀️ 紫外线:强

═════════════════════════════════════════════════


📁 文件说明

1. weather-cn.sh

主脚本文件,负责:
  • 查找城市代码
  • 获取天气数据
  • 解析HTML内容
  • 格式化输出

2. weather_codes.txt

城市代码映射表,格式:
城市名,代码
成都,101270101
北京,101010100
...

🏙️ 支持的城市

预置城市(50+)

地区城市
直辖市北京、上海、天津、重庆
华东杭州、南京、苏州、宁波、温州、厦门、福州、济南、青岛
华南广州、深圳、东莞、佛山、珠海、南宁、海口、三亚
华中武汉、长沙、南昌
西南成都、贵阳、昆明、拉萨
西北西安、兰州、银川、西宁、乌鲁木齐
东北哈尔滨、长春、沈阳、大连
华北太原、呼和浩特、石家庄

添加新城市

编辑 weather_codes.txt,添加城市代码:

城市名,101xxxxxx

获取城市代码:访问 https://www.weather.com.cn/ 搜索城市,查看URL中的代码。


🔧 工作原理

流程图

用户输入 "成都"
     ↓
查找城市代码 101270101
     ↓
curl 获取HTML
     ↓
grep/sed 解析
     ↓
格式化输出

核心优势

零大模型依赖 - 完全使用bash/grep/sed ✅ 极速响应 - <1秒完成查询 ✅ 稳定可靠 - 不依赖外部API ✅ 原生中文 - 直接解析中国天气网 ✅ Token节省 - 除了初始设置,每次查询零Token消耗


📊 Token消耗对比

方案每次查询Token稳定性
weather-cn.sh0 🎉100% ✅
web_fetch + 大模型~4000100%
wttr.in + 大模型~4500~50%

🚀 快速开始

1. 使用脚本(推荐)

# 查询天气
~/.openclaw/workspace/skills/weather-zh/weather-cn.sh 成都

2. 创建快捷命令(可选)

# 添加到 ~/.zshrc 或 ~/.bash_profile
alias weather='~/.openclaw/workspace/skills/weather-zh/weather-cn.sh'

# 使用 weather 成都


🛠️ 备用方案

如果中国天气网不可用,可使用以下备用方案:

方案1:web_fetch(需要大模型解析)

web_fetch "https://www.weather.com.cn/weather/101010100.shtml"

方案2:Open-Meteo API

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

curl -s "wttr.in/Beijing?T"

📝 使用场景

当用户询问以下问题时使用本skill:

  • "今天天气怎么样"
  • "明天天气如何"
  • "[城市名]天气"
  • "会不会下雨"
  • "气温多少"
  • "天气查询"

⚠️ 注意事项

  • 天气数据延迟:中国天气网数据可能略有延迟
  • 城市名称:使用标准城市名,如"成都"、"上海"而非"川"
  • 网络依赖:需要能够访问 www.weather.com.cn
  • 生活指数:指数为通用建议,仅供参考

🎉 总结

weather-cn.sh 是一个轻量、快速、零依赖的天气查询工具:

  • ✅ 完全不依赖大模型
  • ✅ <1秒响应时间
  • ✅ 50+ 预置城市
  • ✅ 彩色格式化输出
  • ✅ Token消耗:0(每次查询)

适合高频调用、自动化任务等场景。

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

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

了解定制服务