Make Television

RSS and Atom Feed Auto-Discovery for Internet TV

Blogs, Internet radio shows, and Internet TV shows all syndicate themselves using RSS or Atom feeds. But how do you tell the difference between the different kinds of feeds‽

How do you know if a feed is for an Internet TV show (all full of videos), or for an Internet radio show (containing only audio), or if the feed is for a news site (and only contains text news articles) without having to actually download, read and understand the feed‽ Sure if you are a human you may be able to figure it out (based on what's on the webpage that links to the feed); but what about machines‽ What about browsers, search engines, web crawlers, and other kinds of software‽ How will they be able to figure it out‽

Luckily HTML already provides a solution to this. We (Internet TV show makers) just have to use it. Here's how.

Feed Auto-Discovery

Before getting into the solution though it's important to understand how feed syndication is currently done. (This requires some knowledge of HTML. If you do NOT understand HTML, then you may want to get whomever made your Internet TV software to look at this article to make sure that your Internet TV software gets this added.)

So first a little background information. (Note, if you already know how feed auto-discovery is done you can just skip to the next section.)

Long ago the only way you could find RSS feeds was by manually searching through a blog or news site (or whatever) and try to find the feed link. Sometimes they were easy to find; but all too often they weren't. (People put them in different places on the page. Some people linked them in with text. Some people linked them in with images. And people used different kinds of text and images to link them in. Not to mention the whole usability problem with RSS and Atom not being handled by the browser in a useful way.)

Now, in addition to this (at that time) most machines (like browsers, search engines, web crawlers, and other kinds of software) could NOT find these RSS feed links. This impact of this problem is probably far worse than you may realize.

At one point Matt Griffith had an idea that was refined by Mark Pilgrim. This idea was called RSS auto-discovery. And it looks something like this....

<link rel="alternate"
      type="application/rss+xml"
      href="http://example.com/feed" 
      title="Example" 
/>

Code like this is put in the <head> of the home page of one's blog, news site, etc. And it makes it so that it is easy to find RSS (and Atom) feeds of a site.

And if you wanted to use RSS auto-discovery on another page on the same site, other than the home page, then you might use code like the following....

<link rel="home"
      type="application/rss+xml"
      href="http://example.com/feed" 
      title="Example" 
/>

(Note that the rel attribute has changed. Where it was rel="alternate" in the previous example, here it is rel="home".)

RSS Feed auto-discovery worked great! Now it was relatively trival for both humans and machines to find RSS (and later Atom) feeds.

For humans, there were bookmarklets to automagically find these RSS and Atom feeds, with a single click. (Later on native browser support was added, which made things even easier.) And for machines, it finally became simple to find RSS and Atom feeds.

Feed Confusion

But as time went on, RSS and Atom feeds found uses amoung other things besides just text-dominated blogs and news sites. We started seeing RSS and Atom feeds being used to syndicate Internet radio shows (also known as podcasts). And saw RSS and Atom feeds being used to syndicate Internet TV shows (also know as vlogs, vidcasts, vodcasts, videoblogs, etc).

Even with feed auto-discovery, we had a new problem.

People typically handle the different kind of feeds differently. (Typically, people use one program to read their blog and news feeds. Another program to listen to their Internet radio feeds. And yet another program to watch their Internet TV feeds.) What's needed is a way for both humans and machines to be able to tell the different kinds of feeds apart.

HTML and TV

Although most people probably don't know it, HTML actually has some facilities for dealing with TV. (Remember, Internet TV is a form of TV; so these facilities are useful and relevant for us Internet TV makers.)

In particular the HTML <link> element has a way of "saying" that what it links to is meant for TV. (Which is great since RSS and Atom feed auto-discovery is done with the HTML <link> element.) This is done with the media attribute of the HTML <link> element.

Internet TV Feeds

The easiest thing to do at this point is to just show the two previous examples transformed into Internet TV feeds. The first example is below.

<link media="tv"
      rel="alternate"
      type="application/rss+xml"
      href="http://example.com/feed" 
      title="Example" 
/>

And here's the second example.

<link media="tv"
      rel="home"
      type="application/rss+xml"
      href="http://example.com/feed" 
      title="Example" 
/>

Note that the only change is the addition of media="tv". That's it. That's how easy it is to mark your feed as an Internet TV feed.

Extra Info for Software Engineers

If you are just creating your own Internet TV show (and NOT writing software), then you do NOT have to read this last section. This is just here to help people who create machines (like browsers, search engines, web crawlers, etc) to write their software.

If you are writing software then you should note the following points.

  1. You can tell which <link> elements point to feeds by the MIME type given in the type attribute. (Note, we're talking about any kind of feed in this point. Not just Internet TV feeds.)

    (Refer to #3 for a list of feed MIME types. Also, make note of #7 when trying to get the MIME type from the type attribute of the <link> element.)

  2. There are 2 things that mark a <link> element as pointing to an Internet TV feed.

    (A): it has a feed MIME type. (Refer to #3 for a list of the different feed MIME types. Also pay attention to #7 when trying to figure out the MIME type for a <link>.)

    And (B): it has tv as a media descriptor. (Make note of #6 when trying to figure out the media descriptor(s) given by the media attribute of the <link> element.)

  3. There are 2 different MIME types you should be watching for. (One is for RSS and the other is for Atom.) They are:
    • application/rss+xml
    • application/atom+xml

    Currently (at the time of writing this article), these are the only feed MIME types.

  4. The rel attribute (of the HTML <link> element) has NO importance in terms of finding feeds. (Whether it be an Internet TV feed, or any other kinds of feed.)

    People tend to think that it must be rel="alternate". But this is wrong! (It could be that, but it doesn't have to be. It could be rel="home", rel="apple orange banana", or anything else.)

    Refer to Section 6.12 of the HTML 4.01 specification for more information on the meanings of these different relations.

  5. The rel attribute can contain more than one relation. For example, instead of just having:

    rel="alternate"
            

    We could have:

    rel="alternate example something"
            

    (Basically, the rel attribute contains a space separated list of link types.)

  6. The media attribute can contain more than one media descriptor. For example, instead of just having:

    media="tv"
            

    We could have:

    media="screen, tv, 3d-glasses, print and resolution > 90dpi"
            

    Both of these have tv as a media descriptor.

    Refer to Section 6.13 of the HTML 4.01 specification for more info on media descriptors.

  7. The type attribute of the HTML <link> element contains a content type and not just a MIME type. Therefore a type like the following:

    type="application/rss+xml"
            

    Has the exact same MIME type as the type below:

    type="application/rss+xml; a=b; c=d;efghi=&quot;Hello World!&quot;"
            

    Both of these have the RSS MIME type of application/rss+xml.

    Refer to Section 14.17 of RFC 2616 for more information on content types.

  8. There is an HTTP header with equivalent semantics to the HTTP <link> element. It is the HTTP Link header. For example:

    HTTP/1.1 200 OK
    Link: <http://example.com/feed>; rel=alternate; type="application/rss+xml"; media=tv
            

    For more information on the HTTP Link header refer to section 19.6.2.4 of RFC 2068.

Summary

So, for anyone who skipped reading the article, and just wanted to read the summary, all you need to do to mark your feed as an Internet TV feed is to add the following attribute to your feed <link>'s:

media="tv"

As in:

<link media="tv"
      rel="banana"
      type="application/rss+xml"
      href="http://example.com/feed" 
      title="Example" 
/>

It's that simple!

--

published on Sunday April 2, 2006 @ 2:04PM
tagged with:                                                  

Add Your Own Comment

READ THIS BEFORE COMMENTING.

NOTE: Comments do NOT automatically show up on this page. To prevent SPAM I go through all comments before I let them show up on here. So when you write a comment, and you don't see it here, don't worry; that is how it should be.

 

Read Comments

Charles Iliya Krempeaux <charles@reptile.ca> said on Sunday April 2, 2006 @ 1:31PM:

RSS and Atom Feed Auto-Discovery for Internet Radio

There's actually no reason why this same technique could not be used for Internet Radio too.

All you have to do is add the following to your podcast feeds:

media="radio"

As in:

<link media="radio"
      rel="airplane"
      type="application/rss+xml"
      href="http://example.com/feed" 
      title="Example" 
Pete Prodoehl <pete@rasterweb.net> said on Thursday April 6, 2006 @ 9:15AM:

I like the idea of using media="tv"

I'll be setting up tinkernet to use that...