Backing Up Your Twitter Posts
By user12607856 on Mar 02, 2009
I wanted to make sure I had a way to locally save my
pearls of wisdom drivel. From googling, I'd
but didn't like the idea of passing over my username
and password to a site I didn't know.
$ gzip -dc python-twitter-0.5.tar.gz | tar -xvf - $ cd python-twitter-0.5 $ python setup.py build $ pfexec python setup.py install
Now "backing up" my tweets is as simple as running:
$ python backup.py > richb-tweets.txt
where backup.py is:
import twitter api = twitter.Api() statuses = api.GetUserTimeline("richburridge") for s in statuses: date_ts = " ".join(s.created_at.split()[:4]) print "%s: %s\\n" % (date_ts, s.text)
for output that looks like:
Mon Mar 02 20:39:10: Oooh! Twitter has a Python front-end to it's API: http://code.google.com/p/python-twitter/ I can see hours of tinkering ahead. Mon Mar 02 19:10:46: Added twitter monitor thingy to left column on main blog. Didn't help that Twitter went oopsie while I was debugging this. ...
(Adjust the "richburridge" user name to your own, if you want to use this).
Still lots more to explore with python-twitter, but that's enough for today.