分享一个可以获取7天24小时的天气预报API,包含PM2.5等数据

时间:2022-10-28 19:29:41

api地址:

pm2.5 api
http://api.lib360.net/open/pm2.5.json?city=苏州

7天24小时天气api
http://api.lib360.net/open/weather.json?city=苏州

GET请求

参数

prov   可选省份 如:江苏  河北

city 城市名称 如:苏州 上海

返回数据格式json

data 字段 返回7天的天气状况,包含今天

data24 返回 今天24小时内的预报

pm25 返回当前城市的 pm25 值

{
"data" : [{
"AreaID" : "101190401", //地区id
"Year" : 2015, //年
"Month" : 3, //月
"Day" : 19, //日
"Weather" : "阴转小雨", //天气状况
"WeatherICON" : "d02", //天气图标
"TempMax" : 16, //最高温度
"TempMin" : 10, //最低温度
"WindA" : "东北风", //风向
"WindB" : "东风",//风向
"Wind" : "微风", //风速
"Date" : "\/Date(1426694400000)\/" //时间
}, {
"AreaID" : "101190401",
"Year" : 2015,
"Month" : 3,
"Day" : 20,
"Weather" : "小雨转多云",
"WeatherICON" : "d07",
"TempMax" : 14,
"TempMin" : 10,
"WindA" : "东北风",
"WindB" : "东风",
"Wind" : "微风",
"Date" : "\/Date(1426780800000)\/"
}, {
"AreaID" : "101190401",
"Year" : 2015,
"Month" : 3,
"Day" : 21,
"Weather" : "多云",
"WeatherICON" : "d01",
"TempMax" : 19,
"TempMin" : 11,
"WindA" : "西风",
"WindB" : "西风",
"Wind" : "微风",
"Date" : "\/Date(1426867200000)\/"
}, {
"AreaID" : "101190401",
"Year" : 2015,
"Month" : 3,
"Day" : 22,
"Weather" : "多云",
"WeatherICON" : "d01",
"TempMax" : 17,
"TempMin" : 9,
"WindA" : "东风",
"WindB" : "东风",
"Wind" : "3-4级",
"Date" : "\/Date(1426953600000)\/"
}, {
"AreaID" : "101190401",
"Year" : 2015,
"Month" : 3,
"Day" : 23,
"Weather" : "多云转阴",
"WeatherICON" : "d01",
"TempMax" : 14,
"TempMin" : 8,
"WindA" : "东风",
"WindB" : "东风",
"Wind" : "4-5级转微风",
"Date" : "\/Date(1427040000000)\/"
}, {
"AreaID" : "101190401",
"Year" : 2015,
"Month" : 3,
"Day" : 24,
"Weather" : "多云",
"WeatherICON" : "d01",
"TempMax" : 15,
"TempMin" : 6,
"WindA" : "东风",
"WindB" : "东风",
"Wind" : "微风",
"Date" : "\/Date(1427126400000)\/"
}, {
"AreaID" : "101190401",
"Year" : 2015,
"Month" : 3,
"Day" : 25,
"Weather" : "多云",
"WeatherICON" : "d01",
"TempMax" : 15,
"TempMin" : 6,
"WindA" : "东风",
"WindB" : "东风",
"Wind" : "微风",
"Date" : "\/Date(1427212800000)\/"
}
],
"data24" : [{
"AreaID" : "101190401",
"Year" : 2015,
"Month" : 3,
"Day" : 19,
"BeginHour" : 5,
"EndHour" : 8,
"Weather" : "小雨",
"WeatherICON" : "d07",
"TempMax" : 11,
"TempMin" : 11,
"Wind" : "微风",
"WindD" : "东风",
"Date" : "\/Date(1426694400000)\/"
}, {
"AreaID" : "101190401",
"Year" : 2015,
"Month" : 3,
"Day" : 19,
"BeginHour" : 8,
"EndHour" : 11,
"Weather" : "阴",
"WeatherICON" : "d02",
"TempMax" : 14,
"TempMin" : 11,
"Wind" : "微风",
"WindD" : "东北风",
"Date" : "\/Date(1426694400000)\/"
}, {
"AreaID" : "101190401",
"Year" : 2015,
"Month" : 3,
"Day" : 19,
"BeginHour" : 11,
"EndHour" : 14,
"Weather" : "多云",
"WeatherICON" : "d01",
"TempMax" : 16,
"TempMin" : 14,
"Wind" : "微风",
"WindD" : "东北风",
"Date" : "\/Date(1426694400000)\/"
}, {
"AreaID" : "101190401",
"Year" : 2015,
"Month" : 3,
"Day" : 19,
"BeginHour" : 14,
"EndHour" : 17,
"Weather" : "晴",
"WeatherICON" : "d00",
"TempMax" : 16,
"TempMin" : 16,
"Wind" : "微风",
"WindD" : "东北风",
"Date" : "\/Date(1426694400000)\/"
}
],
"datanow" : {
"AreaID" : "101190401",
"Year" : 2015,
"Month" : 3,
"Day" : 19,
"BeginHour" : 14,
"EndHour" : 17,
"Weather" : "晴",
"WeatherICON" : "d00",
"TempMax" : 16,
"TempMin" : 16,
"Wind" : "微风",
"WindD" : "东北风",
"Date" : "\/Date(1426694400000)\/"
},
"pm25" : 133
}

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