我发现的大多数都使用 xml,而 id 则只使用 JSON 目标 c 源代码。
有什么建议么?
我见过这个:
https://stackoverflow.com/questions/507441/best-weather-apis
我发现的大多数都使用 xml,而 id 则只使用 JSON 目标 c 源代码。
有什么建议么?
我见过这个:
https://stackoverflow.com/questions/507441/best-weather-apis
注意:此 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
}
]
}
Weather Underground 有一个返回 JSON 和 XML 的 API。价格公道,外加每天 500 次免费开发者电话。Weather Underground 在 NOAA 官方站之外有许多当地气象站,在 SF 地区是一个不错的数字。
http://www.wunderground.com/weather/api/d/documentation.html
试用我们最近发布的新 Aeris Weather API。极其灵活,并提供多种数据选项,未来还会有更多。我们还提供一个免费的开发者帐户,每天最多可以点击 750 次。
http://www.hamweather.com/products/aeris-api/
http://www.hamweather.com/support/documentation/aeris/