weather

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Weather

天气

Two free services, no API keys needed.
两款免费服务,无需API密钥。

wttr.in (primary)

wttr.in(首选服务)

Quick one-liner:
bash
curl -s "wttr.in/London?format=3"
快速单行命令:
bash
curl -s "wttr.in/London?format=3"

Output: London: ⛅️ +8°C

Output: London: ⛅️ +8°C


Compact format:

```bash
curl -s "wttr.in/London?format=%l:+%c+%t+%h+%w"

精简格式:

```bash
curl -s "wttr.in/London?format=%l:+%c+%t+%h+%w"

Output: London: ⛅️ +8°C 71% ↙5km/h

Output: London: ⛅️ +8°C 71% ↙5km/h


Full forecast:

```bash
curl -s "wttr.in/London?T"
Format codes:
%c
condition ·
%t
temp ·
%h
humidity ·
%w
wind ·
%l
location ·
%m
moon
Tips:
  • URL-encode spaces:
    wttr.in/New+York
  • Airport codes:
    wttr.in/JFK
  • Units:
    ?m
    (metric)
    ?u
    (USCS)
  • Today only:
    ?1
    · Current only:
    ?0
  • PNG:
    curl -s "wttr.in/Berlin.png" -o /tmp/weather.png

完整天气预报:

```bash
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 (fallback, JSON)

Open-Meteo(备用服务,返回JSON格式)

Free, no key, good for programmatic use:
bash
curl -s "https://api.open-meteo.com/v1/forecast?latitude=51.5&longitude=-0.12&current_weather=true"
Find coordinates for a city, then query. Returns JSON with temp, windspeed, weathercode.
免费、无需密钥,适合程序化调用:
bash
curl -s "https://api.open-meteo.com/v1/forecast?latitude=51.5&longitude=-0.12&current_weather=true"
先查询城市的经纬度,再发起请求。返回包含温度、风速、天气代码的JSON数据。