The RSS Blog

News and commentary from the RSS and OPML community.

This morning, I was building an image and video application and needed some RSS sources to seed the image and video database. I picked three feed sources: Google Video, Yahoo Video and Flickr. The first thing I noticed was that only Yahoo Video used RSS enclosures, whereas all three used Media RSS. I decided to write the code once using Media RSS and drop RSS enclosure support. I wasn't too happy about making this decision. Had Flickr and Google simply used RSS enclosures in addition to the Media RSS elements, then I could've written this application for general RSS enclosure support. It's not like this would've been difficult as RSS enclosures look almost exactly like Media RSS content. A sample of each element follows.

<media:content url="http://www.youtube.com/v/aVN_VZhLiCg.swf" fileSize="30" type="application/x-shockwave-flash" height="356" width="450" duration="1" />

<enclosure url="http://www.youtube.com/v/aVN_VZhLiCg.swf" length="30" type="application/x-shockwave-flash" />

Using an extension element in place of an equivalent core RSS element is what we call Funky RSS and much not appreciated by people trying to write RSS applications. The reason we don't appreciate it is because the core RSS elements are better understood and you don't end up with the ridiculous situation that I'm about to describe.

Although all three sources use Media RSS, I had to write separate code for all three implementations. All I wanted to do was access the media:content/@url attribute and all three conveniently had unique access paths to this variable. Here's three feeds that I'm looking at.

  1. http://www.flickr.com/services/feeds/photos_public.gne?tags=Simon+Gagne&format=rss_200
  2. http://video.google.com/videofeed?type=search&q=Simon+Gagne&so=0&num=20&output=rss
  3. http://api.search.yahoo.com/VideoSearchService/rss/videoSearch.xml?appid=kbcafe.com&query=Simon+Gagne

Using fully qualified element names, the access paths are as follow.

  1. item.http://search.yahoo.com/mrss/:content.@url
  2. item.http://search.yahoo.com/mrss/:group.http://search.yahoo.com/mrss/:content.@url
  3. item.http://search.yahoo.com/mrss:content.@url

Looking deeper, two of the three implementations appear to be invalid, but which two are invalid is the question. Let's start with the namespace. According to the Media RSS spec, the namespace URI should not have a trailing slash, but according to the Feed Validator, the namespace URI should have a trailing slash. It also turns out that at one point, the spec did have the trailing slash, but later it was removed. This was previously discovered in February 2007 and Yahoo has dropped the ball since. Turns out, the feeds are not really valid or not. It's actually the spec that is invalid.

Conclusion? Had Google and Yahoo simply used the RSS enclosure element, then I would be long done by now. Instead, I have three times the code I really need. Frustrated.

Reader Comments Subscribe

I have asked countless times for a use-case of multiple enclosures per item. Each time, I outlined how this is done while respecting the constraint. The only response is "But I don't want to do it that way." I've never encountered a technical reason why this is limiting.

So, I ask you to provide a use-case and you are not allowed to respond to my solution with "I don't want to do it that way."

Randy

From the spec:
  • The following elements are optional and may appear as sub-elements of channel, item, media:content and/or media:group
- Sam Ruby

Sam,
I can only guess that your statement is meant to contradict my statement above, but it doesn't.
Thanks,

Randy

Sam,
Agreed. But I don't see how this is relevant. The validation issue is the cardinality of media:content in media:group. Two or more. Not one.

From the spec: It's an optional element that must only be used for this purpose.

Randy

I have a great use case for multiple enclosures in a single item: we publish a podcast of a 4-hour radio show. Each show is broken up into four 41-minute segments (commercials, station IDs, etc. removed).

In my current RSS feed, I have to display each show as "Show Name, Part X" with a single enclosure. This makes my RSS feed 4 times the size it needs to be, and limits the number of episodes that can be included in the feed.

I'll go read the specs on media:group, but from what you're saying above, there is some discrepancy between sources as to the validity of media:group/media:content and enclosure, correct?

Thanks,
Bob

Bob,
I just wanted to point out that you included the solution in your comment. As per the size of your RSS feed, this would be insignificant compared to the size of a 41-minute audio file.

I'm not sure what "discrepancy between sources" means.
Thanks,

Rand

Sorry, poor choice of wording on my part. Acceptance by third parties is really the discrepancy issue I was talking about. For instance, I can (and did) set up a nice, valid RSS test feed that includes each part of an episode under a single item using media:content. But will iTunes, for instance, display each part or only one, or reject the feed outright? Feedburner supports media:content, but still only one media file per item.

As for the size of the RSS feed, some services won't accept a feed file over a certain size (Feedburner again, for instance, limits theirs to 512Kb). That limitation, combined with the fact that each of our episodes must be broken into four channel items, makes it difficult to push out more than a few episodes at a time.

Now, I'm not attempting to push our entire library out via RSS, as we have over 100 episodes, but it'd be nice to show more than we currently are able.

Cheers,
Bob

512KB is a really big for an XML file.

Randy

How bad of me to malform the link...sorry

--

Type "339":