Warrior Sun

内蒙古强网电子科技有限公司

导航

如何得到天气情况?在那个接口获取?

Posted on 2015-10-24 22:33  Warrior Sun  阅读(1473)  评论(0编辑  收藏  举报

据我所知,气象局提供三个天气查询接口,如下:


1、实时天气接口
地址:http://www.weather.com.cn/data/ sk/【城市代码】.html
例如:查询北京实时天气:
http://www.weather.com.cn/data/sk/101010100.html
结果:
{"weatherinfo":{"city":"北京","cityid":"101010100","temp":"13","WD":"南风","WS":"2","SD":"59%","WSE":"2","time":"10:30","isRadar":"1","Radar":"JC_RADAR_AZ9010_JB”}}


2、今日天气接口
地址:http://www.weather.com.cn/data/cityinfo/【城市代码】.html
例如:查询北京今日天气:
http://www.weather.com.cn/data/cityinfo/101010100.html
结果:
{"weatherinfo":{"city":"北京","cityid":"101010100","temp1":"15","temp2":"5℃","weather":"阵雨转阴","img1":"d3.gif","img2":"n2.gif","ptime":"08:00”}
}

  3、今日及未来天气接口【内容最详细】
地址:http://m.weather.com.cn/data/【城市代码】.html
例如:查询北京今日及未来天气:
http://m.weather.com.cn/data/101010100.html
结果:
{"weatherinfo":{"city":"北京","city_en":"beijing","date_y":"2013年10月22日","date":"",
"week":"星期二","fchh":"08","cityid":"101010100","temp1":"15℃~5℃","temp2":"15℃~4℃……
…【省略】"index_tr":"适宜","index_co":"较舒适",
"st1":"11","st2":"1","st3":"13","st4":"5","st5":"14","st6":"4","index_cl":"较不宜",
"index_ls":"不太适宜","index_ag":"不易发"}}