Elusive YouTube Feeds

One Response · January 13, 2007

Despite being one of the poster-children for the 2.0nd and most recent wave of hyper­bolized inter­net enthu­si­asm, YouTube does a shitty job of mak­ing feeds avail­able. “We offer a bunch of dif­fer­ent RSS feeds,” they say, “cov­er­ing tags, users, pop­u­lar videos, and even the YouTube Blog.” No shit! That list of feeds is, believe it or not, totally com­pre­hen­sive of all that they pro­vide easy access to. This is prob­a­bly an arti­fact of their pre-Google days, when they were los­ing mil­lions of dol­lars and couldn’t afford too many feed requests.

But I did some dig­ging and found that you can eas­ily get a devel­oper key, which gives you access to YouTube’s API. This sounds a lot trick­ier than it is. Just go to your devel­oper pro­file page, tell them why you want a key, and you’ve got it. With this key, you can access a num­ber of dif­fer­ent XML feeds. Visit the devel­oper intro­duc­tion and doc­u­men­ta­tion to gen­er­ate the url for the feed you’re after. For instance, I want a feed of the videos I’ve marked as favorites, so I use this:

http://www.youtube.com/api2_rest?method=youtube.users.list_favorite_videos&dev_id=MyY0utu8eD3v1D&user=echosmyron

That’s not my real Dev ID — YouTube is obvi­ously pro­tec­tive of these things so I don’t want to piss them off. But what you get is an XML file that is struc­tured like this:

<ut_response status=“ok”>
<video_list>
<video>
<author>limpty</author>
<id>npvSMfhjt4A</id>
<title>Joanna New­som “sadie” live</title>
<length_seconds>356</length_seconds>
<rating_avg>2.65</rating_avg>
<rating_count>79</rating_count>
<descrip­tion>
at easy street seat­tle. i filmed it brah. i have pho­tos of joanna at smokyshots.com
</description>
<view_count>15869</view_count>
<upload_time>1149446513</upload_time>
<comment_count>21</comment_count>
<tags>joanna new­som folk harp drag city</tags>
<url>http://www.youtube.com/?v=npvSMfhjt4A</url>
<thumbnail_url>

http://sjl-static13.sjl.youtube.com/vi/npvSMfhjt4A/2.jpg

</thumbnail_url>
</video>

Pretty awe­some! The <id> value of npvSMfhjt4A can just be thrown into the watch url (http://www.youtube.com/watch?v=npvSMfhjt4A), and there it is! Now it’s just a mat­ter of re-writing las­tRSS a bit to strip out the <id> field and toss­ing that into YouTube’s embed code. Which I then intend to imple­ment as a sin­gle dynamic video in the side­bar.I fuck­ing nailed it.

Leave a Comment or Subscribe