Weather Forcasts from yahoo weather api

后端 未结 5 2094
北荒
北荒 2020-12-18 12:06

How to get 3,5 or 7 day forecasts from Yahoo Weather API instead of just today and tomorrow?

http://weather.yahooapis.com/forecastrss?w=location gives response which

相关标签:
5条回答
  • 2020-12-18 12:34

    Not working anymore!


    I know it is late and already had an accepted answer. But I will leave my thought just to benefit whoever came to here in search for more info.

    Yahoo weather api has another format JSON.

    http://weather.yahooapis.com/forecastjson?w=2459115&d=1

    This API is undocumented but it will be useful for those who needs more forecasts. Adding parameter "d" will include more forecasts to returned data. I tried with different value for parameter "d". Unfortunately, it will only return forecasts for 4 more days regardless of different values I put in (1,2,3,4,5,a,c,d,...) .However, I believe this should be good enough for most cases.

    **Note.. It is not working for rss though.

    0 讨论(0)
  • 2020-12-18 12:55

    Limit parameter is working fine:

    select item.forecast from weather.forecast where woeid in 
        (select woeid from geo.places(1) where text="munic, de") and u='c' limit 3
    

    and URL:

    https://query.yahooapis.com/v1/public/yql?q=select%20item.forecast%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22munic%2C%20de%22)%20and%20u%3D%27c%27%20limit%203&format=json
    
    0 讨论(0)
  • 2020-12-18 12:55

    Update : It's not working anymore

    It's much easier. Just add the parameter &d=5 to the string, like:

    http://weather.yahooapis.com/forecastjson?w=24549429&u=c&d=5 
    

    if you want 5 days. Change json to rss for the RSS version.

    0 讨论(0)
  • 2020-12-18 12:56

    Hello all I checked it today you will get maximum of a 10 dyas forcast adding a parameter d. I checked it with 1,2,3..10 and its working perfectly. If you submitt it with 10+ number it only returns 10 days (its maximum).

    http://weather.yahooapis.com/forecastrss?w=2442047&u=c&d=10

    I checkout with the above url.

    0 讨论(0)
  • 2020-12-18 12:59

    As stated on the API explanation there are only two parameters: w for the WOEID (where on earth id) and u for the unit (Fahrenheit or Celsius). There are no parameters for the number of days to fetch.

    I recommend to switch to some other weather API with more features.

    0 讨论(0)
提交回复
热议问题