Site Map - skip to main content

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes every weekday Monday through Friday.
This page was generated by The HPR Robot at


hpr1362 :: Fixing a bad RSS feed

Perl scripts to modify broken RSS feeds on the fly

<< First, < Previous, , Latest >>

Thumbnail of Dave Morriss
Hosted by Dave Morriss on 2013-10-22 is flagged as Explicit and is released under a CC-BY-SA license.
RSS, Perl, podcast, scripting. 1.
The show is available on the Internet Archive at: https://archive.org/details/hpr1362

Listen in ogg, spx, or mp3 format. Play now:

Duration: 00:21:07

general.

There have been problems with the podcast feed for "mintCast", apparently as a result of a bug in Wordpress. The feed contains multiple "enclosure" tags containing the same audio over and over again. While the mintCast hosts are looking for a fix I would like to find a local work-around.

I have also encountered a problem with the "Pod Delusion Extra" feed which contains multiple enclosures in some episodes. Unlike the "mintCast" example I don't want to lose these enclosures but want to find a way of repackaging them into individual episodes.

These problems affect some podcatchers, the modified Bashpodder I use being amongst them. To counteract this problem I have written two short Perl scripts to copy and clean each feed before submitting it to my podcatcher.

Detailed notes: https://www.hackerpublicradio.org/eps/hpr1362/Dealing_with_bad_RSS_feeds.html


Comments

Subscribe to the comments RSS feed.

Comment #1 posted on 2013-10-25 16:40:37 by Ken Fallon

There is another way

While there usually is another way with perl, this time there is another way with the xslt. This is the xpath will select only the @type where the string is set to "audio/ogg" and then only display the first one. <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="https://www.w3.org/1999/XSL/Transform" xmlns:exslt="https://exslt.org/common" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/" xmlns:georss="https://www.georss.org/georss" xmlns:geo="https://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="https://search.yahoo.com/mrss/" version="1.0" extension-element-prefixes="exslt"> <xsl:output omit-xml-declaration="yes" indent="no" method="text"/> <xsl:template match="/"> <xsl:for-each select="/rss/channel/item/enclosure[@type="audio/ogg"][1]"> <xsl:call-template name="value-of-template"> <xsl:with-param name="select" select="@url"/> </xsl:call-template> <xsl:value-of select="' '"/> </xsl:for-each> </xsl:template> <xsl:template name="value-of-template"> <xsl:param name="select"/> <xsl:value-of select="$select"/> <xsl:for-each select="exslt:node-set($select)[position()>1]"> <xsl:value-of select="' '"/> <xsl:value-of select="."/> </xsl:for-each> </xsl:template> </xsl:stylesheet>

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Title:
Comment:
Anti Spam Question: What does the letter P in HPR stand for?
Are you a spammer?
What is the HOST_ID for the host of this show?
What does HPR mean to you?