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’];

WordPress database error: [Can't open file: 'wp_comments.MYI'. (errno: 144)]
SELECT * FROM wp_comments WHERE comment_post_ID = '32' AND comment_approved = '1' ORDER BY comment_date

Leave a Reply

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