项目开发中需要用到天气信息,但有不适合直接放置气象插件,于是自己找到这个方法:周期性从中国气象网抓取信息保存进数据库,然后显示。 最主要是这几个链接地址,其他的不重要。相信连接地址的规律不用我说也明白了,如不太明白的给我留言。 |
全国省市: | http://m.weather.com.cn/data5/city.xml | |||||
01|北京,02|上海,03|天津,04|重庆,05|黑龙江,06|吉林,07|辽宁,08|内蒙古,09|河北,10|山西,11|陕西,12|山东,13|新疆,14|西藏,15|青海,16|甘肃,17|宁夏,18|河南,19|江苏,20|湖北,21|浙江,22|安徽,23|福建,24|江西,25|湖南,26|贵州,27|四川,28|广东,29|云南,30|广西,31|海南,32|香港,33|澳门,34|台湾 | ||||||
浙江地市: | http://m.weather.com.cn/data5/city21.xml | |||||
2101|杭州,2102|湖州,2103|嘉兴,2104|宁波,2105|绍兴,2106|台州,2107|温州,2108|丽水,2109|金华,2110|衢州,2111|舟山 | ||||||
宁波区县: | http://m.weather.com.cn/data5/city2104.xml | |||||
210401|宁波,210402|慈溪,210403|余姚,210404|奉化,210405|象山,210406|宁海,210407|北仑,210408|鄞州,210409|镇海 | ||||||
获取区县的具体代号: | http://m.weather.com.cn/data5/city210403.xml | |||||
210403|101210404 | ||||||
查询具体区县的气象信息: | http://m.weather.com.cn/data/101210401.html | |||||||||||
http://wmswu.iteye.com/blog/1202028 | ||||||||||||
{"weatherinfo":{"city":"宁波","city_en":"ningbo","date_y":"2012年12月26 日","date":"","week":"星期 三","fchh":"08","cityid":"101210401","temp1":"9℃~8℃","temp2":"10℃~7℃","temp3":"11℃~2℃","temp4":"8℃~0℃","temp5":"4℃~-2℃","temp6":"7℃~-1℃","tempF1":"48.2℉~46.4℉","tempF2":"50℉~44.6℉","tempF3":"51.8℉~35.6℉","tempF4":"46.4℉~32℉","tempF5":"39.2℉~28.4℉","tempF6":"44.6℉~30.2℉","weather1":" 小雨","weather2":"中到大雨","weather3":"小雨转多云","weather4":"小雨转雨夹 雪","weather5":"阴转晴","weather6":" 晴","img1":"7","img2":"99","img3":"22","img4":"99","img5":"7","img6":"1","img7":"7","img8":"6","img9":"2","img10":"0","img11":"0","img12":"99","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":"微风","wind2":"微风","wind3":"微 风","wind4":"微风","wind5":"微风","wind6":"微风","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":"10","st2":"9","st3":"11","st4":"8","st5":"11","st6":"0","index_cl":" 较不宜","index_ls":"不宜","index_ag":"极不易发"}} |
感谢向前跑跑跑跑跑提供的信息,贴子地址:
http://blog.163.com/yuanzhf_2012/blog/static/2112011482012929454663/
作者:jiangsq12345 发表于2013-1-14 16:45:49 原文链接
阅读:9 评论:0 查看评论