Automatically Generated Blogroll from Bloglines #

I previously described how I automatically generate my blogroll by exporting NetNewsWire's subscriptions (with the hierarchy intact), generating a snippet of HTML and then embedding it into a MovableType template that's rebuilt automatically (I haven't upgraded to 3.1 yet, thus its support for dynamic pages won't help me). In the meantime, circumstances have changed (I don't use the same computer throughout the day, or even the same platform), which have compelled me to switch to the equally great Bloglines as my aggregator. As a result, I now needed a new way to share my subscriptions.

Thoughtfully enough, Bloglines does provide a way to generate a blogroll, but it has a couple of limitations. The generated HTML is a bit clumsy, not using <ul> or <li> tags for what is clearly a list of data, and also being a bit too verbose by applying a blogrollitem class to every single item — perhaps I have drunk the semantic markup Kool Aid too deeply. But more importantly, the list only includes the website URLs for the sites, and makes no references to their feeds. A better solution is to use the Bloglines Sync API since the OPML file it exports has both the folder hierarchy and the feed URLs. I initially considered just writing an XSLT to turn the OPML into the HTML that I needed, but in the end the WebService::Bloglines Perl module turned out to be more convenient.

The net result is bloglinesBlogroll.pl, a simple script that does all of the above. It is invoked every night via a cron job, and its output is visible in the Daily Reads section of the sidebar.

Post a Comment