Twitter backup

Continuing on the theme of small tools, a tweet from John Siracusa just reminded me that I really should back up old tweets. So I wrote a very bare-bones Python script to dump all of a user’s public tweets into RFC2822-style files, each named with the ID of the tweet it represents.

From the command line you can archive my tweets like this:

$ mkdir tweets
$ cd tweets
$ tweet_backup.py rvcx

If for some reason you want to archive your own tweets instead of mine, then replace rvcx with your own twitter name.

Update

I hadn’t noticed when I threw it together, but of course this script makes use of the json package only available in Python 2.6+. (It also uses a with statement, but that’s trivial to replace.) If you’ve got a real need for a backup script that runs in Python 2.5 or 2.4 get in touch and I’ll find a way to make it work; 2.6+ is sufficient for my needs.