Backing Up Your Twitter Posts
Now I'm
twittering
I wanted to make sure I had a way to locally save my
pearls of wisdom drivel. From googling, I'd
found
tweetake
and
twistory
but didn't like the idea of passing over my username
and password to a site I didn't know.
I then stumbled on a Python frontend to the Twitter API. I downloaded the compressed tarball and unpacked, built and installed it with:
$ 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.
( Mar 02 2009, 02:26:58 PM PST ) [Listen] Permalink











