Sharing status updates with IM buddies
Jun 27, 10:59 AMThis is just a simple Python script I wrote to update my IM status with the IM programs on my Mac. (On my Windows and Linux machines, there’s a Pidgin plugin that takes care of this for me.)
The best way to run this is from cron something like this in your crontab will poll Twitter and update Adium/iChat every 15 minutes:
0,15,30,45 * * * * python /Users/adam/Library/Scripts/twit.py > /dev/null
# Put your Twitter screen name here. twit = 'daydreamlab'from appscript import * from xml.dom.minidom import parse from urllib2 import urlopen#Grab the XML feed from the Twitter API. tweetXML = urlopen('http://twitter.com/statuses/user_timeline/'+twit+'.xml?count=1')# If you use identi.ca, use this instead: #tweetXML = urlopen('http://identi.ca/api/statuses/user_timeline/'+twit+'.xml?count=1')#Grab the text of the newest entry. newestTweet = parse(tweetXML).getElementsByTagName('text').item(0).firstChild.data#Tell iChat to update its status message. (Comment this line out if you don't use iChat.) app('iChat').status_message.set(newestTweet)#Tell Adium to update its status message for each account. #(Uncomment these lines if you use Adium.) #for account in app('Adium').account.get(): # account.status_message.set(newestTweet)
