Topic: plain text weather on command line
I found the idea of using an internet weather service to display weather information in a terminal here on the forum. The general idea is to use the "-dump" option of a terminal browser like elinks or lynx and parse its output.
My current version uses "google.com/search?hl=en&q=weather+city" and looks like this:
weather(){
elinks -dump "google.com/search?hl=en&q=weather+${1:-munich}" | \
sed -n '/Weather for/,${;s/^ *//;/iGoogle/d;s/-.*//;s/|.*//;p;/Humidity/q;}' | \
sed '2,$s/^/ /'
}and the output:
Weather for Munich, Germany
13°C
Current: Overcast
Wind: NE at 13 km/h
Humidity: 88%Question:
Do you now other websites which provide easy to parse weather information suitable for this?
(You may as well comment on other ways to improve this - e.g. i think the sed command is not very neat)
thank you for you help and ideas
luc
EDIT: new version (2011-02-21)
Last edited by luc (2011-02-21 12:13:30)