Combining RSS feeds into one feed and page

I’ve finally got round to finishing my script for combinging all my various fragments of web output into one beautiful stream. At I have a weblog of my writing, which this entry is part of, and a weblog of notes. I also have my links at which I now automatically aggregate daily and post to a local weblog. Finally, I have all the photos I post at Flickr.

I didn’t like having a different RSS feed for each source, and separating them all out on my home page — it all seemed unnecessarily clunky and too much work for the few people who want to see what I’ve been doing recently. So I wrote a script that grabs four feeds and combines them into one, also creating a combined chronological front page for the site.

The trickiest bit was pulling all the Flickr photos from one day into a single, compact, daily item but making sure I didn’t flood the front page or the feed if I post post dozens of dull photos in a single day. Instead only the most recent are displayed, with a link to see the rest. Deciding how much information to display generally is a tricky balancing act: I chose to show the photo descriptions in the feed, but not on the page; and the feed gets the full text of my writing and notes while the page just gets the first paragraph.

Anyway, it’s not quite beautiful (I’d dearly love to redesign my entire site) but it does the job. I’ve put up a version of the perl script I’ve written in case it’s of use to anyone else (or in case anyone can tell me anything I’ve done really badly).

If you really find this interesting, you might also like to read Ben Hammersley’s post from yesterday about posting entries from various feeds into a single Movable Type daily entry. And, of course, Feedburner can do all the combining of Flickr photos and links into your feed for you if you don’t want to get your hands too dirty.