home | web-mapping | data | scripts | bestiary | about | archive

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.

  1. Download the patched version of rss_parse.inc.
  2. Replace the current rss_parse.inc with the downloaded patch.
  3. Access the <enclosure> attributes in your script:

echo $arrItem[’enclosure’][0][’url’];
echo $arrItem[’enclosure’][0][’length’];
echo $arrItem[’enclosure’][0][’type’];

8 Responses to “Parsing Podcasts with MagpieRSS”

  1. integrating an rss feed into an html page « noah little Says:

    […] plus a patch to pick up enclosure tags, with instructions from schiller labs, nice […]

  2. Pauline McNamara @ NTE » Blog Archive » Display a feed in a different html page Says:

    […] a patch to pick up enclosure tags, with instructions from schiller labs, very nice, and […]

  3. Kevin Says:

    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

  4. Techachino » How To Access Attribute Values With MagpieRSS Says:

    […] Source […]

  5. ben Says:

    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

  6. 使用magpierssè§£æžRss,Rss采集,支æŒè§£æžå±žæ€§ « 爱人-爱人的大æ‚烩 Says:

    […] 这里引用schillerlabs.net的解决方法,修改rss_parse.inc文件 ç„¶åŽè¿™æ ·èŽ·å–echo $arrItem[’enclosure’][0][’url’]; echo $arrItem[’enclosure’][0][’length’]; echo $arrItem[’enclosure’][0][’type’]; […]

  7. Dail Says:

    I really liked the way they came off

  8. Malila Says:

    i just wanted to say that I love this site

Leave a Reply

schiller labs is powered by wordpress . dev site and tool shed for emptystreets.net . valid xhtml . valid css