tcellerier / jdigiclock

Javascript digital clock & weather forecast (HTC Hero inspired)
GNU General Public License v3.0
6 stars 7 forks source link

Yahoo API stopped #2

Open sinopsysHK opened 5 years ago

sinopsysHK commented 5 years ago

As stated here: https://developer.yahoo.com/yql/ « To continue using our free Yahoo Weather APIs, use https://weather-ydn-yql.media.yahoo.com/forecastrss as your new API endpoint. Contact yahoo-weather-ydn-api@oath.com for credentials to onboard to this free Yahoo Weather API service. Other YQL based services that use query.yahooapis.com will no longer operate.»

So current getJSON call doesn’t work anymore without raising any alerts (keeping in « weather updating » state endlessly).

From my understanding, the new endpoint provided by yahoo requires personal credentials so it will be a bit more complex to distribute as easily as it is today

yannbouvier commented 5 years ago

En effet jdigiclock ne semble plus fonctionnel, un update de prévu ? merci

sinopsysHK commented 5 years ago

Based on limited googling, it seems that it will be hard to enhance it in a standalone way as it is today and a server-side piece might be needed otherwise it would compromise private key that is required by almost all providers (OpenWeatherMap, yahoo now, any others ?)

tcellerier commented 5 years ago

Hello,

I didn't investigate too much the new Yahoo API option, it seemed a bit complex. Instead I migrated the script to Météo-France undocumented API and retro engineered their pictograms. The only thing is that we cannot query directly their API from a JS call because of Cross origin restriction on their side. I used the jQuery AJAX Cross Origin library (http://www.ajax-cross-origin.com) to manage that part (you need a small donation to get access to the full instructions).

NB: I eliminated 2 other API options: OpenWheatherMap and DarkSky because I got weird temperature values for Paris (FR) weather.

Thomas

sinopsysHK commented 5 years ago

Hello,

I managed to do a quick and dirty port to OpenWeatherMap. Figures are somehow different from reports/forecasts from local Meteo publisher: difficult to say if this is a model gap or an observation point gap (1° diff on current temp).

On the other hand do meteofrance supports other countries ?

The way I integrated OpenWeatherMap is keeping yahoo and enabling to select your provider so may be both (Météo-France and OpenWeatherMap) could coexist ?

Benefit from OpenWeatherMap: supports partially cors thus no need for server-side. Downside: need a personnal API key and requires 2 API calls (current weather + forecast).

With new Yahoo service, they introduce OAuth which cannot (from my googling) be achieved client-side. So porting to new service would require additional server piece.

BaronRocco commented 4 years ago

So does this widget now only support the weather in France? I was unable to find how to use it for the United States.