Parsing Podcasts with MagpieRSS
MagpieRSS, my favorite RSS and Atom parser for PHP, doesn’t natively support the <enclosure> tag used in podcasts. This is because Magpie looks for values between an open and close tag and the enclosure is modeled with attributes:
<enclosure url="http://www.leipzig48.com/compositions/ghost/tistime.mp3" length="30720" type="audio/mpeg" />
The developer of Magpie is currently working on standardizing the handling of attributes, but, in the interim, there is a patch available to handle enclosures (thanks to Jude Venn and Mike Krus). This is good, because a podcast without an enclosure isn’t much of a podcast.
- Download the patched version of rss_parse.inc.
- Replace the current rss_parse.inc with the downloaded patch.
- Access the <enclosure> attributes in your script:
echo $arrItem[’enclosure’][0][’url’];
echo $arrItem[’enclosure’][0][’length’];
echo $arrItem[’enclosure’][0][’type’];

January 31st, 2007 at 10:22 am
[…] plus a patch to pick up enclosure tags, with instructions from schiller labs, nice […]
February 6th, 2007 at 10:07 am
[…] a patch to pick up enclosure tags, with instructions from schiller labs, very nice, and […]
April 9th, 2008 at 5:49 am
Hi,
The code appears to have been deleted. I picked up a copy off the google cache and I’ve placed it here:
http://sites.google.com/a/kev.cc/laughingmeme-rss-with-enclosures-mirror/Home
(I’ll take that down if you want me to)
Thanks for your sterling work!
Kev
January 8th, 2009 at 8:54 pm
[…] Source […]
January 25th, 2009 at 4:16 pm
hey man cheers for the fixed script, but im having troubles printing my enclosures
when i put the
$arrItem[’enclosure’][0][’url’];
into the script instead of printing the url of the mp3 its prints the url of the page, am i using this wrong? can you help me out?
many thanks
ben
February 28th, 2009 at 2:45 am
[…] 这里引用schillerlabs.net的解决方法,修改rss_parse.inc文件 ç„¶åŽè¿™æ ·èŽ·å–echo $arrItem[’enclosure’][0][’url’]; echo $arrItem[’enclosure’][0][’length’]; echo $arrItem[’enclosure’][0][’type’]; […]
March 1st, 2009 at 6:01 pm
I really liked the way they came off
March 1st, 2009 at 6:09 pm
i just wanted to say that I love this site