城市代码列表的接口:
http://mobile.weather.com.cn/js/citylist.xml
打开控制台里,将citylist.xml请求右键”SAVE AS”保存下来,或者直接用下载工具也行
xml文件里几乎包含了所有国家的城市数据,可以将其他国家的数据过滤掉,只留下中国的数据
于是我用Java处理了一下
1 | String[] province = new String[]{"北京","天津","河北","山西","内蒙古","辽宁","吉林","黑龙江","上海","江苏","浙江","安徽","福建","江西","山东","河南","湖北","湖南","广东","广西","海南","重庆","四川","贵州","云南","西藏","陕西","甘肃","青海","宁夏","新疆"}; |
生成的Json文件
压缩后的: