the further adventures of

Mike Pirnat

a leaf on the wind

« Previous Post Next Post »

Things That Go Geek in the Night

One of the things I want to be able to do on the forthcoming (one of these years) website is to automatically update its home page with the one or two or three most recent entries from my journal, all nicely formatted and loved up with some CSS. I have looked around a little online and found several parsers that do various 0.9x and 1.x versions of RSS, but nothing jumped out at me that did RSS 2, or at least claimed to. Well, that just won't do, I thought to myself, I should write my own, and promptly shelved the idea for awhile.

Until tonight.

I wasn't terribly sleepy, and for some reason I felt vaguely motivated (I think it's because the printer is out of color ink and I can't print CD labels), so I sat down and wrote a parser for the RSS 2 output that LiveJournal produces. It's not bullet-proof, and it's kind of silly because it doesn't use any of the Python XML libraries to parse the file (partly because I left my nice Python book at work, and partly because I didn't want to spend the time learning the XML libs tonight if I didn't have to).

But it works, and I get a nice Python dictionary that I can do with what I will.

I'd sound the appropriate "w00t!" but I'm afraid I'd wake Liz, and then she'd have to kick my butt, which would definitely put a damper on an otherwise lovely evening.

blog comments powered by Disqus

« Previous Post Next Post »