Monday, February 14, 2011

MagpieRSS with RSS2.0 and Atom1.0

MagpieRSS.zip

RSS 2.0 / Atom 1.0 / Wordpress Fix / Category Fix
02/13/11

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 tag, like:
<category>Sports</category>
<category>Baseball</category>

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.
Posted by eclipse on 02/14 at 12:08 AM
Possibly Related Posts:
01/25/2011 - PHP Programming and Google Adsense
04/29/2010 - FreeNAS Review
02/10/2010 - Endeavour, Always
01/23/2010 - It's Been a Long Time
01/05/2010 - Once upon a Database Query
10/27/2009 - Installing rutorrent on your AppleTV
07/13/2009 - The AppleTV Experiment Continued
05/21/2009 - Friends Page Architect
11/29/2008 - Dark Mercury 4.0
11/05/2008 - Website updates for november
10/11/2008 - It's been a long road
10/08/2008 - LAN Weekend and Days Off
10/04/2008 - Another round of website updates
09/03/2008 - Apple iPhone Review
08/19/2008 - Welcome to DarkMercury.net!
01/10/2006 - The Pro from Cupertino
10/25/2005 - Site upgraded to 2.4 pro
10/06/2005 - DGS News
10/05/2005 - I'm a rebel
10/03/2005 - Test Number 2
10/03/2005 - This is a test
06/01/2005 - Behold - The DGS is back!
03/10/2005 - Eclipse RSS

Name:

URL:

Smileys

Remember my personal information

Submit the word you see below:


Previous entry: PHP Programming and Google Adsense
Next entry: Left 4 Dead 2