天气预报API(三):免费接口测试(“旧编码”)

时间:2016-12-10 14:02:21   收藏:0   阅读:3874

说明

我以参考文章为引子,自己测试并扩展,努力寻找更多的气象API...

本文所有测试均以青岛为例。
本文所列接口城市代码(cityid)参数都使用的 “旧编码”:全国城市代码列表(旧) 或 全球城市、景点代码

注:另有 “新编码” 的介绍和使用,详见: 全国城市代码列表(新)

1. 国家气象局

  • 当天基础天气接口
    http://www.weather.com.cn/data/sk/101120201.html

    1. { 
    2. "weatherinfo": { 
    3. "city": "青岛", 
    4. "cityid": "101120201",//城市代码  
    5. "temp": "5", //当前温度  
    6. "WD": "南风", //风向  
    7. "WS": "3级", //风速  
    8. "SD": "84%", //相对湿度 
    9. "WSE": "3", //风力 
    10. "time": "17:05", //更新时间  
    11. "isRadar": "1", //是否有雷达图(1表示有雷达图) 
    12. "Radar": "JC_RADAR_AZ9532_JB", //雷达图地址(AZ9532为青岛雷达) 
    13. "njd": "暂无实况", 
    14. "qy": "1009", 
    15. "rain": "0" 
    16. } 
    17. } 
  • 当天基础天气接口
    http://www.weather.com.cn/data/cityinfo/101120201.html

    1. { 
    2. "weatherinfo": { 
    3. "city": "青岛", 
    4. "cityid": "101120201", 
    5. "temp1": "3℃", 
    6. "temp2": "8℃", 
    7. "weather": "晴转多云", 
    8. "img1": "n0.gif", 
    9. "img2": "d1.gif", 
    10. "ptime": "18:00" 
    11. } 
    12. } 

    图片的使用:http://m.weather.com.cn/img/d0.gif <=> 技术分享

  • 省会城市基础天气接口,返回xml格式
    http://flash.weather.com.cn/wmaps/xml/china.xml

    1. <china dn="nay"> 
    2. <city quName="黑龙江" pyName="heilongjiang" cityname="哈尔滨" state1="14" state2="1" stateDetailed="小雪转多云" tem1="-21" tem2="-11" windState="微风转西北风小于3级"/> 
    3. <city quName="吉林" pyName="jilin" cityname="长春" state1="1" state2="0" stateDetailed="多云转晴" tem1="-14" tem2="-7" windState="微风"/> 
    4. <city quName="辽宁" pyName="liaoning" cityname="沈阳" state1="1" state2="0" stateDetailed="多云转晴" tem1="-13" tem2="-4" windState="北风4-5级转微风"/> 
    5. <city quName="海南" pyName="hainan" cityname="海口" state1="1" state2="1" stateDetailed="多云" tem1="16" tem2="24" windState="东北风3-4级"/> 
    6. <city quName="内蒙古" pyName="neimenggu" cityname="呼和浩特" state1="0" state2="1" stateDetailed="晴转多云" tem1="-12" tem2="0" windState="微风"/> 
    7. <city quName="新疆" pyName="xinjiang" cityname="乌鲁木齐" state1="1" state2="1" stateDetailed="多云" tem1="-4" tem2="4" windState="微风"/> 
    8. <city quName="西藏" pyName="xizang" cityname="拉萨" state1="0" state2="0" stateDetailed="晴" tem1="-3" tem2="12" windState="微风"/> 
    9. <city quName="青海" pyName="qinghai" cityname="西宁" state1="0" state2="1" stateDetailed="晴转多云" tem1="-9" tem2="12" windState="东南风小于3级"/> 
    10. <city quName="宁夏" pyName="ningxia" cityname="银川" state1="1" state2="1" stateDetailed="多云" tem1="-5" tem2="5" windState="微风"/> 
    11. <city quName="甘肃" pyName="gansu" cityname="兰州" state1="0" state2="1" stateDetailed="晴转多云" tem1="-3" tem2="8" windState="微风"/> 
    12. <city quName="河北" pyName="hebei" cityname="石家庄" state1="0" state2="1" stateDetailed="晴转多云" tem1="-2" tem2="6" windState="微风"/> 
    13. <city quName="河南" pyName="henan" cityname="郑州" state1="0" state2="1" stateDetailed="晴转多云" tem1="2" tem2="10" windState="微风"/> 
    14. <city quName="湖北" pyName="hubei" cityname="武汉" state1="0" state2="0" stateDetailed="晴" tem1="3" tem2="16" windState="微风"/> 
    15. <city quName="湖南" pyName="hunan" cityname="长沙" state1="0" state2="0" stateDetailed="晴" tem1="7" tem2="20" windState="微风"/> 
    16. <city quName="山东" pyName="shandong" cityname="济南" state1="0" state2="1" stateDetailed="晴转多云" tem1="-1" tem2="7" windState="北风3-4级转微风"/> 
    17. <city quName="江苏" pyName="jiangsu" cityname="南京" state1="0" state2="1" stateDetailed="晴转多云" tem1="5" tem2="13" windState="北风转东北风3-4级"/> 
    18. <city quName="安徽" pyName="anhui" cityname="合肥" state1="0" state2="1" stateDetailed="晴转多云" tem1="6" tem2="14" windState="东北风3-4级"/> 
    19. <city quName="山西" pyName="shanxi" cityname="太原" state1="0" state2="1" stateDetailed="晴转多云" tem1="-6" tem2="8" windState="西北风3-4级转微风"/> 
    20. <city quName="陕西" pyName="sanxi" cityname="西安" state1="53" state2="53" stateDetailed="霾" tem1="1" tem2="10" windState="东北风小于3级"/> 
    21. <city quName="四川" pyName="sichuan" cityname="成都" state1="1" state2="2" stateDetailed="多云转阴" tem1="6" tem2="14" windState="南风小于3级"/> 
    22. <city quName="云南" pyName="yunnan" cityname="昆明" state1="0" state2="0" stateDetailed="晴" tem1="3" tem2="19" windState="微风"/> 
    23. <city quName="贵州" pyName="guizhou" cityname="贵阳" state1="0" state2="0" stateDetailed="晴" tem1="6" tem2="18" windState="南风小于3级"/> 
    24. <city quName="浙江" pyName="zhejiang" cityname="杭州" state1="0" state2="0" stateDetailed="晴" tem1="7" tem2="15" windState="东北风小于3级"/> 
    25. <city quName="福建" pyName="fujian" cityname="福州" state1="0" state2="0" stateDetailed="晴" tem1="10" tem2="20" windState="微风转东北风小于3级"/> 
    26. <city quName="江西" pyName="jiangxi" cityname="南昌" state1="18" state2="0" stateDetailed="雾转晴" tem1="6" tem2="17" windState="微风"/> 
    27. <city quName="广东" pyName="guangdong" cityname="广州" state1="0" state2="0" stateDetailed="晴" tem1="12" tem2="24" windState="微风"/> 
    28. <city quName="广西" pyName="guangxi" cityname="南宁" state1="0" state2="0" stateDetailed="晴" tem1="14" tem2="26" windState="东北风小于3级"/> 
    29. <city quName="北京" pyName="beijing" cityname="北京" state1="0" state2="0" stateDetailed="晴" tem1="-2" tem2="4" windState="北风3-4级转南风小于3级"/> 
    30. <city quName="天津" pyName="tianjin" cityname="天津" state1="0" state2="0" stateDetailed="晴" tem1="-2" tem2="6" windState="西北风4-5级转北风小于3级"/> 
    31. <city quName="上海" pyName="shanghai" cityname="上海" state1="0" state2="1" stateDetailed="晴转多云" tem1="8" tem2="14" windState="南风小于3级转微风"/> 
    32. <city quName="重庆" pyName="chongqing" cityname="重庆" state1="1" state2="1" stateDetailed="多云" tem1="9" tem2="17" windState="微风"/> 
    33. <city quName="香港" pyName="xianggang" cityname="香港" state1="1" state2="1" stateDetailed="多云" tem1="17" tem2="22" windState="微风"/> 
    34. <city quName="澳门" pyName="aomen" cityname="澳门" state1="0" state2="0" stateDetailed="晴" tem1="16" tem2="23" windState="微风"/> 
    35. <city quName="台湾" pyName="taiwan" cityname="台北" state1="7" state2="7" stateDetailed="小雨" tem1="18" tem2="22" windState="微风"/> 
    36. <city quName="西沙" pyName="xisha" cityname="西沙" state1="3" state2="3" stateDetailed="阵雨" tem1="24" tem2="28" windState="东北风4-5级"/> 
    37. <city quName="南沙" pyName="nanshadao" cityname="南沙" state1="3" state2="3" stateDetailed="阵雨" tem1="27" tem2="30" windState="东北风4-5级"/> 
    38. <city quName="钓鱼岛" pyName="diaoyudao" cityname="钓鱼岛" state1="2" state2="7" stateDetailed="阴转小雨" tem1="19" tem2="21" windState="东北风4-5级"/> 
    39. </china> 
  • SmartWeatherAPI平台提供丰富的气象服务信息,包括预报、指数、预警、资讯、雷达、云图、农历以及服务产品等内容。

  • http://www.weather.com.cn/data/zs/101010100.html(已失效)

2. 中华万年历

  • 通城市id或名称获得天气数据,json数据
    http://wthrcdn.etouch.cn/weather_mini?citykey=101120201
    http://wthrcdn.etouch.cn/weather_mini?city=青岛

    1. { 
    2. "desc": "OK", 
    3. "status": 1000, 
    4. "data": { 
    5. "wendu": "4", 
    6. "ganmao": "将有一次强降温过程,且风力较强,极易发生感冒,请特别注意增加衣服保暖防寒。", 
    7. "forecast": [ 
    8. { 
    9. "fengxiang": "北风", 
    10. "fengli": "4-5级", 
    11. "high": "高温 6℃", 
    12. "type": "晴", 
    13. "low": "低温 0℃", 
    14. "date": "9日星期五" 
    15. }, 
    16. { 
    17. "fengxiang": "北风", 
    18. "fengli": "3-4级", 
    19. "high": "高温 7℃", 
    20. "type": "晴", 
    21. "low": "低温 2℃", 
    22. "date": "10日星期六" 
    23. }, 
    24. { 
    25. "fengxiang": "北风", 
    26. "fengli": "3-4级", 
    27. "high": "高温 9℃", 
    28. "type": "晴", 
    29. "low": "低温 4℃", 
    30. "date": "11日星期天" 
    31. }, 
    32. { 
    33. "fengxiang": "南风", 
    34. "fengli": "3-4级", 
    35. "high": "高温 8℃", 
    36. "type": "阵雨", 
    37. "low": "低温 1℃", 
    38. "date": "12日星期一" 
    39. }, 
    40. { 
    41. "fengxiang": "北风", 
    42. "fengli": "5-6级", 
    43. "high": "高温 6℃", 
    44. "type": "晴", 
    45. "low": "低温 -1℃", 
    46. "date": "13日星期二" 
    47. } 
    48. ], 
    49. "yesterday": { 
    50. "fl": "5-6级", 
    51. "fx": "南风", 
    52. "high": "高温 11℃", 
    53. "type": "多云", 
    54. "low": "低温 2℃", 
    55. "date": "8日星期四" 
    56. }, 
    57. "aqi": "51", 
    58. "city": "青岛" 
    59. } 
    60. } 
  • 通过城市id或名称获得天气数据,XML数据
    http://wthrcdn.etouch.cn/WeatherApi?citykey=101120201
    http://wthrcdn.etouch.cn/WeatherApi?city=青岛

    <?xml version="1.0" encoding="UTF-8"?><resp><city>青岛</city><updatetime>15:25</updatetime><wendu>4</wendu><fengli>3级</fengli><shidu>50%</shidu><fengxiang>东北风</fengxiang><sunrise_1>06:58</sunrise_1><sunset_1>16:44</sunset_1><sunrise_2></sunrise_2><sunset_2></sunset_2><environment><aqi>51</aqi><pm25>20</pm25><suggest>极少数敏感人群应减少户外活动</suggest><quality>良</quality><MajorPollutants>颗粒物(PM10)</MajorPollutants><o3>65</o3><co>0</co><pm10>50</pm10><so2>21</so2><no2>26</no2><time>15:00:00</time></environment><alarm><cityKey>10112</cityKey><cityName><![CDATA[山东省]]></cityName><alarmType><![CDATA[霾]]></alarmType><alarmDegree><![CDATA[黄色]]></alarmDegree><alarmText><![CDATA[山东省气象台发布霾黄色预警]]></alarmText><alarm_details><![CDATA[继续发布霾黄色预警信号:预计今天夜间,鲁西北、鲁中和鲁南的大部地区有中度以上的霾天气。8日16时]]></alarm_details><standard><![CDATA[预计未来24小时内可能出现下列条件之一并将持续或实况已达到下列条件之一并可能持续:能见度小于3000米且相对湿度小于80%的霾;能见度小于3000米且相对湿度大于等于80%,PM2.5浓度大于115微克/立方米且小于等于150微克/立方米:能见度小于5000米,PM2.5浓度大于150微克/立方米且小于等于250微克/立方米。]]></standard><suggest><![CDATA[1、空气质量明显降低,人员需适当防护;2、一般人群适量减少户外活动,儿童、老人及易感人群应减少外出。]]></suggest><imgUrl><![CDATA[http://static.etouch.cn/apps/weather/alarm_icon-1/mai_yellow-1.png]]></imgUrl><time>2016-12-08 16:22:00</time></alarm><yesterday><date_1>8日星期四</date_1><high_1>高温 11℃</high_1><low_1>低温 2℃</low_1><day_1><type_1>多云</type_1><fx_1>南风</fx_1><fl_1>5-6级</fl_1></day_1><night_1><type_1>晴</type_1><fx_1>北风</fx_1><fl_1>5-6级</fl_1></night_1></yesterday><forecast><weather><date>9日星期五</date><high>高温 6℃</high><low>低温 0℃</low><day><type>晴</type><fengxiang>北风</fengxiang><fengli>4-5级</fengli></day><night><type>多云</type><fengxiang>北风</fengxiang><fengli>3-4级</fengli></night></weather><weather><date>10日星期六</date><high>高温 7℃</high><low>低温 2℃</low><day><type>晴</type><fengxiang>北风</fengxiang><fengli>3-4级</fengli></day><night><type>多云</type><fengxiang>南风</fengxiang><fengli>3-4级</fengli></night></weather><weather><date>11日星期天</date><high>高温 9℃</high><low>低温 4℃</low><day><type>晴</type><fengxiang>北风</fengxiang><fengli>3-4级</fengli></day><night><type>多云</type><fengxiang>北风</fengxiang><fengli>3-4级</fengli></night></weather><weather><date>12日星期一</date><high>高温 8℃</high><low>低温 1℃</low><day><type>阵雨</type><fengxiang>南风</fengxiang><fengli>3-4级</fengli></day><night><type>阵雨</type><fengxiang>南风</fengxiang><fengli>4-5级</fengli></night></weather><weather><date>13日星期二</date><high>高温 6℃</high><low>低温 -1℃</low><day><type>晴</type><fengxiang>北风</fengxiang><fengli>5-6级</fengli></day><night><type>晴</type><fengxiang>北风</fengxiang><fengli>5-6级</fengli></night></weather></forecast><zhishus><zhishu><name>晨练指数</name><value>较不宜</value><detail>风力稍大,较不宜晨练,室外锻炼请注意选择避风的地点,避免迎风锻炼。</detail></zhishu><zhishu><name>舒适度</name><value>较不舒适</value><detail>白天天气较凉,且风力较强,您会感觉偏冷,不很舒适,请注意添加衣物,以防感冒。</detail></zhishu><zhishu><name>穿衣指数</name><value>冷</value><detail>天气冷,建议着棉服、羽绒服、皮夹克加羊毛衫等冬季服装。年老体弱者宜着厚棉衣、冬大衣或厚羽绒服。</detail></zhishu><zhishu><name>感冒指数</name><value>极易发</value><detail>将有一次强降温过程,且风力较强,极易发生感冒,请特别注意增加衣服保暖防寒。</detail></zhishu><zhishu><name>晾晒指数</name><value>基本适宜</value><detail>天气不错,午后温暖的阳光仍能满足你驱潮消霉杀菌的晾晒需求。</detail></zhishu><zhishu><name>旅游指数</name><value>一般</value><detail>天气较好,温度稍低,加之风稍大,让人感觉有点凉,会对外出有一定影响,外出注意防风保暖。</detail></zhishu><zhishu><name>紫外线强度</name><value>弱</value><detail>紫外线强度较弱,建议出门前涂擦SPF在12-15之间、PA+的防晒护肤品。</detail></zhishu><zhishu><name>洗车指数</name><value>较不宜</value><detail>较不宜洗车,未来一天无雨,风力较大,如果执意擦洗汽车,要做好蒙上污垢的心理准备。</detail></zhishu><zhishu><name>运动指数</name><value>较不宜</value><detail>天气较好,但考虑风力较大,天气寒冷,推荐您进行室内运动,若在户外运动须注意保暖。</detail></zhishu><zhishu><name>约会指数</name><value>较不适宜</value><detail>天气较好,但风力较大,建议尽量不要去室外约会,如果外出,请您挑选避风的地点。</detail></zhishu><zhishu><name>雨伞指数</name><value>不带伞</value><detail>天气较好,您在出门的时候无须带雨伞。</detail></zhishu></zhishus></resp><!-- 10.10.162.42(10.10.162.42):42379 ; 10.10.162.42:8080 -->
    

3. 51万年历

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

    1. { 
    2. "weatherinfo": { 
    3. "Radar": "", 
    4. "SD": "51%", 
    5. "WD": "东北风", 
    6. "WS": "4级", 
    7. "WSE": 6, 
    8. "city": "青岛", 
    9. "cityid": "101120201", 
    10. "isRadar": 1, 
    11. "njd": "", 
    12. "qy": "0", 
    13. "temp": "4", 
    14. "time": "2016-12-09T14:33:57.153" 
    15. } 
    16. } 
  • Type=0
    http://weather.51wnl.com/weatherinfo/GetMoreWeather?cityCode=101120201&weatherType=0

    1. { 
    2. "weatherinfo": { 
    3. "city": "青岛", 
    4. "city_en": "", 
    5. "cityid": "101120201", 
    6. "date": "", 
    7. "date_y": "2016年12月09日", 
    8. "img_title_single": "", 
    9. "index": "", 
    10. "index48": "", 
    11. "index48_d ": "", 
    12. "index48_uv": "", 
    13. "index_ag": "", 
    14. "index_cl": "", 
    15. "index_co": "", 
    16. "index_d": "", 
    17. "index_ls": "", 
    18. "index_tr": "", 
    19. "index_uv": "", 
    20. "index_xc": "", 
    21. "fx1": "", 
    22. "fx2": "", 
    23. "fl1": "", 
    24. "img1": "2", 
    25. "img_title1": "阴", 
    26. "st1": 0, 
    27. "temp1": "4℃~6℃", 
    28. "tempF1": "", 
    29. "weather1": "阴", 
    30. "wind1": "东北风", 
    31. "fl2": "", 
    32. "img2": "1", 
    33. "img_title2": "多云", 
    34. "st2": 0, 
    35. "temp2": "3℃~6℃", 
    36. "tempF2": "", 
    37. "weather2": "多云", 
    38. "wind2": "东北风", 
    39. "fl3": "", 
    40. "img3": "0", 
    41. "img_title3": "晴天", 
    42. "st3": 0, 
    43. "temp3": "5℃~9℃", 
    44. "tempF3": "", 
    45. "weather3": "晴天", 
    46. "wind3": "东南风", 
    47. "fl4": "", 
    48. "img4": "2", 
    49. "img_title4": "阴", 
    50. "st4": 0, 
    51. "temp4": "9℃~12℃", 
    52. "tempF4": "", 
    53. "weather4": "阴", 
    54. "wind4": "南风", 
    55. "fl5": "", 
    56. "img5": "29", 
    57. "img_title5": "风", 
    58. "st5": 0, 
    59. "temp5": "1℃~9℃", 
    60. "tempF5": "", 
    61. "weather5": "风", 
    62. "wind5": "北风", 
    63. "fl6": "", 
    64. "img6": "29", 
    65. "img_title6": "风", 
    66. "st6": 0, 
    67. "temp6": "0℃~3℃", 
    68. "tempF6": "", 
    69. "weather6": "风", 
    70. "wind6": "北风", 
    71. "img7": "0", 
    72. "img_title7": "", 
    73. "img8": "0", 
    74. "img_title8": "", 
    75. "img9": "0", 
    76. "img_title9": "", 
    77. "img10": "0", 
    78. "img_title10": "", 
    79. "img11": "0", 
    80. "img_title11": "", 
    81. "img12": "0", 
    82. "img_title12": "" 
    83. } 
    84. } 

4. 金山毒霸

http://weather.123.duba.net/static/weather_info/101120201.html?callback=(callback参数可选)

  1. { 
  2. "weatherinfo": { 
  3. "city_en": "qingdao", 
  4. "city": "青岛", 
  5. "cityid": "101120201", 
  6. "week": "星期五", 
  7. "date_y": "2016年12月09日", 
  8. "fchh": 1, 
  9. "date": "201612091100", 
  10. "dt": 2, 
  11. "fl1": "4-5级", 
  12. "fl2": "3-4级", 
  13. "fl3": "3-4级", 
  14. "fl4": "3-4级", 
  15. "fl5": "5-6级", 
  16. "fl6": "4-5级", 
  17. "fx1": "北风", 
  18. "fx2": "北风", 
  19. "img1": "0", 
  20. "img2": "1", 
  21. "img3": "0", 
  22. "img4": "1", 
  23. "img5": "0", 
  24. "img6": "1", 
  25. "img7": "3", 
  26. "img8": "3", 
  27. "img9": "0", 
  28. "img10": "0", 
  29. "img11": "0", 
  30. "img12": "0", 
  31. "img_single": "0", 
  32. "img_title1": "晴", 
  33. "img_title2": "多云", 
  34. "img_title3": "晴", 
  35. "img_title4": "多云", 
  36. "img_title5": "晴", 
  37. "img_title6": "多云", 
  38. "img_title7": "阵雨", 
  39. "img_title8": "阵雨", 
  40. "img_title9": "晴", 
  41. "img_title10": "晴", 
  42. "img_title11": "晴", 
  43. "img_title12": "晴", 
  44. "img_title_single": "晴", 
  45. "pm": "51", 
  46. "pm-level": "良", 
  47. "pm-num": "2", 
  48. "pm-pubtime": "2016-12-09 14:00:00", 
  49. "pm-url": "", 
  50. "rl1": "16:44", 
  51. "rc1": "06:57", 
  52. "rl2": "16:44", 
  53. "rc2": "06:58", 
  54. "sd": "52%", 
  55. "st1": "0", 
  56. "st2": "0", 
  57. "st3": "0", 
  58. "st4": "3", 
  59. "st5": "0", 
  60. "st6": "0", 
  61. "temp": "4", 
  62. "temp1": "6℃~0℃", 
  63. "tempF1": "42.8℃~32℃", 
  64. "temp2": "7℃~2℃", 
  65. "tempF2": "44.6℃~35.6℃", 
  66. "temp3": "9℃~4℃", 
  67. "tempF3": "48.2℃~39.2℃", 
  68. "temp4": "8℃~1℃", 
  69. "tempF4": "46.4℃~33.8℃", 
  70. "temp5": "6℃~-1℃", 
  71. "tempF5": "42.8℃~30.2℃", 
  72. "temp6": "3℃~-3℃", 
  73. "tempF6": "37.4℃~26.6℃", 
  74. "wd": "北风", 
  75. "weather1": "晴", 
  76. "weather2": "晴", 
  77. "weather3": "晴", 
  78. "weather4": "阵雨", 
  79. "weather5": "晴", 
  80. "weather6": "晴", 
  81. "wind1": "4-5级", 
  82. "wind2": "3-4级", 
  83. "wind3": "3-4级", 
  84. "wind4": "3-4级", 
  85. "wind5": "5-6级", 
  86. "wind6": "4-5级", 
  87. "ws": "2级", 
  88. "wse": "2" 
  89. }, 
  90. "update_time": "2016-12-09 15:55:08", 
  91. "t": 1481270653, 
  92. "from": "cache" 
  93. } 

5. 小米天气

"碉堡了"
http://weatherapi.market.xiaomi.com/wtr-v2/weather?cityId=101120201

  1. { 
  2. "forecast": { 
  3. "city": "请更换接口", 
  4. "city_en": "Please change api to v3", 
  5. "cityid": "101120201", 
  6. "date": "", 
  7. "date_y": "2016年12月09日", 
  8. "fchh": "07", 
  9. "fl1": "小于3级", 
  10. "fl2": "小于3级", 
  11. "fl3": "小于3级", 
  12. "fl4": "小于3级", 
  13. "fl5": "小于3级", 
  14. "fl6": "微风", 
  15. "fx1": "微风", 
  16. "fx2": "微风", 
  17. "img1": "", 
  18. "img10": "", 
  19. "img11": "", 
  20. "img12": "", 
  21. "img2": "", 
  22. "img3": "", 
  23. "img4": "", 
  24. "img5": "", 
  25. "img6": "", 
  26. "img7": "", 
  27. "img8": "", 
  28. "img9": "", 
  29. "img_single": "", 
  30. "img_title1": "晴", 
  31. "img_title10": "多云", 
  32. "img_title11": "晴", 
  33. "img_title12": "晴", 
  34. "img_title2": "多云", 
  35. "img_title3": "晴", 
  36. "img_title4": "晴", 
  37. "img_title5": "多云", 
  38. "img_title6": "阴", 
  39. "img_title7": "阵雨", 
  40. "img_title8": "阵雨", 
  41. "img_title9": "多云", 
  42. "img_title_single": "", 
  43. "index": "舒适", 
  44. "index48": "", 
  45. "index48_d": "", 
  46. "index48_uv": "", 
  47. "index_ag": "易发", 
  48. "index_cl": "较适宜", 
  49. "index_co": "舒适", 
  50. "index_d": "", 
  51. "index_ls": "适宜", 
  52. "index_tr": "适宜", 
  53. "index_uv": "中等", 
  54. "index_xc": "较适宜", 
  55. "st1": "", 
  56. "st2": "", 
  57. "st3": "", 
  58. "st4": "", 
  59. "st5": "", 
  60. "st6": "", 
  61. "temp1": "6℃~0℃", 
  62. "temp2": "7℃~1℃", 
  63. "temp3": "10℃~7℃", 
  64. "temp4": "12℃~1℃", 
  65. "temp5": "6℃~-1℃", 
  66. "temp6": "0℃~0℃", 
  67. "tempF1": "", 
  68. "tempF2": "", 
  69. "tempF3": "", 
  70. "tempF4": "", 
  71. "tempF5": "", 
  72. "tempF6": "", 
  73. "weather1": "晴转多云", 
  74. "weather2": "晴", 
  75. "weather3": "多云转阴", 
  76. "weather4": "阵雨", 
  77. "weather5": "多云", 
  78. "weather6": "晴", 
  79. "week": "星期二", 
  80. "wind1": "微风", 
  81. "wind2": "微风", 
  82. "wind3": "微风", 
  83. "wind4": "微风", 
  84. "wind5": "微风", 
  85. "wind6": "微风" 
  86. }, 
  87. "realtime": { 
  88. "SD": "45%", 
  89. "WD": "北风", 
  90. "WS": "3级", 
  91. "WSE": "", 
  92. "city": "", 
  93. "cityid": "101120201", 
  94. "isRadar": "1", 
  95. "radar": "JC_RADAR_AZ9010_JB", 
  96. "temp": "5", 
  97. "time": "15:20", 
  98. "weather": "晴" 
  99. }, 
  100. "alert": [], 
  101. "aqi": { 
  102. "city": "青岛", 
  103. "city_id": "101120201", 
  104. "pub_time": "2016-12-09 14:00", 
  105. "aqi": "46", 
  106. "pm25": "21", 
  107. "pm10": "51", 
  108. "so2": "21", 
  109. "no2": "27", 
  110. "src": "中国环境监测总站", 
  111. "spot": "" 
  112. }, 
  113. "index": [ 
  114. { 
  115. "code": "fs", 
  116. "details": "属弱紫外辐射天气,长期在户外,建议涂擦SPF在8-12之间的防晒护肤品。", 
  117. "index": "弱", 
  118. "name": "防晒指数", 
  119. "otherName": "" 
  120. }, 
  121. { 
  122. "code": "ct", 
  123. "details": "建议着薄外套、开衫牛仔衫裤等服装。年老体弱者应适当添加衣物,宜着夹克衫、薄毛衣等。", 
  124. "index": "较舒适", 
  125. "name": "穿衣指数", 
  126. "otherName": "" 
  127. }, 
  128. { 
  129. "code": "yd", 
  130. "details": "天气较好,但风力较大,推荐您进行室内运动,若在户外运动请注意避风保暖。", 
  131. "index": "较适宜", 
  132. "name": "运动指数", 
  133. "otherName": "" 
  134. }, 
  135. { 
  136. "code": "xc", 
  137. "details": "较适宜洗车,未来一天无雨,风力较小,擦洗一新的汽车至少能保持一天。", 
  138. "index": "较适宜", 
  139. "name": "洗车指数", 
  140. "otherName": "" 
  141. }, 
  142. { 
  143. "code": "ls", 
  144. "details": "天气不错,适宜晾晒。赶紧把久未见阳光的衣物搬出来吸收一下太阳的味道吧!", 
  145. "index": "适宜", 
  146. "name": "晾晒指数", 
  147. "otherName": "" 
  148. } 
  149. ], 
  150. "accu_cc": { 
  151. "EpochTime": "1481268000", 
  152. "LocalObservationDateTime": "2016-12-09T15:20:00+08:00", 
  153. "Pressure": "1027.0", 
  154. "RealFeelTemperature": "2.8", 
  155. "RelativeHumidity": "45", 
  156. "UVIndex": "1", 
  157. "Visibility": "16.1", 
  158. "WindDirectionDegrees": "0", 
  159. "WindSpeed": "13.0" 
  160. }, 
  161. "accu_f5": { 
  162. "EffectiveEpochDate": "1481497200", 
  163. "EffectiveDate": "2016-12-12T07:00:00+08:00", 
  164. "DailyForecasts": [ 
  165. { 
  166. "Date": "2016-12-09T07:00:00+08:00", 
  167. "EpochDate": "1481238000", 
  168. "Sun_Rise": "2016-12-09T06:58:00+08:00", 
  169. "Sun_EpochRise": "1481237880", 
  170. "Sun_Set": "2016-12-09T16:44:00+08:00", 
  171. "Sun_EpochSet": "1481273040", 
  172. "PrecipitationProbability": "1" 
  173. }, 
  174. { 
  175. "Date": "2016-12-10T07:00:00+08:00", 
  176. "EpochDate": "1481324400", 
  177. "Sun_Rise": "2016-12-10T06:59:00+08:00", 
  178. "Sun_EpochRise": "1481324340", 
  179. "Sun_Set": "2016-12-10T16:44:00+08:00", 
  180. "Sun_EpochSet": "1481359440", 
  181. "PrecipitationProbability": "1" 
  182. }, 
  183. { 
  184. "Date": "2016-12-11T07:00:00+08:00", 
  185. "EpochDate": "1481410800", 
  186. "Sun_Rise": "2016-12-11T06:59:00+08:00", 
  187. "Sun_EpochRise": "1481410740", 
  188. "Sun_Set": "2016-12-11T16:44:00+08:00", 
  189. "Sun_EpochSet": "1481445840", 
  190. "PrecipitationProbability": "0" 
  191. }, 
  192. { 
  193. "Date": "2016-12-12T07:00:00+08:00", 
  194. "EpochDate": "1481497200", 
  195. "Sun_Rise": "2016-12-12T07:00:00+08:00", 
  196. "Sun_EpochRise": "1481497200", 
  197. "Sun_Set": "2016-12-12T16:45:00+08:00", 
  198. "Sun_EpochSet": "1481532300", 
  199. "PrecipitationProbability": "55" 
  200. }, 
  201. { 
  202. "Date": "2016-12-13T07:00:00+08:00", 
  203. "EpochDate": "1481583600", 
  204. "Sun_Rise": "2016-12-13T07:01:00+08:00", 
  205. "Sun_EpochRise": "1481583660", 
  206. "Sun_Set": "2016-12-13T16:45:00+08:00", 
  207. "Sun_EpochSet": "1481618700", 
  208. "PrecipitationProbability": "14" 
  209. } 
  210. ] 
  211. }, 
  212. "today": { 
  213. "cityCode": "2580084", 
  214. "date": "2016-12-09", 
  215. "humidityMax": 86, 
  216. "humidityMin": 45, 
  217. "precipitationMax": 0, 
  218. "precipitationMin": 0, 
  219. "tempMax": 5, 
  220. "tempMin": -2, 
  221. "weatherEnd": "晴", 
  222. "weatherStart": "晴", 
  223. "windDirectionEnd": "北风", 
  224. "windDirectionStart": "西北风", 
  225. "windMax": 4, 
  226. "windMin": 1 
  227. }, 
  228. "yestoday": { 
  229. "cityCode": "2580084", 
  230. "date": "2016-12-08", 
  231. "humidityMax": 93, 
  232. "humidityMin": 60, 
  233. "precipitationMax": 0, 
  234. "precipitationMin": 0, 
  235. "tempMax": 11, 
  236. "tempMin": -1, 
  237. "weatherEnd": "晴", 
  238. "weatherStart": "雾", 
  239. "windDirectionEnd": "西北风", 
  240. "windDirectionStart": "北风", 
  241. "windMax": 4, 
  242. "windMin": 0 
  243. } 
  244. } 

6. 360天气

http://cdn.weather.hao.360.cn/api_weather_info.php?app=hao360&code=101120201
_jsonp= 参数可省略

  1. { 
  2. "time": 1481272775, 
  3. "area": [ 
  4. [ 
  5. "山东", 
  6. "12" 
  7. ], 
  8. [ 
  9. "青岛", 
  10. "1202" 
  11. ], 
  12. [ 
  13. "青岛", 
  14. "101120201" 
  15. ] 
  16. ], 
  17. "weather": [ 
  18. { 
  19. "date": "2016-12-09", 
  20. "info": { 
  21. "day": [ 
  22. "0", 
  23. "晴", 
  24. "6", 
  25. "北风", 
  26. "4-5 级" 
  27. ], 
  28. "night": [ 
  29. "1", 
  30. "多云", 
  31. "0", 
  32. "北风", 
  33. "3-4 级" 
  34. ] 
  35. } 
  36. }, 
  37. { 
  38. "date": "2016-12-10", 
  39. "info": { 
  40. "dawn": [ 
  41. "1", 
  42. "多云", 
  43. "0", 
  44. "北风", 
  45. "3-4 级" 
  46. ], 
  47. "day": [ 
  48. "0", 
  49. "晴", 
  50. "7", 
  51. "北风", 
  52. "3-4 级" 
  53. ], 
  54. "night": [ 
  55. "1", 
  56. "多云", 
  57. "2", 
  58. "南风", 
  59. "3-4 级" 
  60. ] 
  61. } 
  62. }, 
  63. { 
  64. "date": "2016-12-11", 
  65. "info": { 
  66. "dawn": [ 
  67. "1", 
  68. "多云", 
  69. "2", 
  70. "南风", 
  71. "3-4 级" 
  72. ], 
  73. "day": [ 
  74. "0", 
  75. "晴", 
  76. "9", 
  77. "北风", 
  78. "3-4 级" 
  79. ], 
  80. "night": [ 
  81. "1", 
  82. "多云", 
  83. "4", 
  84. "北风", 
  85. "3-4 级" 
  86. ] 
  87. } 
  88. }, 
  89. { 
  90. "date": "2016-12-12", 
  91. "info": { 
  92. "dawn": [ 
  93. "1", 
  94. "多云", 
  95. "4", 
  96. "北风", 
  97. "3-4 级" 
  98. ], 
  99. "day": [ 
  100. "3", 
  101. "阵雨", 
  102. "8", 
  103. "南风", 
  104. "3-4 级" 
  105. ], 
  106. "night": [ 
  107. "3", 
  108. "阵雨", 
  109. "1", 
  110. "南风", 
  111. "4-5 级" 
  112. ] 
  113. } 
  114. }, 
  115. { 
  116. "date": "2016-12-13", 
  117. "info": { 
  118. "dawn": [ 
  119. "3", 
  120. "阵雨", 
  121. "1", 
  122. "南风", 
  123. "4-5 级" 
  124. ], 
  125. "day": [ 
  126. "0", 
  127. "晴", 
  128. "6", 
  129. "北风", 
  130. "5-6 级" 
  131. ], 
  132. "night": [ 
  133. "0", 
  134. "晴", 
  135. "-1", 
  136. "北风", 
  137. "5-6 级" 
  138. ] 
  139. } 
  140. } 
  141. ], 
  142. "pm25": { 
  143. "area": [ 
  144. "青岛", 
  145. "101120201" 
  146. ], 
  147. "pm25": [ 
  148. 47, 
  149. "2016120915" 
  150. ] 
  151. } 
  152. } 

其他

心知天气,彩云天气,和风天气,据说有免费版,具体视情况而定,毕竟人家靠这吃饭;

百度API市场、聚合数据API等市场也有一些免费的,不过需要使用申请他们的key。

参考:
1 天气预报数据API
2 气象API(2)
3【Joytag 小项目】智能小终端,天气预报接口
4 国家气象局提供的天气预报接口(完整Json接口)
5 中国天气预报数据API收集
6 WEATHER API 收集整理

评论(0)
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!