分享一个免费返回天气及空气质量的API

这几天在做一个app玩,学nodejs

找到一个开放的天气及空气质量的API

不需要KEY什么的,仅供学习哦

api地址:

1 pm2.5 api
2 http://api.lib360.net/open/pm2.5.json?city=苏州
3 
4 7天24小时天气api
5 http://api.lib360.net/open/weather.json?city=苏州

GET请求

参数

1 prov   可选省份 如:江苏  河北
2 
3 city   城市名称 如:苏州 上海

返回数据格式json

1 data 字段 返回7天的天气状况,包含今天
2 
3 data24 返回 今天24小时内的预报 
4 
5 pm25 返回当前城市的 pm25 值
  1 {
  2     "data" : [{
  3             "AreaID" : "101190401",  //地区id
  4             "Year" : 2015, //年
  5             "Month" : 3,  //月
  6             "Day" : 19, //日
  7             "Weather" : "阴转小雨", //天气状况
  8             "WeatherICON" : "d02",  //天气图标
  9             "TempMax" : 16,  //最高温度 
 10             "TempMin" : 10,  //最低温度
 11             "WindA" : "东北风", //风向
 12             "WindB" : "东风",//风向
 13             "Wind" : "微风", //风速
 14             "Date" : "\/Date(1426694400000)\/"  //时间
 15         }, {
 16             "AreaID" : "101190401",
 17             "Year" : 2015,
 18             "Month" : 3,
 19             "Day" : 20,
 20             "Weather" : "小雨转多云",
 21             "WeatherICON" : "d07",
 22             "TempMax" : 14,
 23             "TempMin" : 10,
 24             "WindA" : "东北风",
 25             "WindB" : "东风",
 26             "Wind" : "微风",
 27             "Date" : "\/Date(1426780800000)\/"
 28         }, {
 29             "AreaID" : "101190401",
 30             "Year" : 2015,
 31             "Month" : 3,
 32             "Day" : 21,
 33             "Weather" : "多云",
 34             "WeatherICON" : "d01",
 35             "TempMax" : 19,
 36             "TempMin" : 11,
 37             "WindA" : "西风",
 38             "WindB" : "西风",
 39             "Wind" : "微风",
 40             "Date" : "\/Date(1426867200000)\/"
 41         }, {
 42             "AreaID" : "101190401",
 43             "Year" : 2015,
 44             "Month" : 3,
 45             "Day" : 22,
 46             "Weather" : "多云",
 47             "WeatherICON" : "d01",
 48             "TempMax" : 17,
 49             "TempMin" : 9,
 50             "WindA" : "东风",
 51             "WindB" : "东风",
 52             "Wind" : "3-4级",
 53             "Date" : "\/Date(1426953600000)\/"
 54         }, {
 55             "AreaID" : "101190401",
 56             "Year" : 2015,
 57             "Month" : 3,
 58             "Day" : 23,
 59             "Weather" : "多云转阴",
 60             "WeatherICON" : "d01",
 61             "TempMax" : 14,
 62             "TempMin" : 8,
 63             "WindA" : "东风",
 64             "WindB" : "东风",
 65             "Wind" : "4-5级转微风",
 66             "Date" : "\/Date(1427040000000)\/"
 67         }, {
 68             "AreaID" : "101190401",
 69             "Year" : 2015,
 70             "Month" : 3,
 71             "Day" : 24,
 72             "Weather" : "多云",
 73             "WeatherICON" : "d01",
 74             "TempMax" : 15,
 75             "TempMin" : 6,
 76             "WindA" : "东风",
 77             "WindB" : "东风",
 78             "Wind" : "微风",
 79             "Date" : "\/Date(1427126400000)\/"
 80         }, {
 81             "AreaID" : "101190401",
 82             "Year" : 2015,
 83             "Month" : 3,
 84             "Day" : 25,
 85             "Weather" : "多云",
 86             "WeatherICON" : "d01",
 87             "TempMax" : 15,
 88             "TempMin" : 6,
 89             "WindA" : "东风",
 90             "WindB" : "东风",
 91             "Wind" : "微风",
 92             "Date" : "\/Date(1427212800000)\/"
 93         }
 94     ],
 95     "data24" : [{
 96             "AreaID" : "101190401",
 97             "Year" : 2015,
 98             "Month" : 3,
 99             "Day" : 19,
100             "BeginHour" : 5,
101             "EndHour" : 8,
102             "Weather" : "小雨",
103             "WeatherICON" : "d07",
104             "TempMax" : 11,
105             "TempMin" : 11,
106             "Wind" : "微风",
107             "WindD" : "东风",
108             "Date" : "\/Date(1426694400000)\/"
109         }, {
110             "AreaID" : "101190401",
111             "Year" : 2015,
112             "Month" : 3,
113             "Day" : 19,
114             "BeginHour" : 8,
115             "EndHour" : 11,
116             "Weather" : "阴",
117             "WeatherICON" : "d02",
118             "TempMax" : 14,
119             "TempMin" : 11,
120             "Wind" : "微风",
121             "WindD" : "东北风",
122             "Date" : "\/Date(1426694400000)\/"
123         }, {
124             "AreaID" : "101190401",
125             "Year" : 2015,
126             "Month" : 3,
127             "Day" : 19,
128             "BeginHour" : 11,
129             "EndHour" : 14,
130             "Weather" : "多云",
131             "WeatherICON" : "d01",
132             "TempMax" : 16,
133             "TempMin" : 14,
134             "Wind" : "微风",
135             "WindD" : "东北风",
136             "Date" : "\/Date(1426694400000)\/"
137         }, {
138             "AreaID" : "101190401",
139             "Year" : 2015,
140             "Month" : 3,
141             "Day" : 19,
142             "BeginHour" : 14,
143             "EndHour" : 17,
144             "Weather" : "晴",
145             "WeatherICON" : "d00",
146             "TempMax" : 16,
147             "TempMin" : 16,
148             "Wind" : "微风",
149             "WindD" : "东北风",
150             "Date" : "\/Date(1426694400000)\/"
151         }
152     ],
153     "datanow" : {
154         "AreaID" : "101190401",
155         "Year" : 2015,
156         "Month" : 3,
157         "Day" : 19,
158         "BeginHour" : 14,
159         "EndHour" : 17,
160         "Weather" : "晴",
161         "WeatherICON" : "d00",
162         "TempMax" : 16,
163         "TempMin" : 16,
164         "Wind" : "微风",
165         "WindD" : "东北风",
166         "Date" : "\/Date(1426694400000)\/"
167     },
168     "pm25" : 133
169 }

 

转载自:http://segmentfault.com/a/1190000002607883

posted @ 2016-01-07 16:27  小马哥的代码学习  阅读(1124)  评论(1编辑  收藏  举报