I'm going to take a stab at making this a little nicer to maintain. I'll probably end up parsing it with nokogiri. What other options do you think would make this easier to maintain?