首页 > 代码库 > 中国天气预报数据API收集

中国天气预报数据API收集

想做天气APP,数据只能从别的地方接入了,以前Google的API不错,不过人家关了都不带告诉你,关了就关了,既不事先通知,事后也不发表声明!雅虎的以前还可以,现在的数据原来越少,越来越没用,所以,只能依靠天朝。本文章只供测试,如果有商业应用,请申请正规的API接口,因使用接口引起的商业纠纷与本人无关

涨姿势:

1.中央气象台:全国预报、气候预测、气候变化研究、气象信息收集分发服务的国家中心。

2.中国气象局:国务院直属事业单位。前身是中央军委气象局。承担全国气象工作的政府行政管理职能,负责全国气象工作的组织和管理。国家气象中心:(中央气象台)是中国气象局的直属事业代为之一。

3.中央气象局:这是政府机关,中央气象台是他的直属事业单位。气象局里的大都是公务员,气象台里的大都不是公务员。



天气预报只有当天和未来几天的数据接口,如果想知道历史天气,我还没找到哦。

中央气象局台的天气数据API接口有三个:

1:http://www.weather.com.cn/data/sk/101010100.html

[mw_shl_code=java,true]{"weatherinfo":{"city":"北京","cityid":"101010100","temp":"22","WD":"北风","WS":"2级","SD":"19%","WSE":"2","time":"16:05","isRadar":"1","Radar":"JC_RADAR_AZ9010_JB"}}[/mw_shl_code]


2:http://www.weather.com.cn/data/cityinfo/101010100.html

[mw_shl_code=java,true]{"weatherinfo":{"city":"北京","cityid":"101010100","temp1":"24℃","temp2":"11℃","weather":"雷阵雨转多云","img1":"d4.gif","img2":"n1.gif","ptime":"11:00"}}[/mw_shl_code]


3:http://m.weather.com.cn/data/101110101.html

{"weatherinfo":{"city":"西安","city_en":"xian","date_y":"2014年3月4日","date":"","week":"星期二","fchh":"11","cityid":"101110101","temp1":"13℃~3℃","temp2":"8℃~2℃","temp3":"8℃~3℃","temp4":"7℃~1℃","temp5":"13℃~3℃","temp6":"14℃~4℃","tempF1":"55.4℉~37.4℉","tempF2":"46.4℉~35.6℉","tempF3":"46.4℉~37.4℉","tempF4":"44.6℉~33.8℉","tempF5":"55.4℉~37.4℉","tempF6":"57.2℉~39.2℉","weather1":"多云","weather2":"小雨","weather3":"阴转小雨","weather4":"小雨转阴","weather5":"多云","weather6":"多云","img1":"1","img2":"99","img3":"7","img4":"99","img5":"2","img6":"7","img7":"7","img8":"2","img9":"1","img10":"99","img11":"1","img12":"99","img_single":"1","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级","wind2":"东风小于3级","wind3":"东风小于3级","wind4":"东风小于3级","wind5":"东风小于3级","wind6":"东风小于3级","fx1":"东风","fx2":"东风","fl1":"小于3级","fl2":"小于3级","fl3":"小于3级","fl4":"小于3级","fl5":"小于3级","fl6":"小于3级","index":"冷","index_d":"天气冷,建议着棉服、羽绒服、皮夹克加羊毛衫等冬季服装。年老体弱者宜着厚棉衣、冬大衣或厚羽绒服。","index48":"较冷","index48_d":"建议着厚外套加毛衣等服装。年老体弱者宜着大衣、呢外套加羊毛衫。","index_uv":"最弱","index48_uv":"最弱","index_xc":"不宜","index_tr":"适宜","index_co":"较舒适","st1":"13","st2":"3","st3":"6","st4":"2","st5":"9","st6":"3","index_cl":"较适宜","index_ls":"基本适宜","index_ag":"极易发"}}

 

这个的数据比上面两个丰富得多,只可惜,不稳定的,而且从今年3月4号开始数据不更新了,解释是去智慧天气(http://smart.weather.com.cn/)申请试用免费的api,但是所谓免费,也只是暂定免费,后面会不会收费就不得而知了。


综合三个API,前两个数据太单薄,而且是是实时天气,没有未来的几天天气数据,满足不了需求,以前通用的第三个也不能用。对了,中国气象局的API有免费和收费模式,免费的有次数限制,用不起。如果有钱也不用,要花钱的话直接用心知天气的SDK岂不是更方便,不过真的是不便宜。去看看价格吧http://www.thinkpage.cn/weather/pricing.aspx


不要灰心,总有能用的,不然那么多APP怎么来的数据

http://www.weather.com.cn/data/zs/101010100.html


中华万年历:

http://wthrcdn.etouch.cn/weather_mini?city=北京
通过城市名字获得天气数据,json数据
http://wthrcdn.etouch.cn/weather_mini?citykey=101010100
通过城市id获得天气数据,json数据


金山导航:

http:\\pm25.moji001.com\aqi\index-1623.html   


小米:

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


中央天气预报:

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

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



别的地址:

http://wthrcdn.etouch.cn/WeatherApi?citykey=101010100
通过城市id获得天气数据,xml文件数据,
当错误时会有<error>节点
http://wthrcdn.etouch.cn/WeatherApi?city=北京
通过城市名字获得天气数据,xml文件数据















中国天气预报数据API收集