name: weather description: 获取当前天气和预报(无需API密钥)。 homepage: https://wttr.in/:help metadata: { “otto”: { “emoji”: “🌤️”, “requires”: { “bins”: [“curl”] } } }
天气
两项免费服务,无需API密钥。
wttr.in(主要)
快速单行命令:
curl -s "wttr.in/London?format=3"
# 输出:London: ⛅️ +8°C
紧凑格式:
curl -s "wttr.in/London?format=%l:+%c+%t+%h+%w"
# 输出: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,包含温度、风速、天气代码。