分享个天气查询 api

56 天前
 TRY33

访问地址: https://weather.sl.al/

查询参数: https://weather.sl.al/?lat=29.881583&lon=121.568458&lang=en

lat:纬度

lon:经度

lang:语言

(默认不带 lang 的话为中文)

结果参考:


{
  "lat": "29.881583",
  "lon": "121.568458",
  "alert": "台风黄色预警",
  "location": {
    "city": "鄞州区",
    "region": "浙江省"
  },
  "current": {
    "temperature": 20,
    "feelsLike": 20,
    "description": "中雨",
    "airQuality": {
      "category": "一般",
      "statement": "空气质量对大多数人来说是可接受的。然而,敏感人群长期暴露可能会出现轻微或中度症状。"
    }
  },
  "sun": {
    "duration": "11 hrs 01 mins",
    "sunrise": "AM6:07",
    "sunset": "PM5:08"
  },
  "hourly": [
    {
      "time": "下午 9 时",
      "temperature": 21,
      "rainProbability": "60%"
    },
    {
      "time": "下午 10 时",
      "temperature": 21,
      "rainProbability": "60%"
    },
    {
      "time": "下午 11 时",
      "temperature": 21,
      "rainProbability": "60%"
    },
    {
      "time": "上午 12 时",
      "temperature": 21,
      "rainProbability": "49%"
    },
    {
      "time": "上午 1 时",
      "temperature": 21,
      "rainProbability": "20%"
    },
    {
      "time": "上午 2 时",
      "temperature": 21,
      "rainProbability": "20%"
    },
    {
      "time": "上午 3 时",
      "temperature": 21,
      "rainProbability": "20%"
    },
    {
      "time": "上午 4 时",
      "temperature": 22,
      "rainProbability": "20%"
    },
    {
      "time": "上午 5 时",
      "temperature": 22,
      "rainProbability": "20%"
    },
    {
      "time": "上午 6 时",
      "temperature": 21,
      "rainProbability": "25%"
    },
    {
      "time": "上午 7 时",
      "temperature": 21,
      "rainProbability": "49%"
    },
    {
      "time": "上午 8 时",
      "temperature": 21,
      "rainProbability": "60%"
    }
  ],
  "daily": [
    {
      "date": "2024-10-31",
      "high": 20,
      "dayDescription": "晚上有间歇性降雨,有时有大雨;多云",
      "rainProbability": "82%"
    },
    {
      "date": "2024-11-01",
      "high": 23,
      "low": 18,
      "dayDescription": "上午有间歇性降雨,有时有大雨;多云,暖和潮湿",
      "nightDescription": "晚上有间歇性降雨;多云,大风",
      "rainProbability": "82%"
    },
    {
      "date": "2024-11-02",
      "high": 22,
      "low": 14,
      "dayDescription": "上午有零星降雨和毛毛雨;大部分多云,有风",
      "nightDescription": "部分多云",
      "rainProbability": "55%"
    },
    {
      "date": "2024-11-03",
      "high": 22,
      "low": 14,
      "dayDescription": "部分晴,天气宜人",
      "nightDescription": "部分多云",
      "rainProbability": "25%"
    },
    {
      "date": "2024-11-04",
      "high": 21,
      "low": 11,
      "dayDescription": "大部分多云,有风",
      "nightDescription": "多云,有风",
      "rainProbability": "25%"
    },
    {
      "date": "2024-11-05",
      "high": 17,
      "low": 10,
      "dayDescription": "大部分多云,有风",
      "nightDescription": "部分多云,凉爽",
      "rainProbability": "25%"
    },
    {
      "date": "2024-11-06",
      "high": 16,
      "low": 10,
      "dayDescription": "大部分多云",
      "nightDescription": "大部分多云",
      "rainProbability": "25%"
    },
    {
      "date": "2024-11-07",
      "high": 20,
      "low": 11,
      "dayDescription": "多云",
      "nightDescription": "多云",
      "rainProbability": "25%"
    },
    {
      "date": "2024-11-08",
      "high": 20,
      "low": 14,
      "dayDescription": "多云",
      "nightDescription": "晚上有零星降雨和毛毛雨;多云",
      "rainProbability": "25%"
    },
    {
      "date": "2024-11-09",
      "high": 19,
      "low": 15,
      "dayDescription": "多云,下午有零星降雨和毛毛雨",
      "nightDescription": "晚上有零星降雨和毛毛雨;多云",
      "rainProbability": "55%"
    }
  ]
}
1633 次点击
所在节点    分享创造
5 条回复
Aboceder
55 天前
不错不错
RangerWolf
54 天前
如何把城市名称转换成经纬度呢?
TRY33
54 天前
@RangerWolf 你可以选择高德百度等服务。也可以自己爬数据后自己进行转换
feisualio
54 天前
感谢分享!
Aboceder
52 天前
@RangerWolf 用和风天气,有免费的 api ,城市名查询经纬度,挺全的

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1085476

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX