Quantcast
Channel: Geeklets
Viewing all articles
Browse latest Browse all 81

Current Location Weather (Yahoo)

$
0
0

Here is my attempt to create current location weather for GeekTool.

I edited code from this website and give credit to the person who created it. Thank you!

I will add Weather Image soon. I will try to add a 5 day forecast geeklet file too later.

Image Name

The code I wrote for this. Second Geeklet. Current Weather 2.

W=curl "https://weather.yahoo.com" S=(echo "$W" | grep "region" | sed 's/<[^>]*>//g' | head -2 | tail -1 | sed 's/region://g' | sed -e "s/'//g") C=(echo "$W" | grep '"name"' | sed 's/<[^>]*>//g' | head -1 | tail -1 | sed 's/region://g' | sed -e "s/'//g") F=(echo "$W" | grep 'div class="cond' | sed 's/<[^>]*>//g' | head -2 | tail -1 | sed 's/region://g' | sed -e "s/'//g") T=(echo "$W" | grep '"num"' | sed 's/<[^>]*>//g' | head -1 | tail -1 | sed 's/region://g' | sed -e "s/'//g" | sed -e "s/°/°F/g") H=(echo "$W" | grep '"hi f w-up-arrow"'| sed 's/<[^>]*>//g' | head -1 | tail -1 | sed 's/region://g' | sed -e "s/'//g" | sed -e "s/°/°F/g") L=(echo "$W" | grep '"lo f w-down-arrow"'| sed 's/<[^>]*>//g' | head -1 | tail -1 | sed 's/region://g' | sed -e "s/'//g" | sed -e "s/°/°F/g") D=(curl "https://weather.yahoo.com" | grep "Humidity" | awk '{print $86}' | sed 's/<[^>]*>//g' | sed 's/class=//g' | sed 's/"//g' | sed 's/value//g' | sed 's/n//g' | sed 's/>//g' | sed 's/\\\//g')

echo $C,$S echo $T " " $F " " echo "↑"$H "-" "↓"$L echo "$D Humidity"


Viewing all articles
Browse latest Browse all 81

Latest Images

Trending Articles



Latest Images