优点:数据与样式分离
Google code: /
weather-china封装Yahoo提供的Weather RSS Feed,提供JSON格式的REST API接口,要获取某个城市的天气预报,例如北京,发送如下GET请求:
=beijing
参数说明:
city:城市名称,可以使用拼音。
返回JSON格式的字符串,使用标准的UTF-8编码,例如:
{
"pub" : "2010-07-05 09:00",
"wind" : {
"chill" : 33,
"direction" : 340,
"speed" : 14.48
},
"astronomy" : {
"sunrise" : "4:49",
"sunset": "19:46"
},
"atmosphere" : {
"humidity" : 26,
"visibility" : 9.99,
"pressure" : 982.05,
"rising": 0
},
"forecasts" : [
{
"date" : "2010-07-05",
"day" : 1,
"code" : 32,
"text" : "晴",
"low" : 23,
"high" : 33,
"image_large" : ".png",
"image_small" : ".png"
},
{
"date" : "2010-07-06",
"day" : 2,
"code" : 32,
"text" : "晴",
"low" : 23,
"high" : 34,
"image_large" : ".png",
"image_small" : ".png"
}
]
}
pub:当前天气信息发布时间;
wind:风力信息;
astronomy:日出和日落时间;
atmosphere:大气信息;
forecasts:包含当天和第二天的天气预报:
天气信息不会频繁更新,可以安全地在客户端缓存1小时。
免费供个人或非营利性组织使用。
本文发布于:2024-02-03 00:03:12,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170688979047336.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |