Author Topic: Yahoo Weather now requires oauth which has broken my conky weather output  (Read 1280 times)

0 Members and 1 Guest are viewing this topic.

Offline 10480

  • Jr. Mitglied
  • **
  • Posts: 92
  • Branch: 15.09
  • Desktop: KDE Plasma Version 5.4.2
  • GPU Card: AMD/ATI Barts XT [Radeon HD 6870]
  • GPU driver: Non-Free
  • Kernel: 4.2.5-1
  • Skill: Novice
I have a personally touched up version of a Harmattan conky setup and ever since Yahoo changed the requirements for oauth, I haven't had weather. I've looked on their site and tried to achieve this myself, but I'm not finding their documentation very helpful, among a lot of 503 internal errors on their site. I have acquired an oauth key from them, but I just can't figure out how to implement it.

Here is the backbone for the 3 day weather forecast

updateWeather.sh - Obviously the WOEID has my number, I just removed it for this example.

Code: [Select]
#!/bin/bash
curl -s "http://weather.yahooapis.com/forecastrss?w=WOEID&u=c" -o $1

getweather.sh -

Code: [Select]
#!/bin/bash

[[ $1 == "temp"      ]] && echo $(grep "yweather:condition"  ~/.cache/weather.xml | grep -o "temp=\"[^\"]*\""     | grep -o "\"[^\"]*\"" | grep -o "[^\"]*")
[[ $1 == "pressure"  ]] && echo $(grep "yweather:atmosphere" ~/.cache/weather.xml | grep -o "pressure=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*")
[[ $1 == "humidity"  ]] && echo $(grep "yweather:atmosphere" ~/.cache/weather.xml | grep -o "humidity=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*")
[[ $1 == "wind"      ]] && echo $(grep "yweather:wind"       ~/.cache/weather.xml | grep -o "speed=\"[^\"]*\""    | grep -o "\"[^\"]*\"" | grep -o "[^\"]*")
[[ $1 == "condition" ]] && echo $(grep "yweather:condition"  ~/.cache/weather.xml | grep -o "text=\"[^\"]*\""     | grep -o "\"[^\"]*\"" | grep -o "[^\"]*")

[[ $1 == "forecastday1" ]] && echo $(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==1' )
[[ $1 == "forecastday2" ]] && echo $(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2' )
[[ $1 == "forecastday3" ]] && echo $(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3' )

[[ $1 == "forecasttemp1" ]] && echo $(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==1')° / $(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==1')°
[[ $1 == "forecasttemp2" ]] && echo $(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2')° / $(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2')°
[[ $1 == "forecasttemp3" ]] && echo $(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3')° / $(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3')°

and finally the reload-forecast-pics.sh

Code: [Select]
#!/bin/bash

cp -f ~/.conky-help/icons/big-white/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==1').png ~/.cache/weather-1.png
cp -f ~/.conky-help/icons/big-white/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2').png ~/.cache/weather-2.png
cp -f ~/.conky-help/icons/big-white/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3').png ~/.cache/weather-3.png


I assume the authorization would happen in the first bit of script, but I included it all just in case. I've been trying to get this for about a week or so now, but I just can't figure it out. Does anyone know how to pass yahoo oauth through this? Everything I have tried has been trying to authorize it in the original cURL command.

Offline bmaxxd

  • Neuling
  • *
  • Posts: 1
  • I'm new. Be nice!
  • Branch: stable
  • Desktop: Xfce
  • Skill: Novice
Try replacing
Code: [Select]
#!/bin/bash
curl -s "http://weather.yahooapis.com/forecastrss?w=WOEID&u=c" -o $1
with
Code: [Select]
#!/bin/bash
curl -s "http://xml.weather.yahoo.com/forecastrss?w=WOEID&u=c" -o $1

There is lots of information about this Yahoo change available on the Rainmeter forums.

Offline 10480

  • Jr. Mitglied
  • **
  • Posts: 92
  • Branch: 15.09
  • Desktop: KDE Plasma Version 5.4.2
  • GPU Card: AMD/ATI Barts XT [Radeon HD 6870]
  • GPU driver: Non-Free
  • Kernel: 4.2.5-1
  • Skill: Novice
Thanks for the reply. I actually found that a few days ago and have been back in full form ever since.