Now Serving Feed Enclosures

Album Cover: Begin To Hope

"On the radio, you hear November Rain. That solo's awful long, but it's a good refrain."
Regina Spektor / On The Radio

Posted on April 26, 2008 12:41 AM in Web Development
Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

A couple months later, I finally got around to experimenting with the enclosure tag in my web feed. Using the sample provided by the Google Reader team, I updated my feed generation script to look for any instances of the object tag in my post (I only ever use these when embedding video) and copy the data URI directly into an enclosure element in my feed.

Sure enough, as proven by my previous post, the change seems to have worked as I now see the video from that post appearing in Google Reader. There is one slight problem, though. According to the Feed Validator and the RSS 2.0 Specification, the length attribute of the enclosure element is required (contrary to previous hopes), and as I've indicated here before, I have no idea how to responsibly generate the value of the length attribute without resorting to somewhat hackish (though creative) techniques of which I'd rather steer clear.

As an attempt at working around the problem, I've added a length attribute to the enclosure element, but I've left its value empty hard-coded its value as 0. I'll have to throw my feed at the Feed Validator again and see if that makes it happy, since Google Reader obviously doesn't care.

I'd be interested in hearing if the new enclosure method is resulting in the videos I embed showing up in feed readers other than Google Reader as well.


No one has added any comments.

Post Comments

If you feel like commenting on the above item, use the form below. Your email address will be used for personal contact reasons only, and will not be shown on this website.


Email Address:



Check this box if you hate spam.