Several months ago I needed a way to keep my "blogroll" (list of RSS feeds I read, as seen on the side of my blog index page) up to date. Luckily, my news aggregator kept all the information in an OPML file called myChannels.opml. All I needed to do was extract the relveant information, sort it, spit out some HTML that can be included via SSI or PHP, and set it up to run from cron so that I don't have to think about it.

So I spent a few minutes on the problem and hacked out opml2html.pl. It's simple but does the job for me. Simply feed it an OPML file on STDIN and it'll spit back the XHTML code on STDOUT. That means you can run it like this: opml2html.pl < foo.opml > bar.html

A while back someone asked me how it I did this, so I sent the script. A few days ago, fellow Yahoo Michael Radwin asked how I did it. I sent him the script too. It turns out that his aggregator also produces a useful OPML file. He sent back patch today that improved it. That was enough to convince me that it's probably useful enough to share.

If someone is willing to patch your code, odds are good that several others are willing to use it.

Posted by jzawodn at December 26, 2002 02:51 PM

Reader Comments
# Jay Han said:

Jeremy: I did something similar with XSLT for my subscription OPML on Radio.

I admit your perl is tighter than my XSLT...

on December 26, 2002 03:31 PM
# Morten Frederiksen said:

<plug>
Another XSLT solution to this, with integrated subscription links, is at http://purl.org/net/syndication/subscribe/.

See for example Jay Han's list at this address.
</plug>

on December 26, 2002 05:05 PM
# l.m.orchard said:

I've been meaning to do this for ages and ages, but never quite crossed the laziness threshold :) I just set this up with my iBook, to rsync an HTML rendering of my AmphetaDesk subscriptions every few hours. I think it needs quite a bit of tweaking before it doesn't look like complete crap :)

on December 26, 2002 08:20 PM
# Geodog said:

Cool. I'll give it a whirl too, if you don't mind.

on December 26, 2002 09:05 PM
# l.m.orchard said:

(oh, in case I didn't make much sense: what looks like crap is my site, not the script :) )

on December 27, 2002 03:43 AM
# steven hatch said:

Here's a bit of Python code by Phillip Pearson that'll do the blogrolling trick as well.

on March 1, 2003 01:42 PM
# Gavin said:

I was inspired by your efforts to do a blogroll in OPML, but I ended up writing a Template Toolkit plugin for MT to do it :)

http://www.estey.com/archives/000124.html

on March 16, 2003 04:12 PM
Disclaimer: The opinions expressed here are mine and mine alone. My current, past, or previous employers are not responsible for what I write here, the comments left by others, or the photos I may share. If you have questions, please contact me. Also, I am not a journalist or reporter. Don't "pitch" me.

 

Privacy: I do not share or publish the email addresses or IP addresses of anyone posting a comment here without consent. However, I do reserve the right to remove comments that are spammy, off-topic, or otherwise unsuitable based on my comment policy. In a few cases, I may leave spammy comments but remove any URLs they contain.