Weather Forcasts from yahoo weather api

假如想象 提交于 2019-11-29 08:13:35

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.

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
chris

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.

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!