国家气象局提供的天气预报接口

               

国家气象局提供的天气预报接口

接口地址:

http://www.weather.com.cn/data/sk/*.htmlhttp://www.weather.com.cn/data/cityinfo/*.htmlhttp://m.weather.com.cn/data/*.html

前两个都可以用但是显示的信息非常有限,第三个接口由于权限原因打不开,但是听别人说里面提示的内容比较详细。

其中的*号标记处填城市代码名。

我用无锡做一个例子:使用例子如图所示

http://www.weather.com.cn/data/sk/101190201.htmlhttp://www.weather.com.cn/data/cityinfo/101190201.htmlhttp://m.weather.com.cn/data/101190201.html

第三个接口打不开。

所以我就介绍一下前两个api接口的json数据结构:

http://www.weather.com.cn/data/sk/101190201.html
{ "weatherinfo": {  "city": "无锡",  "cityid": "101190201",  "temp": "18",  "WD": "南风",  "WS": "1级",  "SD": "35%",  "WSE": "1",  "time": "17:05",  "isRadar": "0",  "Radar": "",  "njd": "暂无实况",  "qy": "1020",  "rain": "0" }

http://www.weather.com.cn/data/cityinfo/101190201.html
{ "weatherinfo": {  "city": "无锡",  "cityid": "101190201",  "temp1": "4℃",  "temp2": "16℃",  "weather": "晴转多云",  "img1": "n0.gif",  "img2": "d1.gif",  "ptime": "18:00" }}


全国各城市代码如下:

北京:101010100朝阳:101010300顺义:101010400怀柔:101010500通州:101010600昌平:101010700延庆:101010800丰台:101010900石景山:101011000大兴:101011100房山:101011200密云:101011300门头沟:101011400平谷:101011500八达岭:101011600佛爷顶:101011700汤河口:101011800密云上甸子:101011900斋堂

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值