我发现的大多数都使用 XML,我宁愿只使用 JSON Objective-C 源代码。
有什么建议吗?
我见过这个:
https://stackoverflow.com/questions/507441/best-weather-apis
Weather Underground 有一个返回 JSON 和 XML 的 API。公平的定价,加上每天 500 个免费的开发者电话。除了 NOAA 官方气象站外,Weather Underground 还拥有许多当地气象站,其中很多位于 SF 地区。
http://www.wunderground.com/weather/api/d/documentation.html
注意:此 API 现已被 Yahoo 弃用,并且 将无法工作!
我在闲逛了一段时间后发现了一个未记录的雅虎天气 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
}
]
}
尝试我们最近发布的新 Aeris Weather API。极其灵活,提供多种数据选项,未来还会有更多选项。我们还提供免费的开发者帐户,每天最多允许您点击 750 次。
http://www.hamweather.com/products/aeris-api/
http://www.hamweather.com/support/documentation/aeris/