关于 weather
通过 wttr.in 查询天气,并以 Open-Meteo 的 JSON 接口作为备用,适用于快速查看预报或编程获取天气数据;两者均无需 API 密钥。
主要功能
- 01查询当前天气和预报
- 02自定义 wttr.in 输出格式
- 03支持公制和美制单位
- 04获取 Open-Meteo JSON 天气数据
适用场景
- 01查看城市当前天气
- 02获取完整或仅当天的预报
- 03为脚本读取天气数据
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ netease-youdao/ lobsterai --skill weather安装后在 Claude Code 中输入/weather确认已加载。
详细介绍
天气
两个免费服务,无需 API 密钥。
wttr.in(主要)
快速单行命令:
curl -s "wttr.in/London?format=3"
# Output: London: ⛅️ +8°C
紧凑格式:
curl -s "wttr.in/London?format=%l:+%c+%t+%h+%w"
# Output: London: ⛅️ +8°C 71% ↙5km/h
完整预报:
curl -s "wttr.in/London?T"
格式代码:%c 天气状况 · %t 温度 · %h 湿度 · %w 风速 · %l 位置 · %m 月相
提示:
- 对空格进行 URL 编码:
wttr.in/New+York - 机场代码:
wttr.in/JFK - 单位:
?m(公制)?u(美制) - 仅今天:
?1· 仅当前:?0 - PNG:
curl -s "wttr.in/Berlin.png" -o /tmp/weather.png
Open-Meteo(备用,JSON)
免费,无需密钥,适合程序化使用:
curl -s "https://api.open-meteo.com/v1/forecast?latitude=51.5&longitude=-0.12¤t_weather=true"
查找城市的坐标,然后查询。返回包含温度、风速、天气代码的 JSON。
评论
支持 Markdown