Monday, February 14, 2011
MagpieRSS with RSS2.0 and Atom1.0
This post is for the Googlers.
As I was making my Friends 3.0 page, where I have my friends' blog entries as if they were posted on my site, I came across some limitations of Magpie RSS. The software is very good at making a big array out of an RSS feed, but it can't handle some of the newer web standards like RSS 2.0 and Atom 1.0. When I started to add a lot of personal feeds to the friends page, magpierss's limitations became more apparent.
As much as I searched, I couldn't find a real solution other than completely rewriting my friends page based on other RSS parser like Simple RSS. Luckily, I came across a hack of Magpie on Google, and I wish I could remember where it came from so I could give credit. The page wasn't even available anymore, but Google had cached it, and I managed to copy it. I had to do a lot of editing to remove the HTML formatting, but it does what it promises, and gives magpieRSS the RSS 2.0 and Atom 1.0 support it so desparately needs these days.
That's not the only thing special about this hacked together MagpieRSS file though. It seems Wordpress sites have broken most Magpie RSS feeds with it's "media:content" tag. For some reason, when MagpieRSS parses this tag, its "content:encoded" tag changes simply to a big letter "A". It through me for a loop for a while, and not seeing a good fix online, I simply edited the Magpie parser to ignore "media:content". This fixes the content:encoded issue, which I think is more important than some media file anyways.
The last edit of the MagpieRSS deals with categories. Many feeds list assigned categories with by having each one in a
MagpieRSS will simply append the category array value each time so you end up with "SportsBaseball". My version appends a '@@@@' at the end of each category, so the array value will be "Sports@@@@Baseball@@@@". From there you can use the php function 'explode' to separate each category from the string.
Hopefully, someone out there will find this useful.