一、中国气象局(http://www.weather.com.cn)
1.实时接口
http://mobile.weather.com.cn/data/sk/101010100.html
http://www.weather.com.cn/data/sk/101010100.html
http://www.weather.com.cn/data/cityinfo/101010100.html
其中:101010100 是城市代码。
json数据格式:
{
"sk_info": {
"date": "20131012",
"cityName": "北京",
"areaID": "101010100",
"temp": "21℃",
"tempF": "69.8℉",
"wd": "东风",
"ws": "3级",
"sd": "39%",
"time": "15:10",
"sm": "暂无实况"
}
}
http://mobile.weather.com.cn/data/forecast/101010100.html
其中:101010100 是城市代码。
json数据格式:
{
"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"
}
}
城市代码
获取方式一(XML接口):
全国省会城市一览: http://flash.weather.com.cn/wmaps/xml/china.xml
全国县级以上城市一览,比如:
上海:http://flash.weather.com.cn/wmaps/xml/shanghai.xml
四川:http://flash.weather.com.cn/wmaps/xml/sichuan.xml
成都:http://flash.weather.com.cn/wmaps/xml/chengdu.xml
重庆:http://flash.weather.com.cn/wmaps/xml/chongqing.xml
获取方式二(XML接口):
一次性获取全国+国外主要城市,8763个城市列表信息。URL:http://mobile.weather.com.cn/js/citylist.xml
1.接口没有调用次数、频率和IP限制, 永久免费。
2.JSON接口调用文档:http://doc.tianqiapi.com/603579
3.IFrame调用:http://www.tianqiapi.com/
1.数据主要包含:实时天气,3天内天气预报,生活指数,空气质量。
访问流量:4000次/天。
访问频率:200次/分钟。
2.URL:https://free-api.heweather.com/v5/forecast?city=yourcity&key=yourkey
city:城市名称,city可通过城市中英文名称、ID、IP和经纬度进行查询,经纬度查询格式为:经度,纬度。例:city=北京,city=beijing,city=CN101010100,city= 60.194.130.1
key:用户认证key
3.注册页面:https://console.heweather.com/register
接口文档:https://www.heweather.com/documents/
记录备用