1、省份列表:
http://weather.com.cn/data/city3jdata/china.html
2、根据省ID 获取市(地区)列表:
http://weather.com.cn/data/city3jdata/provshi/<id>.html
http://weather.com.cn/data/listinfo/city<sid>.xml
id = 省份ID (101 + 两位数字01~34)
sid = 省份ID 后两位
如:http://weather.com.cn/data/city3jdata/provshi/10111.html
{"01":"西安","02":"咸阳","03":"延安","04":"榆林","05":"渭南","06":"商洛","07":"安康","08":"汉中","09":"宝鸡","10":"铜川","11":"杨凌"}
如:http://weather.com.cn/data/listinfo/city11.xml
1101|西安,1102|咸阳,1103|延安,1104|榆林,1105|渭南,1106|商洛,1107|安康,1108|汉中,1109|宝鸡,1110|铜川,1111|杨凌
3、根据市(地区)ID 获取县列表:
http://weather.com.cn/data/city3jdata/station/<id>.html
http://weather.com.cn/data/listinfo/city<sid>.xml
id = 省份ID + 市(地区)ID
sid = 省份ID 后两位 + 市(地区)ID
如:http://weather.com.cn/data/city3jdata/station/1011101.html
{"01":"西安","02":"长安","03":"临潼","04":"蓝田","05":"周至","06":"户县","07":"高陵"}
如:http://weather.com.cn/data/listinfo/city1101.xml
110101|西安,110102|长安,110103|临潼,110104|蓝田,110105|周至,110106|户县,110107|高陵
4、根据ID,获取天气详情:
详情:http://m.weather.com.cn/data/<id>.html
概要:http://weather.com.cn/data/cityinfo/<id>.html
ID = 省份ID + 市(地区)ID + 县ID
如:http://m.weather.com.cn/data/101110101.html
http://weather.com.cn/data/cityinfo/101110101.html
国外貌似都是以40开头的ID,如 纽约:401110101
http://m.weather.com.cn/data/401110101.html
http://weather.com.cn/data/cityinfo/401110101.html
5、根据城市名、全拼、简拼、电话区号、邮编查询、英文(国外)获取城市对应ID:
包含4个参数,callback、_、language、keyword
calkback:若为空,则返回json格式,否则返回callback的jsonp;
_:时间戳,精确到毫秒,js可以直接输出这个值;
language:语言,可选 zh|en ,默认 zh;
keyword:关键词,可输入城市名、全拼、简拼、电话区号、邮编查询。如 ny 返回:
{"f":[{"n":"纽约","m":"NY","d":"美国","i":"401110101","t":"f"}],"i":[{"n":"南阳","m":"NY","d":"河南","i":"101180701","t":"i"},{"n":"南岳","m":"NY","d":"湖南","i":"101250409","t":"i"},{"n":"纳雍","m":"NY","d":"贵州","i":"101260706","t":"i"},{"n":"宁阳","m":"NY","d":"山东","i":"101120806","t":"i"},{"n":"宁远","m":"NY","d":"湖南","i":"101251406","t":"i"}]}
6、通过IP获取城市id:
返回:
var ip="113.140.7.122";var id=101110101;if(typeof(id_callback)!="undefined"){id_callback();}
7、xml天气
http://flash.weather.com.cn/wmaps/xml/china.xml
各省份列表及天气。
http://flash.weather.com.cn/wmaps/xml/<pname>.xml
市级天气信息。
转载请保留出处,thanks