Political Web Sites

It’s the BBC Mashed hack session this coming weekend, so I suppose lots of people are trying to think of a project to work on. I have an idea that involves UK political web sites.

I expect that most MPs have a web site. A far smaller number of them have a blog. Some of them use blog-like software to publish news and other similar web feeds. Part of what I want to do is to build a directory of those URLs. I can’t see any way to do this other than trying to track down each of the 646 MPs on the web and poking around on their sites to find all of the interesting URLs. I’m hoping I can get some help with that.

But there are also sites about MPs that are run by other organisations. These ones are easier to track down. For example, They Work For You has a page for every MP. The page for my MP is


So that looks easy enough. You just use the name of the MP and the name of the constituency. Public Whip has a similar mechanism. My MP’s page on Public Whip is


Then there are the news organisations. The BBC has a page about my MP. It’s at


In this case there’s a magic number (35) and in order to construct these URLs for other MPs, you’d need to map these numbers to MPs (or constituencies).

The Guardian has two pages. One for the MP and one for the constituency.

http://politics.guardian.co.uk/person/0,,-3146,00.html http://politics.guardian.co.uk/hoc/constituency/0,,-696,00.html

Again, each of those contain magic numbers that you’d need to get a complete list of. And I assume (or, at least, hope) that these pages will one day be given shiny new URLs like other parts of the Guardian site.

It’s this second part of the problem that I want to concentrate on first. Building URLs to external sites pro grammatically. And this is where you, gentle reader, can help me. I have two questions that you might be able to answer.

  1. I’m sure I’m missing some external sites. To be honest, I haven’t really looked very hard yet. I’d be surprised if some of the other national papers didn’t have similar pages to the Guardian. Do you know of any other good sites that have pages dedicated to each individual MP or constituency?
  2. Do any of you work for organisations that publish these pages? If so, is there any chance that you could sent me lists of the “magic numbers” that appear in your URLs? What I’d need is something like a CSV file (or whatever format is convenient for you) that maps your magic numbers to a recognisable name for an MP or a constituency. I can then map your data to my list of MPs. I know it’s a bit cheeky, but it doesn’t hurt to ask.

There’s still one part of the puzzle missing. A surprising number of people don’t know the name their MP or even their constituency. So an important part of the system will be a search engine. At the very least, I’ll need the ability to convert a postcode to a constituency (or MP). All of the sites I mentioned above do this. It would be great if one of them made the look-up available as a web service.

Of, and one last thing. If you’re going to Mashed and don’t have a project to work on and this sounds interesting to you, then please get in touch. Feel free to link up with me on the backnetwork site.

Update: If you listen, you can probably hear the sounds of my kicking myself very hard because I forgot to check the They Work For You API before writing this entry. It does a lot of the kinds of things that I will need. There’s even a Perl module – which makes me very happy.


  1. You called? Firstly, there are 646 MPs :-)TheyWorkForYou already offers postcode to MP/constituency lookup via its API: http://www.theyworkforyou.com/api/docs/getMPIt also already has all the Guardian/BBC data in various XML files/databases mapping their ID numbers – I’d have a look around in http://ukparse.kforge.net/svn/parlparse/members/ or try the getMPInfo API call. We have some, but not all, MP website information in websites.xml – improving that would be good!Sadly it’s not as simple as taking name and constituency for TWFY URLs, e.g. Lady Hermon isn’t listed under her actual name of Sylvia Hermon – this is because she is listed as Lady Hermon in Hansard.Wikipedia’s external links section on MP pages might be a good place to get some links from programatically? :)P.S. Without JavaScript, I enter all this text, click Submit and just get told “Invalid request” :(

  2. This is why I love the internet. Within minutes I get one really useful answer and not long afterwards I get another, even better, one.Thanks to both of you. I’ll certainly be playing with these suggestions this evening.The “649” was a typo… honestly. I do really know how many MPs there are in the House of Commons.And, hopefully, the comment submission error is due to the fact that this is a beta version of Movable Type. I should really update it to the newest release candidate.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.