Elusive YouTube Feeds

Despite being one of the poster-children for the 2.0nd and most recent wave of hyperbolized internet enthusiasm, YouTube does a shitty job of making feeds available. “We offer a bunch of different RSS feeds,” they say, “covering tags, users, popular videos, and even the YouTube Blog.” No shit! That list of feeds is, believe it or not, totally comprehensive of all that they provide easy access to. This is probably an artifact of their pre-Google days, when they were losing millions of dollars and couldn’t afford too many feed requests.

But I did some digging and found that you can easily get a developer key, which gives you access to YouTube’s API. This sounds a lot trickier than it is. Just go to your developer profile page, tell them why you want a key, and you’ve got it. With this key, you can access a number of different XML feeds. Visit the developer introduction and documentation to generate 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 obviously protective of these things so I don’t want to piss them off. But what you get is an XML file that is structured like this:

<ut_response status="ok">
 <video_list>
  <video>
   <author>limpty</author>
   <id>npvSMfhjt4A</id>
   <title>Joanna Newsom "sadie" live</title>
   <length_seconds>356</length_seconds>
   <rating_avg>2.65</rating_avg>
   <rating_count>79</rating_count>
   <description>
    at easy street seattle. i filmed it brah. i have photos of joanna at smokyshots.com
   </description>
   <view_count>15869</view_count>
   <upload_time>1149446513</upload_time>
   <comment_count>21</comment_count>
   <tags>joanna newsom 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 awesome! 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 matter of re-writing lastRSS a bit to strip out the <id> field and tossing that into YouTube’s embed code. Which I then intend to implement as a single dynamic video in the sidebar.I fucking nailed it.

One Reply to “Elusive YouTube Feeds”

Leave a Reply

Your email address will not be published. Required fields are marked *