V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
TRY33
V2EX  ›  分享创造

分享个天气查询 api

  •  
  •   TRY33 · 48 天前 via iPhone · 1625 次点击
    这是一个创建于 48 天前的主题,其中的信息可能已经有所发展或是发生改变。

    访问地址: 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%"
        }
      ]
    }
    
    5 条回复    2024-11-04 16:51:18 +08:00
    Aboceder
        1
    Aboceder  
       47 天前
    不错不错
    RangerWolf
        2
    RangerWolf  
       46 天前
    如何把城市名称转换成经纬度呢?
    TRY33
        3
    TRY33  
    OP
       46 天前 via iPhone
    @RangerWolf 你可以选择高德百度等服务。也可以自己爬数据后自己进行转换
    feisualio
        4
    feisualio  
       46 天前
    感谢分享!
    Aboceder
        5
    Aboceder  
       44 天前   ❤️ 1
    @RangerWolf 用和风天气,有免费的 api ,城市名查询经纬度,挺全的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1051 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 22:38 · PVG 06:38 · LAX 14:38 · JFK 17:38
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.