中国天气网 接口
www.weather.com.cn
请求链接
http://m.weather.com.cn/data/101200101.html 数据页面
101200101 为武汉的城市代码
由 http://61.4.185.48:81/g/ 得到本机访问的IP,根据此IP查询到城市ID,
var ip="61.183.248.221";var id=101200101;if(typeof(id_callback)!="undefined"){id_callback();}。
再根据城市ID返回该城市天气信息
总结:1. http://61.4.185.48:81/g/ 得到城市id
2. 根据城市id 例如:101200101 请求: http://m.weather.com.cn/data/101200101.html
返回接口说明
[list=1]city "北京" //城市名称 city_en "beijing"//应为名称 date_y "2011年10月18日"//当前日期 date "辛卯年"//阴历年 week "星期二"//星期几 fchh "18"//不详 cityid "101010100"//城市编码 //这里的温度 在下午更新后是这样的, 具体的更新点儿有待补上(下午好像是18点左右,白天的自己研究去吧 哈哈) //当那个更新点未到达之前是这样的:"temp1":"19℃~12℃", 也就是今天的最高温和最低温,也就是每天都会有个最高温和最低温,就看是那个点更新的数据了…. temp1 "10℃~19℃"//当前日期是18日那这第一个的温度为19日凌晨到19日中午是的温度,下面以此类推 temp2 "12℃~20℃" temp3 "11℃~21℃" temp4 "11℃~19℃" temp5 "13℃~18℃" temp6 "10℃~17℃" tempF1 "50℉~66.2℉"//华氏温度 同上 tempF2 "53.6℉~68℉" tempF3 "51.8℉~69.8℉" tempF4 "51.8℉~66.2℉" tempF5 "55.4℉~64.4℉" tempF6 "50℉~62.6℉" weather1 "晴转阴"//同温度一样也是19日凌晨也可以说成是18日23:59:59秒//下面类推 weather2 "阴转多云" weather3 "多云转晴" weather4 "晴转多云" weather5 "阴" weather6 "多云" img1 "0"//对应的显示图片编号 img2 "2" img3 "2" img4 "1" img5 "1" img6 "0" img7 "0" img8 "1" img9 "2" img10 "99"//这个就不对了不知道为啥 img11 "1" img12 "99" img_single "2" img_title1 "晴"//18日夜间 img_title2 "阴"//19日白天 img_title3 "阴"//19日夜间 img_title4 "多云"//20日白天 img_title5 "多云"//20日夜间 一次类推 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 "小于3级"//风力 fl2 "小于3级" fl3 "小于3级" fl4 "小于3级" fl5 "小于3级" fl6 "小于3级" //这里的这些生活指数也是和上面的更新点有关系 18点左右更新的就是明天的生活指数了哈哈 index "舒适"//舒适度指数 index_d "建议着薄型套装或牛仔衫裤等春秋过渡装。年老体弱者宜着套装、夹克衫等。 //对应的描述 index48 "暖"///这2个不清楚了 index48_d "较凉爽,建议着长袖衬衫加单裤等春秋过渡装。年老体弱者宜着针织长袖衬衫、马甲和长裤。" index_uv "最弱"//紫外线指数 index48_uv "弱" index_xc "适宜"//洗车指数 index_tr "很适宜"//旅游指数 index_co "舒适"//舒适度指数 st1 "20" st2 "11" st3 "20" st4 "11" st5 "20" st6 "11" index_cl "较适宜"//晨练指数 index_ls "不太适宜"//晾晒指数 index_ag "不易发"// 息斯敏过敏气象指数 图片接口
http://m.weather.com.cn/img/c0.gif
http://m.weather.com.cn/img/b0.gif
http://www.weather.com.cn/m/i/weatherpic/29x20/d0.gif
http://www.weather.com.cn/m2/i/icon_weather/29x20/n00.gif
这个图就是天气现象0(晴)的图片,其他天气现象的图片依此类推。c打头的图片是20*20像素的,b打头的是50*46像素的,d打头的是反白的图标,29*20像素,n打头的是夜间反白图标,29*20像素,注意这里的文件名是两位数字!