Twitter bot weatherlisbon
This one returns daily weather forecasts for Lisbon city based on the BBC weather forecast rss feed.
#! /bin/sh #Goto here here=/home/guillaume/Personal cd $here #BBC Lisbon weather id id=0048 #BBC weather RSS feed address feed="http://feeds.bbc.co.uk/weather/feeds/rss/5day/world/${id}.xml" #City city=lisbon #temporary file file="weather${city}" #Weather twitter bot twitbot=weatherlisbon:******* #Timestamp the log file echo .>> $file.log date >> $file.log #Read the RSS feed and filter it curl $feed | grep 'title' | tail -n 1 | perl -wlne'm/title>(.*)<\/title/i && print $1' | sed -e "s/°//g" > $file.txt #Read the forecast into a weather variable read weather < $file.txt #Twit the weather variable away curl --basic --user $twitbot --data status="$weather" http://twitter.com/statuses/update.xml >> $file.log