http://www.weather.com.cn/data/sk/101010100.html
http://www.weather.com.cn/data/cityinfo/101010100.html
http://m.weather.com.cn/data/101010100.html
这三个已经停用,数据不再更新,即使修改Referer,得到的已经不是正确的信息。
一、调用规范 规范用于指导三方合作伙伴合理调用指数、3天常规预报(24小时)预报服务数据。
请求方式:http get
接口组成:由固定URL加5个不同的参数组成,完整URL需客户端经过固定方式加密后使用。
数据返回:json
完整URL:http://open.weather.com.cn/data/?areaid=""&type=""&date=""&appid=""&key=".urlencode($key);
固定URL:http://open.weather.com.cn/data/
需要申请ID
返回数据:
{
"c": {
"c1": "101010100",
"c2": "beijing",
"c3": "北京",
"c4": "beijing",
"c5": "北京",
"c6": "beijing",
"c7": "北京",
"c8": "china",
"c9": "中国",
"c10": "1",
"c11": "010",
"c12": "100000",
"c13": 116.391000,
"c14": 39.904000,
"c15": "33",
"c16": "AZ9010",
"c17": "+8"
},
"f": {
"f1": [{
"fa": "",
"fb": "01",
"fc": "",
"fd": "13",
"fe": "",
"ff": "0",
"fg": "",
"fh": "0",
"fi": "05:17|19:05"
},
{
"fa": "01",
"fb": "00",
"fc": "28",
"fd": "15",
"fe": "0",
"ff": "0",
"fg": "0",
"fh": "0",
"fi": "05:16|19:06"
},
{
"fa": "00",
"fb": "01",
"fc": "31",
"fd": "15",
"fe": "0",
"ff": "0",
"fg": "0",
"fh": "0",
"fi": "05:15|19:07"
}],
"f0": "201604281800"
}
}
================================================================================
抓包中华万年历得到的接口(JSON):
http://wthrcdn.etouch.cn/weather_mini?city=北京
通过城市名字获得天气数据,json数据
http://wthrcdn.etouch.cn/weather_mini?citykey=101010100
通过城市id获得天气数据,json数据
数据和中国天气网(www.weather.com.cn)一致
数据:
{
"desc": "OK",
"status": 1000,
"data": {
"wendu": "22",
"ganmao": "各项气象条件适宜,无明显降温过程,发生感冒机率较低。",
"forecast": [{
"fengxiang": "南风",
"fengli": "3-4级",
"high": "高温 26℃",
"type": "多云",
"low": "低温 13℃",
"date": "28日星期四"
},
{
"fengxiang": "无持续风向",
"fengli": "微风级",
"high": "高温 28℃",
"type": "多云",
"low": "低温 15℃",
"date": "29日星期五"
},
{
"fengxiang": "无持续风向",
"fengli": "微风级",
"high": "高温 31℃",
"type": "晴",
"low": "低温 15℃",
"date": "30日星期六"
},
{
"fengxiang": "无持续风向",
"fengli": "微风级",
"high": "高温 29℃",
"type": "多云",
"low": "低温 20℃",
"date": "1日星期天"
},
{
"fengxiang": "北风",
"fengli": "4-5级",
"high": "高温 26℃",
"type": "小到中雨",
"low": "低温 13℃",
"date": "2日星期一"
}],
"yesterday": {
"fl": "微风",
"fx": "无持续风向",
"high": "高温 19℃",
"type": "小雨",
"low": "低温 12℃",
"date": "27日星期三"
},
"aqi": "118",
"city": "北京"
}
}
http://wthrcdn.etouch.cn/WeatherApi?citykey=101010100
通过城市id获得天气数据,xml文件数据,数据:
<resp>
<city>北京city>
<updatetime>18:45updatetime>
<wendu>22wendu>
<fengli>2级fengli>
<shidu>33%shidu>
<fengxiang>东南风fengxiang>
<sunrise_1>05:19sunrise_1>
<sunset_1>19:06sunset_1>
<sunrise_2/>
<sunset_2/>
<environment>
<aqi>118aqi>
<pm25>61pm25>
<suggest>儿童、老年人及心脏、呼吸系统疾病患者人群应减少长时间或高强度户外锻炼suggest>
<quality>轻度污染quality>
<MajorPollutants>臭氧8小时MajorPollutants>
<o3>185o3>
<co>1co>
<pm10>101pm10>
<so2>4so2>
<no2>24no2>
<time>18:00:00time>
environment>
<yesterday>
<date_1>27日星期三date_1>
<high_1>高温 19℃high_1>
<low_1>低温 12℃low_1>
<day_1>
<type_1>小雨type_1>
<fx_1>无持续风向fx_1>
<fl_1>微风fl_1>
day_1>
<night_1>
<type_1>阴type_1>
<fx_1>无持续风向fx_1>
<fl_1>微风fl_1>
night_1>
yesterday>
<forecast>
<weather>
<date>28日星期四date>
<high>高温 26℃high>
<low>低温 13℃low>
<day>
<type>多云type>
<fengxiang>南风fengxiang>
<fengli>3-4级fengli>
day>
<night>
<type>多云type>
<fengxiang>无持续风向fengxiang>
<fengli>微风级fengli>
night>
weather>
<weather>
<date>29日星期五date>
<high>高温 28℃high>
<low>低温 15℃low>
<day>
<type>多云type>
<fengxiang>无持续风向fengxiang>
<fengli>微风级fengli>
day>
<night>
<type>晴type>
<fengxiang>无持续风向fengxiang>
<fengli>微风级fengli>
night>
weather>
<weather>
<date>30日星期六date>
<high>高温 31℃high>
<low>低温 15℃low>
<day>
<type>晴type>
<fengxiang>无持续风向fengxiang>
<fengli>微风级fengli>
day>
<night>
<type>多云type>
<fengxiang>无持续风向fengxiang>
<fengli>微风级fengli>
night>
weather>
<weather>
<date>1日星期天date>
<high>高温 29℃high>
<low>低温 20℃low>
<day>
<type>多云type>
<fengxiang>无持续风向fengxiang>
<fengli>微风级fengli>
day>
<night>
<type>小雨type>
<fengxiang>无持续风向fengxiang>
<fengli>微风级fengli>
night>
weather>
<weather>
<date>2日星期一date>
<high>高温 26℃high>
<low>低温 13℃low>
<day>
<type>小到中雨type>
<fengxiang>北风fengxiang>
<fengli>4-5级fengli>
day>
<night>
<type>多云type>
<fengxiang>北风fengxiang>
<fengli>3-4级fengli>
night>
weather>
forecast>
<zhishus>
<zhishu>
<name>晨练指数name>
<value>适宜value>
<detail>天气不错,空气清新,是您晨练的大好时机,建议不同年龄段的人们积极参加户外健身活动。detail>
zhishu>
<zhishu>
<name>舒适度name>
<value>较舒适value>
<detail>白天天气晴好,您在这种天气条件下,会感觉早晚凉爽、舒适,午后偏热。detail>
zhishu>
<zhishu>
<name>穿衣指数name>
<value>舒适value>
<detail>建议着长袖T恤、衬衫加单裤等服装。年老体弱者宜着针织长袖衬衫、马甲和长裤。detail>
zhishu>
<zhishu>
<name>感冒指数name>
<value>少发value>
<detail>各项气象条件适宜,无明显降温过程,发生感冒机率较低。detail>
zhishu>
<zhishu>
<name>晾晒指数name>
<value>适宜value>
<detail>天气不错,适宜晾晒。赶紧把久未见阳光的衣物搬出来吸收一下太阳的味道吧!detail>
zhishu>
<zhishu>
<name>旅游指数name>
<value>适宜value>
<detail>天气较好,但丝毫不会影响您出行的心情。温度适宜又有微风相伴,适宜旅游。detail>
zhishu>
<zhishu>
<name>紫外线强度name>
<value>中等value>
<detail>属中等强度紫外线辐射天气,外出时建议涂擦SPF高于15、PA+的防晒护肤品,戴帽子、太阳镜。detail>
zhishu>
<zhishu>
<name>洗车指数name>
<value>较适宜value>
<detail>较适宜洗车,未来一天无雨,风力较小,擦洗一新的汽车至少能保持一天。detail>
zhishu>
<zhishu>
<name>运动指数name>
<value>较适宜value>
<detail>天气较好,户外运动请注意防晒,推荐您在室内进行低强度运动。detail>
zhishu>
<zhishu>
<name>约会指数name>
<value>适宜value>
<detail>天气较好,和恋人一起徜徉于熙攘人群中或漫步于柔软草地上,都是不错的主意哦。detail>
zhishu>
<zhishu>
<name>雨伞指数name>
<value>不带伞value>
<detail>天气较好,不会降水,因此您可放心出门,无须带雨伞。detail>
zhishu>
zhishus>
resp>
http://mobile.weather.com.cn/data/forecast/101010100.html?_=1461845405
1461845405为Unix的时间戳,貌似该参数没有什么用处?
返回数据:
{
"c": {
"c1": "101010100",
"c2": "beijing",
"c3": "北京",
"c4": "beijing",
"c5": "北京",
"c6": "beijing",
"c7": "北京",
"c8": "china",
"c9": "中国",
"c10": "1",
"c11": "010",
"c12": "100000",
"c13": "116.391",
"c14": "39.904",
"c15": "33",
"c16": "AZ9010",
"c17": "+8"
},
"f": {
"f1": [{
"fa": "01",
"fb": "03",
"fc": "10",
"fd": "5",
"fe": "0",
"ff": "0",
"fg": "0",
"fh": "0",
"fi": "06:21|17:40"
},
{
"fa": "07",
"fb": "07",
"fc": "19",
"fd": "12",
"fe": "0",
"ff": "0",
"fg": "0",
"fh": "0",
"fi": "06:22|17:38"
},
{
"fa": "02",
"fb": "00",
"fc": "15",
"fd": "5",
"fe": "8",
"ff": "8",
"fg": "3",
"fh": "1",
"fi": "06:23|17:37"
},
{
"fa": "00",
"fb": "00",
"fc": "16",
"fd": "4",
"fe": "0",
"ff": "0",
"fg": "0",
"fh": "0",
"fi": "06:24|17:35"
},
{
"fa": "00",
"fb": "00",
"fc": "18",
"fd": "7",
"fe": "0",
"ff": "0",
"fg": "0",
"fh": "0",
"fi": "06:25|17:34"
},
{
"fa": "00",
"fb": "01",
"fc": "18",
"fd": "8",
"fe": "0",
"ff": "0",
"fg": "0",
"fh": "0",
"fi": "06:26|17:32"
},
{
"fa": "01",
"fb": "01",
"fc": "16",
"fd": "6",
"fe": "0",
"ff": "0",
"fg": "0",
"fh": "0",
"fi": "06:27|17:31"
}],
"f0": "201310121100"
}
}
http://openweather.weather.com.cn/Home/Help/icon/iid/10.html