San Francisco Elections Parser

for those of us who can't wait until tomorrow to slice and dice or process tonights local data :)

warning: this code is really bad, and in no way optimized. i put it together in the course of an hour on an old mac with php 4.x, use at your own risk.

license: cc by-sa / gpl, your pick!

by dana sniezko (hackinginthecity.wordpress.com) or dana at thecoocoup dot com

description: this code will parse the the san francisco elections html and export it in an easier to use xml format. i am using this as part of a local election visualization at a party tonight. that code will be released too if i get it stable --- it is a lot nicer looking :)

please be considerate and cache your election data on your server! my $5 hosting will likely crash under pressure, and we don't want to crash the elections site.

use a cron job and a php or perl script to do this or even cron and curl/wget!

curl -o vote.html http://www.sfgov.org/site/elections_index.asp?id=70720&mode=text

files:

php source

example xml output (only a sample, not live)

live xml feed (updated every 15 minutes)