我发现大多数使用xml,而id只是使用JSON目标c源代码。
有什么建议吗?
我见过这个:
https://stackoverflow.com/questions/507441/best-weather-apis
答案 0 :(得分:4)
Weather Underground有一个返回JSON和XML的API。公平的定价,加上每天500个免费的开发者电话。 Weather Underground在NOAA官方站外有许多当地的气象站,在SF区很多。
http://www.wunderground.com/weather/api/d/documentation.html
答案 1 :(得分:4)
注意:此API现已被Yahoo弃用,而将无效 !
有一段未记载的Yahoo Weather API,我在搞乱了一段时间后发现了。这是一个示例链接:
http://weather.yahooapis.com/forecastjson?w=12844782&u=c
w
之后的值是WOEID,u
是单位的值。我确信有更多选项可用于配置URL。
这是它的样子:
{
"units":{
"temperature":"C",
"speed":"km\/h",
"distance":"km",
"pressure":"mb"
},
"location":{
"location_id":"ITXX0024",
"city":"Como",
"state_abbreviation":"*",
"country_abbreviation":"IT",
"elevation":935,
"latitude":45.81000000000000,
"longitude":9.08000000000000
},
"wind":{
"speed":5.00000000000000,
"direction":"VAR"
},
"atmosphere":{
"humidity":"40",
"visibility":9.99000000000000,
"pressure":982.00000000000000,
"rising":"steady"
},
"url":"http:\/\/weather.yahoo.com\/forecast\/ITXX0024.html",
"logo":"http:\/\/l.yimg.com\/a\/i\/us\/nt\/ma\/ma_nws-we_1.gif",
"astronomy":{
"sunrise":"08:01",
"sunset":"16:42"
},
"condition":{
"text":"Fair",
"code":"34",
"image":"http:\/\/l.yimg.com\/a\/i\/us\/we\/52\/34.gif",
"temperature":9.00000000000000
},
"forecast":[
{
"day":"Today",
"condition":"Mostly Clear",
"high_temperature":7.00000000000000,
"low_temperature":2.00000000000000
},
{
"day":"Tomorrow",
"condition":"Partly Cloudy",
"high_temperature":8.00000000000000,
"low_temperature":2.00000000000000
},
{
"day":"Friday",
"condition":"Sunny",
"high_temperature":8.00000000000000,
"low_temperature":3.00000000000000
},
{
"day":"Saturday",
"condition":"Mostly Sunny",
"high_temperature":7.00000000000000,
"low_temperature":1.00000000000000
},
{
"day":"Sunday",
"condition":"Sunny",
"high_temperature":8.00000000000000,
"low_temperature":1.00000000000000
}
]
}
答案 2 :(得分:1)
试用我们最近发布的新款Aeris Weather API。非常灵活,提供各种各样的数据选项,还有更多的数据可供选择。我们还提供免费的开发者帐户,允许您每天最多750次点击。
http://www.hamweather.com/products/aeris-api/
http://www.hamweather.com/support/documentation/aeris/