雅虎天气、雅虎 GeoPlant、谷歌天气或其他 API 与 javascript 连接? [英] Yahoo Weather, Yahoo GeoPlant, Google Weather or another API to connect to with javascript?
问题描述
我需要一种方法来使用 javascript 获取某个城市的当前天气吗?我最好使用哪个 API?或者有没有其他应用可以使用 ajax 请求来获取当前天气?
GeoPlanit 需要一个 appid,所以我还没有尝试过,雅虎天气是一个 RSS 提要.我还读到 Google 的天气 API 在此阶段不受支持?
谢谢.
也找不到任何会以 JSON 格式返回数据的东西,这是我找到的最接近的东西,但它只允许邮政编码 -- http://services.badbamboo.com/REST/Common.ashx?method=GetWeather&zip=80202&jsoncallback=_cb
您可以使用 JavaScript 解析来自 Yahoo 的 RSS 提要.另见:https://stackoverflow.com/questions/507441/best-weather-apis>
仅供参考,编写一个脚本来获取服务器端的天气非常简单.
I need a way to get the current weather back for a certain city with javascript? Which API would I be better to use? Or are there any other apps that you can use an ajax request to get the current weather?
GeoPlanit required an appid so I haven't tried this yet and yahoo weather is an RSS feed. I have also read that Google's weather API is unsupported at this stage?
Thanks.
EDIT: Also can't find anything that will return data in JSON format, this is the closest thing I found but it only allows zip codes -- http://services.badbamboo.com/REST/Common.ashx?method=GetWeather&zip=80202&jsoncallback=_cb
You could parse the RSS feed from Yahoo with JavaScript. Also see: https://stackoverflow.com/questions/507441/best-weather-apis
FYI, it's quite trivial to write a script to fetch the weather on the server side.
这篇关于雅虎天气、雅虎 GeoPlant、谷歌天气或其他 API 与 javascript 连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!