Enclosures in yahoo media, rss, and atom

From Bjoern Hassler's website
Jump to: navigation, search
syndication  |  resource discovery  |  formats  |  Syndication and metadata  |  Using media rss to syndicate and share media  |  Media rss media group element  |  Overview of images in rss  |  Category:Syndication
Using Yahoo media for content aggregation
Working with Yahoo Media
Using media rss to syndicate and share media
Example feeds
Formats
metafeed
feedheader
short item
full item
The yahoo media content and group elements
Enclosures in yahoo media, rss, and atom
Media rss media group element
Media rss media group alternatives scheme
Appendix
Atom media extension
Overview of images in rss

Printing and index

1 Enclosures in yahoo media, rss, and atom[edit]

In this section we briefly step back from yahoo media as such, but consider the rationale for using yahoo media in comparison with atom and rss. Once we have done this, we return to the specifics of the media:group and media:content elements.

1.1 Why do we need yahoo media?[edit]

Sometimes the need arises to include more than one piece of media with a particular item. It is often argued that this isn't possible in RSS, but that Atom needs to be used instead. These differences are largely semantic: In RSS 2.0 and Atom, namespaces are supported, so anything is possible. The more salient question is what constructs are supported by feed readers and parsers.

Related discussion: Atom media extension, Using media rss to syndicate and share media.


1.2 A plain RSS 2.0 enclosure[edit]

An the rss enclosure:

<item>
...
     <enclosure url="http://www.foo.com/movie.mov" length="12216320" type="video/quicktime" />
...
</item>

Basically, RSS 2.0 only allows one enclosure, and thus the rss enclosure on it's own isn't useful: We need to add <media:content> and <atom:link rel="enclosure"> to get additional enclosures. (Of course in rss we may want to add the enclosure anyway (duplicating a <media:content> entry), just in case the feed reader doesn't understand <media:content>.)

So, what does this look like?

2 Adding yahoo media[edit]

The yahoo media extension can be added to BOTH RSS 2.0 AND Atom. For RSS:

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">

but it could just as easily be used in atom:

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">

3 RSS + Yahoo media[edit]

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
...
<item>
     ...
     <media:content 
              url="http://www.foo.com/movie.mov" 
              fileSize="12216320" 
              type="video/quicktime"
              medium="video"
              isDefault="true" 
              expression="full" 
              bitrate="128" 
              height="200"
              width="300" 
              duration="185" 
              lang="en" />
     <media:content ..... />
...

4 Atom[edit]

The same could be done for Atom, but it would be more common to use <atom:link>. In atom, we can use <atom:link rel="enclosure type="" hreflang="" title="" length="">, and could write some of this information as:

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
...
<entry>
     ...
     <link rel="enclosure" 
              href="http://www.foo.com/movie.mov" 
              length="12216320" 
              type="video/quicktime"
              hreflang="en" />
     <link rel="enclosure" ..... />
...

However, by itself, the <atom:link> doesn't carry the same information as the <media:group>, so if we needed that information (as we would for syndication, see some discussion Atom media extension), we would add another extension ('m'):

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://....">
...
<entry>
     ...
     <link rel="enclosure" 
              href="http://www.foo.com/movie.mov" 
              length="12216320" 
              type="video/quicktime"
              m:medium="video"
              m:isDefault="true" 
              m:expression="full" 
              m:bitrate="128" 
              m:height="200"
              m:width="300" 
              m:duration="185" 
              hreflang="en" />
     <link rel="enclosure" ..../>
...

Hence the main argument is not about atom vs. rss, but it's about what information needs to be included, and - more importantly - what's supported by feed readers and feed parsers.


5 Atom + Yahoo media[edit]

Here is how you do atom + yahoo media:

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
...
<entry>
     ...
     <media:content 
              url="http://www.foo.com/movie.mov" 
              fileSize="12216320" 
              type="video/quicktime"
              medium="video"
              isDefault="true" 
              expression="full" 
              bitrate="128" 
              height="200"
              width="300" 
              duration="185" 
              lang="en" />
     <media:content ..... />
...

6 Why Atom+yahoo media makes more sense than extending atom:link.[edit]

I guess it depends on what you want to do, but if you want to syndicate, then the attributes of <atom:link> aren't sufficient. Rather than introducing a new extension ('m' above), that isn't understood by feed parsers, it makes more sense to stick with the yahoo media extension, which has wide support in parsers (such as simple pie).

7 Footnote: What about the "title"?[edit]

You may have noted above that the title attribute of <atom:link> wasn't used. Titles can be specified in yahoo-media, as well as atom:link as follows:

     <media:content url="http://www.foo.com/movie.mov">
                    <media:title>Some title</media:title>
     </media:content>

Atom:

    <atom rel="enclosure" href="http://www.foo.com/movie.mov" title="Some title" />

8 Links[edit]