Sucking tweets into a local database

A friend asked me yesterday if I could snap together a script to build a local database of tweets using the twitter search API.

This is what I came up with.

The script takes one argument – the term to search on – and creates a sqlite3 database in the current directory containing all the tweets that the twitter search API returns for that term.

It requires datamapper and twitter_search gems to be installed.

Have at it, make it better, bend it to your twitter-slurping needs.

List of UK MPs on twitter

I just spent several hours building a list of MPs on twitter by harvesting, cross-tabulating and advanced munging of various lists on twitter.

Yes, I know it’s already been done by tweetminster and there are lists on listorious, probably elsewhere too.

But there are none that I know of that are freely available, which are amenable to inserting into a database for twitter-bot magic, nor which connect to any other online profiles of MPs – I use the public whip ids from MySociety’s parlparse project.

Linked data, innit?

There are bound to be errors and omissions, so let me know if you have any corrections and I’ll update. And if there’s someone else doing this better, I’ll gladly defer to them.

Do what you want with this data – hell, you could even republish it in RDF if you want.