Weather report from Bash
Add this to your .bashrc:
weather(){ curl -s "http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml?query=${@:-"$1"}"|perl -ne '/<title>([^<]+)/&&printf "\x1B[0;34m%s\x1B[0m: ",$1;/<fcttext>([^<]+)/&&print $1,"\n"';}
From the prompt type:
weather 80304
Sweet, sweet weather reportage:
Today: Mostly cloudy. Isolated thunderstorms in the afternoon. Highs in the lower to mid 90s. Chance of thunderstorms 20 percent.
Tonight: Mostly cloudy with a 10 percent chance of thunderstorms. Lows 60 to 66.
Saturday: Mostly cloudy. A 20 percent chance of thunderstorms in the afternoon. Highs near 90. Northwest winds 10 to 15 mph.
Saturday Night: Mostly cloudy in the evening then clearing. A 20 percent chance of thunderstorms. Lows 58 to 64.
Sunday: Mostly sunny. Highs in the mid 80s to lower 90s.
Written by Jeremy Frazao
Related protips
1 Response
Nice although they say that this api call will be depracted.
"This feed will be deprecated. Please switch to http://www.wunderground.com/weather/api/" so keep that in mind. And the latter is probably using an api key.