PapaScott I like big blogs and I cannot lie! 🐘

Really Stupid Atom Support

(for Magpie RSS 0.52 and Feed on Feeds 0.1.1). Many blogs are already sporting Atom 0.3 feeds, and some have even declared their RSS to be deprecated. So I decided to try to bolt Atom support onto my aggregator of choice. It turned out to be pretty easy, requiring patching just 2 files.

However, my approach is very simplistic, simply representing Atom items in Magpie such that FoF can understand and display them. I'm sure that Kellan and Steve will eventually fully support Atom feeds. But until they do, here is the patch to init.php and parse_rss.inc. I thought about calling it 'Really Stupid Support for Atom', but the acronym 'RSS for Atom' would have confusing to say the least.

Disclaimer: this works for me, at least for the three Atom feeds I've tried. It may not work for you.

If you're interested in the gory details, I basically made 3 changes:

  1. Magpie will parse anything that remotely resembles RSS without bothering to validate it. While RSS is a 'channel' containing several 'items', Atom is a 'feed' containing several 'entries'. So I just told magpie to treat a 'feed' as a channel and an 'entry' as an item.
  2. Magpie doesn't parse XML attributes at all. However, 'links' in Atom are defined purely as attributes, and each 'feed' or 'entry' can have several links, while in RSS a 'link' is simply a string. So I had Magpie create an array of items for each link.
  3. I then told FoF about the new elements in the array, for example to use the 'tagline' for the 'description' if it exists. I also wrote a function for FoF to select the first appropriate link if the link is an array instead of a string.
comments powered by Disqus