zoukankan      html  css  js  c++  java
  • 天气API整理,返回的数据格式为json对象

    中国天气的API惨遭封杀,不得已更换其他的API使用吧。

    这里大部分API来自APP的数据包截取或者反汇编,所以各开发使用者不得用于商业用途,否则后果自负!

    1.金山网址导航

    来源:http://www.duba.com/tianqiyubao.html

    API地址:http://weather.123.duba.net/static/weather_info/101010100.html

    数据格式:JSON

    数据包含:PM2.5,7天天气详细数据等

    DEMO:

    weather_callback({
        "weatherinfo": {
            "city": "北京",
            "city_en": "beijing",
            "date_y": "2015年2月17日",
            "date": "",
            "week": "星期二",
            "fchh": "11",
            "cityid": "101010100",
            "temp1": "12℃~-2℃",
            "temp2": "10℃~-2℃",
            "temp3": "9℃~-1℃",
            "temp4": "6℃~0℃",
            "temp5": "11℃~0℃",
            "temp6": "9℃~-2℃",
            "tempF1": "53.6℉~28.4℉",
            "tempF2": "50℉~28.4℉",
            "tempF3": "48.2℉~30.2℉",
            "tempF4": "42.8℉~32℉",
            "tempF5": "51.8℉~32℉",
            "tempF6": "48.2℉~28.4℉",
            "weather1": "晴",
            "weather2": "晴转霾",
            "weather3": "霾转阴",
            "weather4": "小雨转雨夹雪",
            "weather5": "晴",
            "weather6": "晴",
            "img1": "0",
            "img2": "99",
            "img3": "0",
            "img4": "53",
            "img5": "53",
            "img6": "2",
            "img7": "7",
            "img8": "6",
            "img9": "0",
            "img10": "99",
            "img11": "0",
            "img12": "99",
            "img_single": "0",
            "img_title1": "晴",
            "img_title2": "晴",
            "img_title3": "晴",
            "img_title4": "霾",
            "img_title5": "霾",
            "img_title6": "阴",
            "img_title7": "小雨",
            "img_title8": "雨夹雪",
            "img_title9": "晴",
            "img_title10": "晴",
            "img_title11": "晴",
            "img_title12": "晴",
            "img_title_single": "晴",
            "wind1": "北风3-4级转微风",
            "wind2": "微风",
            "wind3": "微风",
            "wind4": "微风",
            "wind5": "北风4-5级转3-4级",
            "wind6": "北风3-4级转微风",
            "fx1": "北风",
            "fx2": "微风",
            "fl1": "3-4级转小于3级",
            "fl2": "小于3级",
            "fl3": "小于3级",
            "fl4": "小于3级",
            "fl5": "4-5级转3-4级",
            "fl6": "3-4级转小于3级",
            "index": "较冷",
            "index_d": "建议着厚外套加毛衣等服装。年老体弱者宜着大衣、呢外套加羊毛衫。",
            "index48": "",
            "index48_d": "",
            "index_uv": "中等",
            "index48_uv": "",
            "index_xc": "较适宜",
            "index_tr": "适宜",
            "index_co": "较舒适",
            "st1": "11",
            "st2": "-2",
            "st3": "10",
            "st4": "0",
            "st5": "9",
            "st6": "-1",
            "index_cl": "较不宜",
            "index_ls": "基本适宜",
            "index_ag": "极不易发",
            "index_ct": "冷",
            "index_ct_d": "建议着棉衣加羊毛衫等冬季服装",
            "index_yd": "较不宜",
            "index_yd_d": "天气寒冷,推荐您进行室内运动",
            "index_xc_d": "无雨且风力较小,易保持清洁度",
            "index_pp": "滋润保湿",
            "index_pp_d": "请选用滋润保湿型化妆品",
            "index_gm": "易发",
            "index_gm_d": "昼夜温差很大,注意预防感冒",
            "index_uv_d": "涂擦SPF大于15、PA+防晒护肤品",
            "index_co_d": "白天晴好,早晚偏凉,午后舒适",
            "index_gj": "较适宜",
            "index_gj_d": "风稍大,出门逛街前记得给秀发定型",
            "index_mf": "一般",
            "index_mf_d": "注意清洁,建议选用防晒滋润型护发品",
            "index_ys": "不带伞",
            "index_ys_d": "天气较好,不用带雨伞",
            "index_jt": "良好",
            "index_jt_d": "气象条件良好,车辆可以正常行驶",
            "index_lk": "干燥",
            "index_lk_d": "天气较好,路面比较干燥,路况较好",
            "index_cl_d": "室外锻炼请注意避免迎风锻炼",
            "index_dy": "较适宜",
            "index_dy_d": "天气稍凉会对垂钓产生一定影响",
            "index_hc": "较适宜",
            "index_hc_d": "风大天凉,需注意及时添衣",
            "index_yh": "较适宜",
            "index_yh_d": "不用担心天气来调皮捣乱而影响了兴致",
            "index_ls_d": "天气不错,抓紧时机让衣物晒太阳吧",
            "index_fs": "中等",
            "index_fs_d": "适合涂擦SPF大于15,PA+护肤品",
            "index_ag_d": "无需担心过敏,可放心外出,享受生活",
            "rc1": "7:00",
            "rl1": "17:28",
            "rc2": "7:00",
            "rl2": "17:28",
            "pm": "28",
            "pm-level": "优",
            "pm-num": "1",
            "pm-url": "http://pm25.mojichina.com/33",
            "pm-pubtime": "2015-02-17 16:00:00"
        },
        "update_time": "2015-02-17 17:25:01",
        "t": 1424166379,
        "from": "cache"
    })
    

      

      

    2.小米APP天气接口(注意编码,默认是GBK,但实际是UTF8)

    来源:小米天气APP

    API地址:http://weatherapi.market.xiaomi.com/wtr-v2/weather?cityId=101121301

    数据格式:JSON

    数据包含:7天天气详细数据等

    DEMO:

    {
        "forecast": {
            "city": "威海",
            "city_en": "weihai",
            "cityid": "101121301",
            "date": "",
            "date_y": "2015年02月17日",
            "fchh": "08",
            "fl1": "5-6级",
            "fl2": "5-6级",
            "fl3": "5-6级转4-5级",
            "fl4": "4-5级",
            "fl5": "4-5级",
            "fl6": "微风",
            "fx1": "北风",
            "fx2": "北风",
            "img1": "",
            "img10": "",
            "img11": "",
            "img12": "",
            "img2": "",
            "img3": "",
            "img4": "",
            "img5": "",
            "img6": "",
            "img7": "",
            "img8": "",
            "img9": "",
            "img_single": "",
            "img_title1": "多云",
            "img_title10": "阴",
            "img_title11": "晴",
            "img_title12": "晴",
            "img_title2": "晴",
            "img_title3": "晴",
            "img_title4": "多云",
            "img_title5": "晴",
            "img_title6": "多云",
            "img_title7": "晴",
            "img_title8": "多云",
            "img_title9": "小雨",
            "img_title_single": "",
            "index": "寒冷",
            "index48": "",
            "index48_d": "",
            "index48_uv": "",
            "index_ag": "极不易发",
            "index_cl": "不宜",
            "index_co": "较不舒适",
            "index_d": "",
            "index_ls": "不太适宜",
            "index_tr": "较不宜",
            "index_uv": "最弱",
            "index_xc": "较不宜",
            "st1": "",
            "st2": "",
            "st3": "",
            "st4": "",
            "st5": "",
            "st6": "",
            "temp1": "3℃~-1℃",
            "temp2": "3℃~-2℃",
            "temp3": "4℃~-1℃",
            "temp4": "10℃~6℃",
            "temp5": "12℃~3℃",
            "temp6": "0℃~0℃",
            "tempF1": "",
            "tempF2": "",
            "tempF3": "",
            "tempF4": "",
            "tempF5": "",
            "tempF6": "",
            "weather1": "多云转晴",
            "weather2": "晴转多云",
            "weather3": "晴转多云",
            "weather4": "晴转多云",
            "weather5": "小雨转阴",
            "weather6": "晴",
            "week": "星期二",
            "wind1": "北风",
            "wind2": "北风",
            "wind3": "北风",
            "wind4": "南风",
            "wind5": "南风",
            "wind6": "微风"
        },
        "realtime": {
            "SD": "61%",
            "WD": "西北风",
            "WS": "4级",
            "WSE": "",
            "city": "",
            "cityid": "101121301",
            "isRadar": "1",
            "radar": "JC_RADAR_AZ9010_JB",
            "temp": "3",
            "time": "17:35",
            "weather": "晴"
        },
        "alert": [],
        "aqi": {
            "city": "威海",
            "city_id": "101121301",
            "pub_time": "2015-02-17 17:00",
            "aqi": "52",
            "pm25": "26",
            "pm10": "52",
            "so2": "6",
            "no2": "12",
            "src": "中国环境监测总站",
            "spot": ""
        },
        "index": [
            {
                "code": "fs",
                "details": "属弱紫外辐射天气,长期在户外,建议涂擦SPF在8-12之间的防晒护肤品。",
                "index": "弱",
                "name": "防晒指数",
                "otherName": ""
            },
            {
                "code": "ct",
                "details": "天气寒冷,建议着厚羽绒服、毛皮大衣加厚毛衣等隆冬服装。年老体弱者尤其要注意保暖防冻。",
                "index": "寒冷",
                "name": "穿衣指数",
                "otherName": ""
            },
            {
                "code": "yd",
                "details": "天气较好,但考虑风力很大,推荐您进行室内运动,若在户外运动请注意避风保暖和防晒。",
                "index": "较不宜",
                "name": "运动指数",
                "otherName": ""
            },
            {
                "code": "xc",
                "details": "较不宜洗车,未来一天无雨,风力较大,如果执意擦洗汽车,要做好蒙上污垢的心理准备。",
                "index": "较不宜",
                "name": "洗车指数",
                "otherName": ""
            },
            {
                "code": "ls",
                "details": "风力较大,不太适宜晾晒,若需要晾晒,请注意选择防风的地点晾晒并夹牢衣物。",
                "index": "不太适宜",
                "name": "晾晒指数",
                "otherName": ""
            }
        ],
        "accu_cc": {
            "EpochTime": "1424165700",
            "LocalObservationDateTime": "2015-02-17T17:35:00+08:00",
            "Pressure": "1021.8",
            "RealFeelTemperature": "-4.3",
            "RelativeHumidity": "61",
            "UVIndex": "0",
            "Visibility": "16.1",
            "WindDirectionDegrees": "315",
            "WindSpeed": "28.0"
        },
        "accu_f5": {
            "EffectiveEpochDate": "1424559600",
            "EffectiveDate": "2015-02-22T07:00:00+08:00",
            "DailyForecasts": [
                {
                    "Date": "2015-02-17T07:00:00+08:00",
                    "EpochDate": "1424127600",
                    "Sun_Rise": "2015-02-17T06:39:00+08:00",
                    "Sun_EpochRise": "1424126340",
                    "Sun_Set": "2015-02-17T17:32:00+08:00",
                    "Sun_EpochSet": "1424165520",
                    "PrecipitationProbability": "2"
                },
                {
                    "Date": "2015-02-18T07:00:00+08:00",
                    "EpochDate": "1424214000",
                    "Sun_Rise": "2015-02-18T06:38:00+08:00",
                    "Sun_EpochRise": "1424212680",
                    "Sun_Set": "2015-02-18T17:33:00+08:00",
                    "Sun_EpochSet": "1424251980",
                    "PrecipitationProbability": "0"
                },
                {
                    "Date": "2015-02-19T07:00:00+08:00",
                    "EpochDate": "1424300400",
                    "Sun_Rise": "2015-02-19T06:37:00+08:00",
                    "Sun_EpochRise": "1424299020",
                    "Sun_Set": "2015-02-19T17:34:00+08:00",
                    "Sun_EpochSet": "1424338440",
                    "PrecipitationProbability": "0"
                },
                {
                    "Date": "2015-02-20T07:00:00+08:00",
                    "EpochDate": "1424386800",
                    "Sun_Rise": "2015-02-20T06:36:00+08:00",
                    "Sun_EpochRise": "1424385360",
                    "Sun_Set": "2015-02-20T17:35:00+08:00",
                    "Sun_EpochSet": "1424424900",
                    "PrecipitationProbability": "0"
                },
                {
                    "Date": "2015-02-21T07:00:00+08:00",
                    "EpochDate": "1424473200",
                    "Sun_Rise": "2015-02-21T06:35:00+08:00",
                    "Sun_EpochRise": "1424471700",
                    "Sun_Set": "2015-02-21T17:37:00+08:00",
                    "Sun_EpochSet": "1424511420",
                    "PrecipitationProbability": "60"
                }
            ]
        },
        "today": {
            "cityCode": "101121301",
            "date": "2015-02-17",
            "humidityMax": 93,
            "humidityMin": 59,
            "precipitationMax": 0,
            "precipitationMin": -999,
            "tempMax": 3,
            "tempMin": 0,
            "weatherEnd": "多云",
            "weatherStart": "多云",
            "windDirectionEnd": "西风",
            "windDirectionStart": "西风",
            "windMax": 5,
            "windMin": 2
        },
        "yestoday": {
            "cityCode": "101121301",
            "date": "2015-02-16",
            "humidityMax": 100,
            "humidityMin": 77,
            "precipitationMax": 0,
            "precipitationMin": -999,
            "tempMax": 6,
            "tempMin": 1,
            "weatherEnd": "多云",
            "weatherStart": "小雨",
            "windDirectionEnd": "西风",
            "windDirectionStart": "北风",
            "windMax": 6,
            "windMin": 0
        }
    }
    

      

      

    3.中央天气预报(可以获取详细和简略的数据)

    来源:中央天气预报APP

    API地址:http://weather.51wnl.com/weatherinfo/GetMoreWeather?cityCode=101040100&weatherType=0

    http://weather.51wnl.com/weatherinfo/GetMoreWeather?cityCode=101040100&weatherType=1

    数据格式:JSON

    数据包含:7天天气详细数据等

    DEMO:

    {
        "weatherinfo": {
            "city": "重庆",
            "city_en": "",
            "date_y": "2015年02月17日",
            "date": "",
            "week": "",
            "fchh": 0,
            "cityid": 101040100,
            "temp1": "9℃~20℃",
            "temp2": "12℃~18℃",
            "temp3": "13℃~17℃",
            "temp4": "13℃~17℃",
            "temp5": "13℃~17℃",
            "temp6": "12℃~16℃",
            "tempF1": "",
            "tempF2": "",
            "tempF3": "",
            "tempF4": "",
            "tempF5": "",
            "tempF6": "",
            "weather1": "晴转多云",
            "weather2": "阴",
            "weather3": "阴",
            "weather4": "阴",
            "weather5": "阴转小雨",
            "weather6": "小雨转多云",
            "img1": "0",
            "img2": "1",
            "img3": "2",
            "img4": "2",
            "img5": "2",
            "img6": "2",
            "img7": "2",
            "img8": "2",
            "img9": "2",
            "img10": "7",
            "img11": "7",
            "img12": "1",
            "img_single": 0,
            "img_title1": "",
            "img_title2": "",
            "img_title3": "",
            "img_title4": "",
            "img_title5": "",
            "img_title6": "",
            "img_title7": "",
            "img_title8": "",
            "img_title9": "",
            "img_title10": "",
            "img_title11": "",
            "img_title12": "",
            "img_title_single": "",
            "wind1": "",
            "wind2": "",
            "wind3": "",
            "wind4": "",
            "wind5": "",
            "wind6": "",
            "fx1": "",
            "fx2": "",
            "fl1": "",
            "fl2": "",
            "fl3": "",
            "fl4": "",
            "fl5": "",
            "fl6": "",
            "index": "",
            "index_d": "",
            "index48": "",
            "index48_d": "",
            "index_uv": "",
            "index48_uv": "",
            "index_xc": "",
            "index_tr": "",
            "index_co": "",
            "st1": 0,
            "st2": 0,
            "st3": 0,
            "st4": 0,
            "st5": 0,
            "st6": 0,
            "index_cl": "",
            "index_ls": "",
            "index_ag": ""
        }
    }

      

  • 相关阅读:
    JS基础语法
    JS的初步了解
    CSS初步学习
    HTML标签
    初步了解HTML
    LEGB规则
    Python面试题练习
    闭包
    Caché,Cache数据库连接并查询数据
    Caché,Cache数据库下载
  • 原文地址:https://www.cnblogs.com/beautiful-code/p/4918564.html
Copyright © 2011-2022 走看看