felixhageloh / weather-widget

A weather widget for Übersicht
63 stars 32 forks source link

No longer working #29

Open GirlFriday opened 8 years ago

GirlFriday commented 8 years ago

It doesn't seem to be able to fetch weather data anymore. All I get is "Could not retrieve weather data for New York, NY. Are you connected to the internet?

Yes I am, and it was working fine until 24 hours ago. Is Yahoo refusing data requests or something?

felixhageloh commented 8 years ago

It sounds like it might be Yahoo, especially if you can rule out any modifications to the widget the last 24h. Let me know if it fixes itself or otherwise could you have a look if there are any errors in the debug console and share them here?

horus1963 commented 8 years ago

The widget has stopped working for me too 5 days ago. From the Yahoo website it looks like Yahoo has changed the way you make calls to their API on the 15th of March. Quoting from their website:

"To increase the security measure and better serving our YDN customers, weather data source will enforce OAuth 1 starting March 15, 2016. Please update your API calls with OAuth 1 enabled (via the OAuth /v1/yql end point if using YQL) using your Yahoo App key and secret.

old: https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22nome%2C%20ak%22)&format=json

new: https://query.yahooapis.com/v1/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22nome%2C%20ak%22)&format=json"

I believe the widget will need updating to reflect the above.

Thanks

joecreighton commented 8 years ago

I refreshed all widgets; I also quit Ubersicht and restarted it: curiously, mine was still working. So I grabbed the latest zip file and ran a diff. I was able to reproduce the failed and successful calls by swapping between these two statements in update():

% diff my-weather.widget/index.coffee current-weather.widget/index.coffee
185c185
<   channel = data?.query?.results?.weather?.rss?.channel
---
>   channel = data?.query?.results?.channel

This seems to contradict a recent patch at bc01106. Hope that helps.

horus1963 commented 8 years ago

Thank you very much. That change worked!

jnbt commented 8 years ago

@horus1963 @GirlFriday Which version we're you using? Because there was an update on Mar 4, 2016, to address YQL problems.

jnbt commented 8 years ago

Everyone who has problems could you please try the following URL (browser is sufficient), and just report the response?

https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D'Bochum%2C%20NW')and%20u%3D'c'&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&format=json

horus1963 commented 8 years ago

I was using an old version when it stopped working. I then noticed that you had a new version so I downloaded it and only installed the get-weather as I did not want to redo all the mods I had in the index.coffee file. That did not work until I made the modification that you mentioned above. Now it working fine.

Also as for the link you posted above the response I get is:

{"query":{"count":1,"created":"2016-03-22T15:08:44Z","lang":"en-US","results":{"channel":{"title":"Yahoo! Weather - Bochum, DE","link":"http://us.rd.yahoo.com/dailynews/rss/weather/Bochum__DE/*http://weather.yahoo.com/forecast/GMXX3998_c.html","description":"Yahoo! Weather for Bochum, DE","language":"en-us","lastBuildDate":"Tue, 22 Mar 2016 2:59 pm CET","ttl":"60","location":{"city":"Bochum","country":"Germany","region":"NW"},"units":{"distance":"km","pressure":"mb","speed":"km/h","temperature":"C"},"wind":{"chill":"7","direction":"300","speed":"11.27"},"atmosphere":{"humidity":"73","pressure":"1013.6","rising":"2","visibility":""},"astronomy":{"sunrise":"6:29 am","sunset":"6:49 pm"},"image":{"title":"Yahoo! Weather","width":"142","height":"18","link":"http://weather.yahoo.com","url":"http://l.yimg.com/a/i/brand/purplelogo//uh/us/news-wea.gif"},"item":{"title":"Conditions for Bochum, DE at 2:59 pm CET","lat":"51.49","long":"7.21","link":"http://us.rd.yahoo.com/dailynews/rss/weather/Bochum__DE/*http://weather.yahoo.com/forecast/GMXX3998_c.html","pubDate":"Tue, 22 Mar 2016 2:59 pm CET","condition":{"code":"26","date":"Tue, 22 Mar 2016 2:59 pm CET","temp":"9","text":"Cloudy"},"description":"\n<img src=\"http://l.yimg.com/a/i/us/we/52/26.gif\"/>
\nCurrent Conditions:
\nCloudy, 9 C
\n
Forecast:
\nTue - Cloudy. High: 11 Low: 6
\nWed - AM Showers. High: 9 Low: 1
\nThu - Mostly Cloudy. High: 11 Low: 6
\nFri - Light Rain. High: 9 Low: 6
\nSat - Partly Cloudy. High: 15 Low: 8
\n
\n<a href=\"http://us.rd.yahoo.com/dailynews/rss/weather/Bochum__DE/*http://weather.yahoo.com/forecast/GMXX3998_c.html\">Full Forecast at Yahoo! Weather

\n(provided by <a href=\"http://www.weather.com\" >The Weather Channel)
\n","forecast":[{"code":"26","date":"22 Mar 2016","day":"Tue","high":"11","low":"6","text":"Cloudy"},{"code":"39","date":"23 Mar 2016","day":"Wed","high":"9","low":"1","text":"AM Showers"},{"code":"28","date":"24 Mar 2016","day":"Thu","high":"11","low":"6","text":"Mostly Cloudy"},{"code":"11","date":"25 Mar 2016","day":"Fri","high":"9","low":"6","text":"Light Rain"},{"code":"30","date":"26 Mar 2016","day":"Sat","high":"15","low":"8","text":"Partly Cloudy"}],"guid":{"isPermaLink":"false","content":"GMXX3998_2016_03_26_7_00_CET"}}}}}}

jnbt commented 8 years ago

Now the API also responds for me with an error. I'm having the feeling that Yahoo is migrating their servers and rolling out the OAuth requirement.

I'm not sure what would be better:

a) Adopting the OAuth change: As far as I understood the change every user would need to generate an API token b) Using a different data provider

horus1963 commented 8 years ago

Same here. Stopped working yesterday giving a security error. Using curl -s http://weather.yahooapis.com/forecastrss?w=WOEID; where I substitute the ID for my city; still works though through terminal.

GirlFriday commented 8 years ago

Started working again briefly and then stopped. Are you going to fix this or what? I think the suspicion about the API is correct. This is what I get when I click the URL above:

{"query":{"count":1,"created":"2016-03-26T17:55:53Z","lang":"en-us","results":{"channel":{"units":{"distance":"km","pressure":"mb","speed":"km/h","temperature":"C"},"title":"Yahoo! Weather - Bochum, NW, DE","link":"http://us.rd.yahoo.com/dailynews/rss/weather/Country__Country/*https://weather.yahoo.com/country/state/city-639679/","description":"Yahoo! Weather for Bochum, NW, DE","language":"en-us","lastBuildDate":"Sat, 26 Mar 2016 06:55 PM CET","ttl":"60","location":{"city":"Bochum","country":"Germany","region":" NW"},"wind":{"chill":"57","direction":"185","speed":"28.97"},"atmosphere":{"humidity":"44","pressure":"33863.90","rising":"0","visibility":"25.91"},"astronomy":{"sunrise":"6:17 am","sunset":"6:57 pm"},"image":{"title":"Yahoo! Weather","width":"142","height":"18","link":"http://weather.yahoo.com","url":"http://l.yimg.com/a/i/brand/purplelogo//uh/us/news-wea.gif"},"item":{"title":"Conditions for Bochum, NW, DE at 06:00 PM CET","lat":"51.486439","long":"7.21079","link":"http://us.rd.yahoo.com/dailynews/rss/weather/Country__Country/*https://weather.yahoo.com/country/state/city-639679/","pubDate":"Sat, 26 Mar 2016 06:00 PM CET","condition":{"code":"39","date":"Sat, 26 Mar 2016 06:00 PM CET","temp":"15","text":"Scattered Showers"},"forecast":[{"code":"28","date":"26 Mar 2016","day":"Sat","high":"15","low":"5","text":"Mostly Cloudy"},{"code":"11","date":"27 Mar 2016","day":"Sun","high":"11","low":"8","text":"Showers"},{"code":"23","date":"28 Mar 2016","day":"Mon","high":"11","low":"7","text":"Breezy"},{"code":"12","date":"29 Mar 2016","day":"Tue","high":"10","low":"6","text":"Rain"},{"code":"12","date":"30 Mar 2016","day":"Wed","high":"11","low":"5","text":"Rain"},{"code":"39","date":"31 Mar 2016","day":"Thu","high":"9","low":"4","text":"Scattered Showers"},{"code":"12","date":"01 Apr 2016","day":"Fri","high":"9","low":"3","text":"Rain"},{"code":"28","date":"02 Apr 2016","day":"Sat","high":"10","low":"3","text":"Mostly Cloudy"},{"code":"28","date":"03 Apr 2016","day":"Sun","high":"12","low":"4","text":"Mostly Cloudy"},{"code":"28","date":"04 Apr 2016","day":"Mon","high":"13","low":"5","text":"Mostly Cloudy"}],"description":"<![CDATA[<img src=\"http://l.yimg.com/a/i/us/we/52/39.gif\"/>\n
\nCurrent Conditions:\n
Scattered Showers\n
\n
\nForecast:\n
Sat - Mostly Cloudy. High: 15Low: 5\n
Sun - Showers. High: 11Low: 8\n
Mon - Breezy. High: 11Low: 7\n
Tue - Rain. High: 10Low: 6\n
Wed - Rain. High: 11Low: 5\n
\n
\n<a href=\"http://us.rd.yahoo.com/dailynews/rss/weather/Country__Country/*https://weather.yahoo.com/country/state/city-639679/\">Full Forecast at Yahoo! Weather\n
\n
\n(provided by <a href=\"http://www.weather.com\" >The Weather Channel)\n
\n]]>","guid":{"isPermaLink":"false"}}}}}}

GirlFriday commented 8 years ago

Oh, and as far as I can tell I have the updated version installed.

felixhageloh commented 8 years ago

It's a shame - initially I used forecast.io and the reason to switch to yahoo was that it didn't require people to get their own API token.

We could go back to forecast.io but it wouldn't really be much better than having people get a yahoo oauth key. Another option would be to investigate some alternative apis like http://lifehacker.com/get-a-quick-weather-forecast-with-a-terminal-command-1760639048?utm_medium=sharefromsite&utm_source=Lifehacker_twitter

horus1963 commented 8 years ago

@felixhageloh I personally would rather get a yahoo oauth key rather than not have the widget at all.

ChiefPoints commented 8 years ago

I'd rather get a yahoo oauth key as well, seems the least disruptive way forward. Would love to see an update that covers that route.

roele commented 8 years ago

If OAuth would be painless i wouldn't mind setting that up initially as well but i guess this would require a setup script and since the token will expire after 3600 seconds a token refresh would need to be built in as well.

Playing with https://developer.yahoo.com/weather/ does also show the mentioned behaviour. I assume their API is simply broken again (not the first time!). Some attempts return results, some don't i guess depends to what servers the requests get routed.

felixhageloh commented 8 years ago

I'm beginning to think that forecast IO will be the easiest route. I currently have very little time to look into this so it will probably take a while till I have a fix. In the meantime PRs are welcome!

litewhatever commented 8 years ago

@felixhageloh perhaps you might consider taking a look at https://www.wunderground.com/ when you have some spare time. They also have API etc. (unfortunately authentication key is required).

imho they stand out as forecasts are "crowdsourced".