| name | weather |
| description | Get current weather using free APIs (no API key required) |
| homepage | https://wttr.in/:help |
Weather
查询天气信息,使用免费 API(无需 API key)。
wttr.in (推荐)
使用 http_request 工具获取天气数据:
中文城市示例:
{
"method": "GET",
"url": "https://wttr.in/东莞?format=j1&lang=zh_cn"
}
英文城市示例:
{
"method": "GET",
"url": "https://wttr.in/London?format=j1"
}
返回 JSON 格式,包含当前天气、温度、湿度、风速等信息。
格式选项:
?format=j1 - JSON 格式(推荐用于解析)
?format=3 - 单行文本: "City: ⛅️ +8°C"
?lang=zh_cn - 中文描述
提示:
- 中文城市名直接使用:
北京, 上海, 东莞, 广州
- 英文城市空格用
+ 或 %20: New+York
- 机场代码:
JFK, LAX, PEK
Open-Meteo (备用)
使用坐标查询:
{
"method": "GET",
"url": "https://api.open-meteo.com/v1/forecast?latitude=23.02&longitude=113.75¤t_weather=true"
}
使用步骤
- 使用
http_request 工具调用上述 URL
- 解析 JSON 响应
- 提取相关天气信息
- 以用户友好的格式呈现
响应示例 (wttr.in)
{
"current_condition": [{
"temp_C": "25",
"weatherDesc": [{"value": "晴天"}],
"humidity": "70",
"windspeedKmph": "10"
}]
}