Traditional Culture Encyclopedia - Weather inquiry - The weather is Dongli.

The weather is Dongli.

I have done related apps before, found them online and pasted them directly. Please adopt it if it is useful ~

Weather forecast interface provided by National Weather Service.

Interface address:

/data/sk/ 10 10 10 100 . html

/data/city info/ 10 10 10 100 . html

/data/ 10 10 10 100 . html

For the third interface, the returned information is comprehensive and provided in json format, and the format is as follows.

{"weatherinfo": {// Basic information; "City": "Beijing", "city _ en": "Beijing", "date _ y": "20 12 February 16", "date": "week": "Thursday", "fchh": "60." City ID ":"1010100 ",//Celsius temperature" temp 1": "2℃ ~-7℃, "temp2": "/kloc- Tempf 1": "35.6 ~ 19.4 ","tempf2": "33.8 ~ 19.4 ","tempf3": "39.2 ~ 19.4 "," "weather2": "sunny", "weather3": "sunny", "weather4": "sunny". " img3": "0 "," img4": "99 "," img5": "0 "," img6": "99 "," img7": "0 "," img8": " 1 "," img9": "655。 "img_title 1": "Qing "," img_title2": "Qing "," img_title3": "Qing "," img_title4": "Qing "," img_title5": "Qing ", "img_title6 ":"img_title9": "cloudy", "img_title 10": "cloudy", "img_title 1 1": "cloudy", "img_title/kloc-0. //wind speed description: "wind 1": "north wind level 3-4 turns to breeze", "wind2": "breeze", "wind3": "breeze", "wind4": "breeze", "wind5": "breeze", "wind6": "breeze" FL1":"Grade 3-4 is less than Grade 3 ","fl2 ":"Less than Grade 3 ","fl3 ":"Less than Grade 3 ","fl4 ":"Less than Grade 3 ","fl5 ":"Less than Grade 3 "and" fl6 ":"Less than Grade 3 " Old and infirm people should wear thick cotton-padded clothes or winter clothes. //48 hours dressing index "index48": "cold", "index48_d": "It's cold, so it's recommended to wear winter clothes such as cotton-padded clothes, leather jackets and sweaters. Old and infirm people should wear thick cotton-padded clothes or winter clothes. ",//UV and 48-hour UV "index_uv": "weak", "index48_uv": "weak", "//car wash" index_xc ":"suitable ","//travel "index_tr": "general",//comfort index "index _ "st3": "2", "st4": "-4", "st5": "5", "st6": "-5",//morning exercise "index_cl": "not suitable",//air drying "index_ls": "basically suitable".

The city code of China is as follows:

Beijing:1010100 Chaoyang: 10 10300 Shunyi:10/kloc-0. Kloc-0/ 1 100 Fangshan:101200 Miyun:101010. 1 1500 Badaling:1011600 foyeding:101/kloc-0- 900 Zhaitang: 6543838+001030100 Baodi:1kloc-0/030300 Dongli:1kloc-0/030400 West. Sell: 10 1030800 Jinghai:10/030900 Jinnan: 10 103 1000 Tanggu:/kloc-0. +00 1030200 ninghe: 10 1030700 Shanghai: 1020 100 Baoshan: 10 1020300 Jiading: Kloc-0/200 Minhang: 10 1020200 Jinshan: 10109010/Zhangjiakou: 0402 Tangshan: Kloc-0/ 18030 1 Xuchang:10/80401Pingdingshan:10165438+1Pingdingshan. Kaifeng 5438+0011810/Hebi:10/0/81201Puyang:/kloc-0. +08 140 1 Luohe:101Zhumadian:101816000. 5438+00 1181801Anyang: 10 18020 1 Hefei:10/kloc-. 0654438 122090 1 Huangshan:10/221001Chuzhou:10122/kloc. 22 130 1 Xuancheng:101401Lu' an:101221. +070 1 Bengbu: 10 122020 1 Hangzhou: 1 010/Zhoushan:/kloc-0. 06554380 1 Chongqing:10/040100 Hechuan: 10 1040300 Nanchuan:10/kloc-0. 0040700 Beibei: 10 1040800 Banan: 10 1040900 Longevity:10/041000 Qianjiang: 00 Wanzhou Longbao: 10 104 1300 Fuling: 10 104 1400 Kaixian:10/04. 700 Wuxi: 10 104 1800 Fengjie: 10 1042000 Wushan:10/kloc-0. 0 1042300 Zhongxian: 10 1042400 Shizhu:10/042500 Dazu:1kloc-0/042600 Rongchang: 0042900 Fengdu: 10 1043000 Wulong: 1043 100 Pengshui:1kloc-0/043200 Qijiang:/kloc-. 043600 Shapingba: 10 1043700 Yongchuan:1kloc-0/040200 Fuzhou:101230/kloc-0. Longyan: 10 123070 1 Jinjiang: 10 1230509 Nanping: 10 123090 1 Xiamen 8+00 123040 1 Sanming:10/230801Lanzhou:1160/kloc. 438+06040 1 Wuwei:10/60501Jinchang: 10 160 1 Jiayuguan:1060. 438+06080 1 Tianshui: 65438+ 00 16090 1 Wudu:101616. 001161201Silver:10130/dingxi:10165433. 5438+00 1 280 10 1 Huizhou: 128030 1 Meizhou: 10 128040 1 Meizhou. 2807065438438+0 Dongguan:101281kloc-0/Zhongshan:10170/Yangjiang:/kloc-. : 10 128200 1 Shanwei:1kloc-0/2821Shaoguan:10128020/kloc-. 30 1 guest: 10 130040 1 Guilin:1kloc-0/300501Wuzhou:10/kloc. 8+030080 1 Yulin:10/300901Baise:10/01Qinzhou:10. 0 1 Beihai:101301Chongzuo: 10 130020 1 Hezhou:/kloc- 126030 1 Duyun: 1065438+ 0 Xingyi:10/260906 Tongren: 10 1 26060/kloc. 260260206 129060 1 Yuxi:10/290701Chuxiong:10129080/kloc-0. 8+00 129 1 1 Nujiang:1kloc-0/291201Shangri-La:10/kloc-0. 38+001291501Jinghong: 10 129 1 Dali:10129020/. 438+0 Hohhot:10101Wuhai: 108030 1 Jining:10/kloc-0. Kloc-0/01081Kloc-0/Baotou: 10 108020 1 Chifeng:10108060. 8+024030 1 Fuzhou:10/240401Yichun: 10 124050 1 yingtan:1. Pingxiang: 65438+38+000 1 Shiyan: 10 120 1 Shennongjia:10/kloc-0. 38+040 1 Tianmen:10/201Xiantao: 10 120 1 601Qianjiang:/kloc. Ezhou: 10 120030 1 Xiaogan:1kloc-0/Huangshi:10/200601Xianning:/kloc. 438+0 Zigong: 10 127030 1 Mianyang: 10 127040 1 Nanchong:10/20. 27+027 160 1 Yaan:101271701Ganzi:10127/kloc. 1 Guangyuan:10127210/Panzhihua: 10 127020 1 Yinchuan:1Yinchuan. 0 Guyuan:101170401Shizuishan:1kloc-0/70201Wuzhong:10/kloc-. 0 Huangnan:101150301Haibei: 10 15080 1 Guoluo:10/kloc-. 38+001150701Haidong:1kloc-0/50201Hainan:10/kloc-0. 8+001120601Linyi:1kloc-0/1Heze:1010000. 38+0 Dongying:10121201Weihai:121Zaozhuang Kloc-0/ 12030 1 Dezhou: 1065438+ 0 1 Yantai:1012050/Kloc-0. 0 12080 1 Xi 'an:10101Yan 'an:101008. 38+00111Shangluo:1011060/Ankang:1060. 1080 1 Baoji:101Xianyang:101kloc-0//kloc- 38+010010/Linfen: 10 10070 1 Yuncheng:1010080/kloc. 8+01010/Changzhi:101Datong:101Yangquan. +0 10040 1 Jincheng:1010060/Lvliang:1010/kloc-0. +001130301Changji:101Turpan:1013050. 5438+0 13070 1 Aksu:101Kashgar:1013090/kloc-. 5438+01311Hami:10/0/31201Hotan:1. 8+040 1 Artux:101131501Bole:101. +014010/Shannan: 1065438+ 0 1 Ali:1014070/. 0 14060 1 shigatse: 10 14020 1 Linzhi:1014040/kloc-. 0 1 taichung: 10 134040 1 Haikou:10/01sanya:1. 438+00 13 10203 Chengmai:1kloc-0/0204 Danzhou: 10 13 10205 Changjiang:. Kloc-0/02 12 Baoting:10140,000 Ning: 10 102 15 Lingshui:/Kloc-0. Kloc-0/0 1 Zhuzhou: 10 125030 1 Hengyang: 10 125040 1 Chenzhou:1. : 10 1250700 Loudi: 10 125080 1 shaoyang: 10 125090 1 Yueyang: +00 1 Huaihua:101251qianyang:10125/kloc-0. 8+0 Xiangtan: 10 125020 1 Nanjing:11901Zhenjiang:1065438+. Yangzhou 38+020 1 Wuxi:10/90201Yancheng: 10 19070 1 Harbin:1060. +0 Jiamusi: 10 105040 1 Suihua: 105050 1 Heihe:10/Shuangyashan: 65438. 80 1 Daqing: 10 105090 1 Qitaihe: 10 105 1002 Jixi:10/kloc. Er:101050201Daxinganling:1kloc-0/050701Changchun:101060/kloc. 5438+0 Baishan: 10 106090 1 Baicheng: 1060 1 Liaoyuan:10/kloc-0. 438+0 Tonghua: 10 106050 1 Shenyang: 10 1070 1 Anshan:10/kloc-0. 050 1 Dandong: 10 107060 1 Huludao: 107 140 1 Yingkou:10/kloc-.

1.xmlinterface/wmaps/XML/China.xml This is the root node of national weather, which lists all provinces, and the pyName field is the XML file name of each province. For example, Beijing is Beijing, which means that the XML address of Beijing is /wmaps/xml/beijing.xml, which lists the weather of a province, and Beijing lists all districts. Tmp 1 is the lowest temperature, tmp2 is the highest temperature, and url is very important. We'll talk later. What are State 1 and state2? Each number represents a weather phenomenon. There are many weather phenomena. I originally wanted to analyze them all, but later I gave up the idea directly. Because I saw the weather phenomenon code of a city is 26 ... what I know now is 0. sunny 1。 Cloudy 2. Cloudy 6. Sleet 7. Xiaoyu 8. Moderate rain 13. Snow shower 14. Xiaoxue, later found it useless. The main function of this number is to retrieve pictures! ! !

2. Picture interface/img/c0.gif/img/b0.gif/m/i/weatherpic/29x20/d0.gif/m2/i/icon _ weather/29x20/n00.gif This picture shows weather phenomenon 0 (sunny day), and so on for other weather phenomena. The picture at the beginning of C is 20*20 pixels, the picture at the beginning of B is 50*46 pixels, the picture at the beginning of D is an anti-white icon with 29*20 pixels, and the picture at the beginning of N is an anti-white icon at night with 29*20 pixels. Note that the file name here is two digits! Maybe there are more icons waiting for you to find ~

3.JSON interface I didn't realize there was a JSON interface. Analyzing JSON on iPhone is much simpler than XML. /data/101065438.html This is the JSON data of Beijing. According to the url in the XML above, get the name of that HTML. This JSON contains real-time data, 7-day weather forecast, meteorological index and other rich data.

Get the province code: /data/list3/city.xml? Level= 1 get the city code (for example, Anhui is 22):/data22):/data/list3/city22.xml? Level=2 Get the area code (for example, Anqing is 2206):/data2206):/data/list3/city2206.xml? Level=3 The code of Wangjiang County, Anqing City, Anhui Province is 220607, and then add China code to request URL:/data/101220607.html to get the local weather.

In addition, several useful websites are given: weather flash live broadcast:/sk2/10/kloc-0.xml live broadcast flash: /sk2/shikuang.swf? id= 10 1220607

Three-level selection menu (note that there are four inputs here, one of which is hidden, so you can modify the source code and view it with FIREFOX):/static/static/custom/search3.htm.

Real-time weather (very useful):/data/sk/101220607.html.

1.XML interface

/wmaps/xml/china.xml

This is the root node of national weather, which lists all provinces, where the pyName field is the XML file name of each province. For example, Beijing is Beijing, which means that the XML address of Beijing is

/wmaps/xml/beijing.xml

The weather of a province, which lists the data of cities in the province, lists all the districts in Beijing.

Tmp 1 is the lowest temperature, tmp2 is the highest temperature, and url is very important. We'll talk later. What are State 1 and state2? Each number represents a weather phenomenon. There are many weather phenomena. I originally wanted to analyze them all, but later I gave up the idea directly. Because I saw the weather phenomenon code of a city is 26 ... what I know now is 0. sunny 1。 Cloudy 2. Cloudy 6. Sleet 7. Xiaoyu 8. Moderate rain 13. Snow shower 14. Xiaoxue

Later, I found it useless to know this. The main function of this number is to retrieve pictures! ! !

2. Picture interface

/img/c0.gif

/img/b0.gif

/m/i/weatherpic/29x20/d0.gif

/m2/I/icon _ weather/29x 20/n00 . gif

This picture is a picture of weather phenomenon 0 (sunny day), and other weather phenomena are analogized. The picture at the beginning of C is 20*20 pixels, the picture at the beginning of B is 50*46 pixels, the picture at the beginning of D is an anti-white icon with 29*20 pixels, and the picture at the beginning of N is an anti-white icon at night with 29*20 pixels. Note that the file name here is two digits!

3.JSON interface

/data/ 10 10 10 100 . html/data/sk/ 10 10 100 . html/data/city info/ 10 100 . html