zoukankan      html  css  js  c++  java
  • hutool http+天气预报

    中国天气接口:http://www.weather.com.cn/data/sk/地址.html,只显示当天。

    sojson接口:http://t.weather.sojson.com/api/weather/city/地址,显示当天和未来4天。

    //String result = HttpUtil.get("http://www.weather.com.cn/data/sk/101110101.html");
    String result = HttpUtil.get("http://t.weather.sojson.com/api/weather/city/101090601");
    Console.log(result);

    输出:

    {
        "time": "2019-01-18 09:00:41",
        "cityInfo": {
            "city": "廊坊市",
            "cityId": "101090601",
            "parent": "河北",
            "updateTime": "08:53"
        },
        "date": "20190118",
        "message": "Success !",
        "status": 200,
        "data": {
            "shidu": "36%",
            "pm25": 137,
            "pm10": 214,
            "quality": "中度污染",
            "wendu": "-5",
            "ganmao": "儿童、老年人及心脏、呼吸系统疾病患者人群应减少长时间或高强度户外锻炼,一般人群适量减少户外运动",
            "yesterday": {
                "date": "17",
                "sunrise": "07:32",
                "high": "高温 5.0℃",
                "low": "低温 -9.0℃",
                "sunset": "17:14",
                "aqi": 67,
                "ymd": "2019-01-17",
                "week": "星期四",
                "fx": "西北风",
                "fl": "<3级",
                "type": "晴",
                "notice": "愿你拥有比阳光明媚的心情"
            },
            "forecast": [
                {
                    "date": "18",
                    "sunrise": "07:32",
                    "high": "高温 6.0℃",
                    "low": "低温 -6.0℃",
                    "sunset": "17:15",
                    "aqi": 193,
                    "ymd": "2019-01-18",
                    "week": "星期五",
                    "fx": "西南风",
                    "fl": "<3级",
                    "type": "多云",
                    "notice": "阴晴之间,谨防紫外线侵扰"
                },
                {
                    "date": "19",
                    "sunrise": "07:31",
                    "high": "高温 4.0℃",
                    "low": "低温 -6.0℃",
                    "sunset": "17:17",
                    "aqi": 88,
                    "ymd": "2019-01-19",
                    "week": "星期六",
                    "fx": "东北风",
                    "fl": "<3级",
                    "type": "多云",
                    "notice": "阴晴之间,谨防紫外线侵扰"
                },
                {
                    "date": "20",
                    "sunrise": "07:31",
                    "high": "高温 4.0℃",
                    "low": "低温 -8.0℃",
                    "sunset": "17:18",
                    "aqi": 41,
                    "ymd": "2019-01-20",
                    "week": "星期日",
                    "fx": "西北风",
                    "fl": "3-4级",
                    "type": "晴",
                    "notice": "愿你拥有比阳光明媚的心情"
                },
                {
                    "date": "21",
                    "sunrise": "07:30",
                    "high": "高温 7.0℃",
                    "low": "低温 -5.0℃",
                    "sunset": "17:19",
                    "aqi": 71,
                    "ymd": "2019-01-21",
                    "week": "星期一",
                    "fx": "西南风",
                    "fl": "<3级",
                    "type": "晴",
                    "notice": "愿你拥有比阳光明媚的心情"
                },
                {
                    "date": "22",
                    "sunrise": "07:30",
                    "high": "高温 9.0℃",
                    "low": "低温 -6.0℃",
                    "sunset": "17:20",
                    "aqi": 35,
                    "ymd": "2019-01-22",
                    "week": "星期二",
                    "fx": "西北风",
                    "fl": "<3级",
                    "type": "晴",
                    "notice": "愿你拥有比阳光明媚的心情"
                }
            ]
        }
    }
    //北京
    101010100    北京
    101010200    海淀
    101010300    朝阳
    101010400    顺义
    101010500    怀柔
    101010600    通州
    101010700    昌平
    101010800    延庆
    101010900    丰台
    101011000    石景山
    101011100    大兴
    101011200    房山
    101011300    密云
    101011400    门头沟
    101011500    平谷
    101011600    八达岭
    101011700    佛爷顶
    101011800    汤河口
    101011900    密云上甸子
    101012000    斋堂
    101012100    霞云岭
    //天津
    101030100    天津
    101030200    武清
    101030300    宝坻
    101030400    东丽
    101030500    西青
    101030600    北辰
    101030700    宁河
    101030800    汉沽
    101030900    静海
    101031000    津南
    101031100    塘沽
    101031200    大港
    101031300    平台
    101031400    蓟县
    //河北廊坊
    101090601    廊坊
    101090602    固安
    101090603    永清
    101090604    香河
    101090605    大城
    101090606    文安
    101090607    大厂
    101090608    霸州
    101090609    三河

    下载全国地址:https://files.cnblogs.com/files/yaoyuan2/%E5%A4%A9%E6%B0%94%E9%A2%84%E6%8A%A5%E5%9C%B0%E5%9D%80.7z

  • 相关阅读:
    Oracle什么时候需要Commit
    Oracle数据库SQL优化
    事务的四个特性(ACID)
    MySQL的两种存储引擎storage engine特点和对比
    MySql绿色版下载,安装,配置详解
    Unsupported major.minor version 51.0
    linux服务器下添加字体
    java日期比较,日期计算
    微信公众号开发保持用户登录状态思路
    本机搭建外网web服务器
  • 原文地址:https://www.cnblogs.com/yaoyuan2/p/10286170.html
Copyright © 2011-2022 走看看