國家氣象局提供的天氣預報接口主要有三個,分別是:
http://www.weather.com.cn/data/sk/101010100.html
http://www.weather.com.cn/data/cityinfo/101010100.html
http://m.weather.com.cn/data/101010100.html
其中詳細接口為:http://m.weather.com.cn/data/101010100.html
以下是http://m.weather.com.cn/data/101010100.html接口json格式提供,格式如下
{"weatherinfo":{
//基本信息
//fchh是系統更新時間
"city":"北京","city_en":"beijing","date_y":"2011年10月23 日","date":"辛卯年","week":"星期 日","fchh":"11","cityid":"101010100",
//6天內的溫度
"temp1":"16℃~6℃","temp2":"16℃~3℃","temp3":"16℃~6℃","temp4":"14℃~6℃",
"temp5":"17℃~5℃","temp6":"18℃~8℃",
//6天內華氏度
"tempF1":"60.8℉~42.8℉","tempF2":"60.8℉~37.4℉","tempF3":"60.8℉~42.8℉",
"tempF4":"57.2℉~42.8℉","tempF5":"62.6℉~41℉","tempF6":"64.4℉~46.4℉",
//每日天氣變化
"weather1":" 小雨轉晴","weather2":"晴","weather3":"晴轉陰","weather4":"多雲轉陰","weather5":"陰轉 晴","weather6":"晴轉多 雲",
//天氣描述(圖片序號)
"img1":"7","img2":"0","img3":"0","img4":"99","img5":"0","img6":"2","img7":"1",
"img8":"2","img9":"2","img10":"0","img11":"0","img12":"1","img_single":"7",
//天氣描述(文字描述)
"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":"北風4-5級","wind2":"北風3-4級轉微 風","wind3":"微風","wind4":"微風","wind5":"微風",
"wind6":"微風","fx1":"北 風","fx2":"北風",
//風力描述
"fl1":"4-5級","fl2":"3-4級轉小於3級","fl3":"小於3級","fl4":"小於3 級","fl5":"小於3級","fl6":"小於3級",
//今天穿衣指數
"index":"溫涼","index_d":"較涼爽,建議着夾衣加薄羊毛衫等春秋服 裝。體弱者宜着夾衣加羊毛衫。因晝夜溫差較大,注意增減衣服。",
//48小時內穿衣指數
"index48":"溫涼","index48_d":"較涼爽,建議着夾衣加薄羊毛 衫等春秋服裝。體弱者宜着夾衣加羊毛衫。因晝夜溫差較大,注意增減衣服。",
//紫外線
"index_uv":"最弱","index48_uv":"中 等",
//洗車
"index_xc":"不宜",
//旅游
"index_tr":"適宜",
//人體舒適度
"index_co":"較舒 適",
//未知
"st1":"14","st2":"3","st3":"14","st4":"5","st5":"15","st6":"5",
//晨練
"index_cl":" 較不宜",
//晾衣
"index_ls":"不宜",
//過敏
"index_ag":"極不易發"}}
當天基礎天氣接口
http://www.weather.com.cn/data/cityinfo/101010100.html
以下是http://www.weather.com.cn/data/cityinfo/101010100.html接口提供是Json格式提供,數據如下:
//ptime為系統最后更新時間
{"weatherinfo":{"city":"北 京","cityid":"101010100","temp1":"16℃","temp2":"6℃","weather":"小雨轉 晴","img1":"d7.gif","img2":"n0.gif","ptime":"11:00"}}
當天基礎天氣接口
http://www.weather.com.cn/data/sk/101010100.html
以下是http://www.weather.com.cn/data/sk/101010100.html接口提供是Json格式提供,數據如下:
//temp為攝氏度
//isRadar 應該是雷達返回成功標識
//Radar是雷達編號
//time是該數據更新時間
{"weatherinfo":{"city":"北京","cityid":"101010100","temp":"10","WD":"東北 風","WS":"4 級","SD":"56%","WSE":"4","time":"16:40","isRadar":"1","Radar":"JC_RADAR_AZ9010_JB"}}
數據就這么多。
城市代碼太長就不加在文章中了,請點擊下載