Monday, June 29, 2009

tweet tweet

If you don't use twitter, you won't care about this post. FYI.

I wrote a little python commandline script to tell me followers I've gained and lost. The gained part twitter already implements (you can get emailed or just visit your follower page; new followers are at the top) but it doesn't give me a way of seeing who has stopped following me, and I got curious when I saw the numbers fluctuate a lot. I have been meaning to hook this up as a cron job to email me once a day; that way one could theoretically track if certain tweets are making people unsubscribe :) I need to install some mail server thing on my machine though.

This was a tiny little twitter-related project to poke at the API when i was sick, not something i did because i'm really crazy about who is following me (i realize you probably don't believe that). If anyone knows how to adjust the code so that I don't constantly run into the 100 requests/hour limit, please let me know. Oh, and I did not pay attention to performance, robustness, or portability when writing this so don't make fun of me.

If you want to use it, download the script, make a subfolder called "gold" and run

python tw.py gen neha

to generate a gold file of who is following neha, and

python tw.py diff neha

to see followers neha has gained/lost since the last time you ran it. After the initial gen you will not need to run it again unless you want to fastforward a lot.


Update: Added error checking and it continues if a twitter id returned as a follower is bogus (which happens, interestingly enough)