atom2rss: a poorly written Atom to RSS converter

Not to vent, but Blogspot’s default of outputting Atom and no RSS for its users gave me all sorts of headaches. A huge expense in time that that drove me away from more important matters at Philly Future. CivicSpace/Drupal’s aggregator does not handle Atom. That means if you are on Blogspot, a site like Philly Future could not include you. An upcoming version of Drupal’s aggregator will have this capability. Bryght’s hosted Drupal solution does right now. However, I couldn’t wait for Drupal to release an aggregator with Atom functionality, and I’m self-managing Philly Future – so I needed my own solution.

A simple service that would, upon passing it a URL of an Atom feed, produce RSS, be best. That way I could avoid hacking Drupal code. A few folks suggested I use Feedburner, and for a while I did, until I read the terms of service. I was, inadvertently, claming I owned those feeds! Once I discovered this, I removed those feeds from my Feedburner account and found another way. After an exhaustive search on Google, I found a few Python implementations of what I was looking for, but no PHP. The hosted web services that I did find wanted to charge money, or warned they were to stop service at any moment. I had to do it myself.

Not that anyone needs converters like this anymore as most services and aggregators handle both Atom and RSS, but I figured it would be a good thing to release for others reuse, so here it is. Using the required Magpie RSS, the PHP RSS Parser library, it retrieves, caches, and parses the passed in Atom feed, iterates over its items, and outputs RSS. A brute force approach, certainly not perfect, nor complete in terms of the metadata it attempts to convert, but one that has worked for the great many Atom feeds Philly Future encounters.