October 11th, 2012 at 9:17 am by Dr. Drang
Once upon a time, 5by5 didn’t offer combined feeds that allow you to subscribe to both a regular show, like Back to Work, and its After Dark coda. There were simply feeds for the shows proper, and a single After Dark feed that gave you the ADs of all the shows. So even if you had no interest in certain shows—The Critical Path, for example—you’d get their After Dark episodes anyway and have to delete them manually from your podcast player to avoid disruption. Back in those benighted times, I wrote an XSLT filter that deleted from the amalgamated AD feed all the shows I wasn’t interested in.
Now, of course, we live in a bright and shiny future. Within a couple of weeks of my XSLT exercise, Dan Benjamin started offering the combined feeds, a no-fuss, no-muss way for regular folks to get only the ADs they want. I suspect Dan’s change was motivated by the same thing that inspired me to write the filter—these two tweets from Jason Snell:
The “Smart Playlists” feature in Instacast 2 isn’t smart. I’d like only @5by5 After Darks from certain podcasts, but it can’t filter that.
— Jason Snell (@jsnell) Mon May 14 2012 8:11 PM CDT
(Solution: I made a Yahoo Pipe that takes in the After Dark feed, filters by show title, and then outputs a new RSS feed.)
— Jason Snell (@jsnell) Mon May 14 2012 8:26 PM CDT
You’d think the new combined feeds would make my filter obsolete, but unfortunately Downcast’s search tool never seems to find them.
Now, I know I can enter the combined feed addresses manually, but that means typing in a half-dozen or so URLs, and I’m too lazy for that. So I’ve stuck with my old solution: a single feed URL that leads to my filtered version of the full AD feed. I did have to enter this address manually, but there was only one of them.
With the recent FeedBurner unpleasantness, Dan’s pulled all the feeds from feedburner.com and started hosting them himself, which has caused a few problems.
If you use Downcast, you’ll need to resubscribe to the feeds. Sorry to sound like a broken record but people keep asking.
— Dan Benjamin (@danbenjamin) Wed Oct 10 2012 8:45 PM CDT
One of the problems was that the new AD URL broke my filtered feed. I was subscribed to a URL on my server that ran this CGI script:
bash: #!/bin/bash echo "Content-type: text/xml" echo xsltproc afterdark.xslt http://feeds.feedburner.com/5by5-afterdark | sed '/^ *$/d'
That FeedBurner URL now returns this XML,
xml: <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"> <channel><title>(Obsolete Feed)</title><link>http://feeds.5by5.tv/afterdark</link> <description>Old feed that has moved to http://feeds.5by5.tv/afterdark</description><item><title>Feed has moved</title><description>
which is nice, in that it provides the new link, but unfortunately
xsltproc just sees an XML file and tries to process it—it doesn’t treat it as a redirect.
The solution, though, was simple: just give the CGI script the new feed URL,
#!/bin/bash echo "Content-type: text/xml" echo xsltproc afterdark.xslt http://feeds.5by5.tv/afterdark | sed '/^ *$/d'
and everything is back to normal. No need to change the XSLT file itself.
Just for completeness, here’s the XSLT filter:
xml: 1: <?xml version="1.0" encoding="utf-8" ?> 2: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 3: 4: <xsl:output method="xml" encoding="utf-8" indent="yes"/> 5: 6: <!-- First, get everything. --> 7: <xsl:template match="node() | @*"> 8: <xsl:copy> 9: <xsl:apply-templates select="node() | @*"/> 10: </xsl:copy> 11: </xsl:template> 12: 13: <!-- Then restrict to just certain items. --> 14: <xsl:template match="/rss/channel/item"> 15: <xsl:if test="title[contains(., 'Incomparable') or contains(., 'Build and Analyze') or contains(., 'Back to Work') or contains(., 'Hypercritical') or contains(., 'Ihnatko') or contains(., 'Mac Power Users')]"> 16: <item> 17: <xsl:apply-templates select="node()" /> 18: </item> 19: </xsl:if> 20: </xsl:template> 21: 22: </xsl:stylesheet>
If you’re interested in how it works, see that earlier post.