mockturtl / cinnamon-weather

DEPRECATED. Use linuxmint/cinnamon-spices-applets instead.
https://cinnamon-spices.linuxmint.com/applets/view/17
28 stars 35 forks source link

WOEID - new codes update #134

Closed 4t4h3cl closed 8 years ago

4t4h3cl commented 8 years ago

As stated here, Yahoo is doing some upgrades of WOEIDs ... and for my case, the old format of WOEID did not work with the existing code, thus i've adjusted it to the new format.

The needed changes to make things work are in the applet.js:

New URL for WOEID lookup:

const WOEID_URL = "http://woeid.rosselliot.co.nz/"

Changed parameter:

const QUERY_TABLE = 'feednormalizer where url="http://xml.weather.yahoo.com/forecastrss?w='

unitToUrl function:

return this._temperatureUnit == WeatherUnits.FAHRENHEIT ? '%26u%3Df' : '%26u%3Dc'

weatherToUrl function:

let output = QUERY_URL + this._woeid + this.unitToUrl() + '"'

Tomaszm700 commented 8 years ago

I put here an information how to check your actual WOEID - may help someone as well.

138

[edit by mockturtl: fixed the link]

icemodding commented 8 years ago

Argentina, Nor Buenos Aires, Cordoba, etc. - Cities or not loaded directly on San Miguel de Tucuman not appear :(

ice@ice ~ $ cinnamon --version Cinnamon 2.8.7

mockturtl commented 8 years ago

https://developer.yahoo.com/weather/

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.

@icemodding Was it OK before? Please give me a WOEID to try.

mockturtl commented 8 years ago

more: tipichris/bbcwx#24

tonywhelan commented 8 years ago

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.

This appears to be saying that the data is no longer freely available without a Yahoo key and secret? So the weather applet will no longer function?

ienev commented 8 years ago

Due to the changed WOEID values it seems the applet doesn't work anymore. For example for Sofia, Bulgaria the old code was BUXX0005 but now it displays the temperature for Sunnyvale, CA which I suppose is some kind of default one if the API can't find the WOEID. I've entered the new code 839722 but it doesn't seem to work as probably the endpoint is changed or requires authentication.

Matt832 commented 8 years ago

Applet stopped working for me recently too. I'm in the US, changing zip code has no effect. Miss the weather info, wish it would work again.

ghost commented 8 years ago

Yeah, i can confirm the applet stopped working. @mockturtl, here is a desklet, which uses BBC Weather . Can you replace the source with it?

vlatkoB commented 8 years ago

Applet is working, but it's data source isn't.

This is url for Zagreb, Croatia (which applet is constructing):

http://query.yahooapis.com/v1/public/yql?format=json&q=select * from feednormalizer where url="http://xml.weather.yahoo.com/forecastrss/HRXX0005_c.xml"

and the data is from 5 days ago (today). "lastBuildDate": "Mon, 11 Apr 2016 7:00 pm CEST",

4t4h3cl commented 8 years ago

I've managed to make it work for me by altering a few lines in the applet.js code. New URL looks like this:

https://query.yahooapis.com/v1/public/yql?q=select+*+from+weather.forecast+where+woeid=532284+and+u=%27c%27&format=json

Attached applet.js is from me, please make a diff or something to see the changes. Basicaly the only thing that changes is the URL format and this line (removed the rss get object) let weather = json.get_object_member('query').get_object_member('results').get_object_member('channel')

applet.txt

tonywhelan commented 8 years ago

Thanks for the effort you've made here. Result looks good initially (with the new woeid codes) but the 5-day forecast for Canberra AU seems several degrees below what the local forecast says, and what accuweather says. Pressure looks wrong and wind chill is crazy (54C!??). So maybe there is more to this than just those changes you've made? I wish I had the time to have a go at this myself but have too many other responsibilities for next couple of weeks.

4t4h3cl commented 8 years ago

weather-compare

Maybe because i've added the temperature unit in Celsius into the URL? My forecast seems OK, comparing the one from forecast.io and this one (Yahoo).

The pressure seems way off, but i don't care much about pressure... :)

See attached screenshot...

tomgeor commented 8 years ago

Running into the same thing here but I've only tried changing settings or woeids.

ScottGeiger commented 8 years ago

I had not seen this before starting to make edits as well. I made similar changes as @4t4h3cl did, I can confirm it is now working with the changes.

I changed as follows: (at line 62): const QUERY_TABLE = 'weather.forecast '

(at line 389): let weather = json.get_object_member('query').get_object_member('results').get_object_member('channel')

(at line 802): let output = QUERY_URL + ' where woeid=' + this._woeid + ' and u="' + this.unitToUrl() + '"'

full applet attached. applet.txt

ScottGeiger commented 8 years ago

I don't have any issue getting to that site. You can also try Yahoo's YQL test page: https://developer.yahoo.com/yql/console/?q=select%20woeid%20from%20geo.places(1)%20where%20text%3D"nome%2C%20ak"&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys#h=select+woeid+from+geo.places(1)+where+text%3D%22nome%2C+ak%22

As a last resort you could Google it, but there are some incorrect (possible old) WOEIDs out there.

brianjmurrell commented 8 years ago

@ScottGeiger: Yeah, I got there after a retry. Deleted my comment also. :-)

But I have to say, Yahoo's weather is garbage (now). Even going to their own page https://ca.news.yahoo.com/weather/\<country>/<state|province>/<city-*>/ shows completely inaccurate weather.

Google shows much more realistic weather.

mockturtl commented 8 years ago

duplicates #127