Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用Oauth 1.0从Yahoo weather API获取天气数据_Javascript_Api_Yql_Yahoo Weather Api - Fatal编程技术网

Javascript 使用Oauth 1.0从Yahoo weather API获取天气数据

Javascript 使用Oauth 1.0从Yahoo weather API获取天气数据,javascript,api,yql,yahoo-weather-api,Javascript,Api,Yql,Yahoo Weather Api,我正在开发一个web门户,使用Yahoo web服务来实时测量温度。我使用组合YQL查询按纬度和经度获取天气数据,这还不错: https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid in (select woeid from geo.placefinder where text='lat,lon')&format=json 自今年1月以来,组合查询不再有效。 因此,我必

我正在开发一个web门户,使用Yahoo web服务来实时测量温度。我使用组合YQL查询按纬度和经度获取天气数据,这还不错:

https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid in (select woeid from geo.placefinder where text='lat,lon')&format=json
自今年1月以来,组合查询不再有效。 因此,我必须按顺序发出两个单独的http请求来获取数据

  • 从lan、lon和appid获取woeid
  • 从woeid获取数据
  • 每次从Yahoo获取数据都非常耗时且效率较低。我在谷歌上搜索了一段时间,想找到一个解决方案来改进这一点,但大多数都是针对老的Yahoo weather API版本的。 我正在寻找一种方法,以缩短时间或其他一些主流的免费天气服务提供商,提供世界天气

    更新(2016.03.24)

    我找到了一种方法,使组合的YQL从此开始工作

    将YQL更改为:

    https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid in (select woeid from geo.placefinder where text='(lat,lon)')&format=json
    
    只需在地理位置周围添加括号。前一个最近使用过

    更新(2016.03.25)

    雅虎天气服务昨天关闭,YQL在相当长一段时间内无效。 从官方文件中,它说从3月15日起通过url强制执行Oauth 1…
    即使今天恢复了公共链接,我发现我无法通过添加u='c'或u='f'来切换天气单位

    我不知道Yahoo weather API是否会继续保持原来的url。目前,它还活着。
    我期待着通过OAuth1.0在Javascript中查询Yahoo天气的解决方案

    openweathermap.org可能是另一种选择,因为旧的公共URL不再有效(截至2016年4月)。现在必须使用oauth。@SujayPhadke直到现在,我仍在使用旧的URL。我不知道它什么时候会失效。