Wednesday, February 1, 2012

Subscribe to a custom YouTube feed in Google Reader

Organise arbitrary YouTube movies in Google Reader

Hunting around on YouTube recently, I came across a video that I was interested in - "Hubble Space Telescope - Chapter 1", uploaded by Cronoslogic. What's even better, it was part of a series. Even better again, the titles of the videos in the series were consistent, differing only by index numbers. The next one is "Hubble Space Telescope - Chapter 2": you get the picture.

It's nice when you get that, but for all of YouTube's mind-boggling riches, I just find it overwhelming. Too much stuff. Sometimes I'm happy to click from video to video on a drunken walk further and further from my starting point, but I usually feel a sense of frustration that the organisation of all that gold, all that stuff that growing up I would have killed for, isn't easier to grasp. Every click on a related video reveals another branch of this bewilderingly rich and complex tree of content that I don't have time to climb. I feel like a chimp who has started to climb a tree only to realise it's a city and I'm a homeless urchin travelling backwards in time on a faraway planet.

Maybe it's because I'm a programmer that I began to wonder how I could tame that "Hubble" list. How could I access those videos without having to click around the related videos list on the right-hand side of the page? Unless Cronoslogic has made a playlist consisting of only those videos, I'd have to make one manually, I think. I mean, I'm not an authority on navigating YouTube, but that's what it seemed like I'd have to do.

As it happened, in this case he had made a playlist. This guy is a seriously organised power-YouTube user. Now you can subscribe pretty easily, in an RSS reader, or app like Google Reader, to a YouTube playlist, as this WebApps StackExchange question shows. And as I point out in my answer to that question, you want to use the "base" version of the feed rather than the "api" version:
You can find this by playing around with the YouTube API demo page, but as I say, make sure to select the ATOM/RSS "projection", which gives you the base in the URL. This makes a big difference in Reader, as you get a nice formatted preview:

But of course, the title of this post refers to an "arbitrary" feed, and there's nothing arbitrary about a list of videos already organised into a playlist. Let's get arbitrary. Which means a search. Say I only want to see videos that are about that other famous eye in the sky, the Spitzer space telescope, of a reasonable length (duration=medium: longer than 4 minutes but not longer than 20). HD would be nice too: no iPhone video thanks (hd=true). Newest videos should show first (orderby=published).

Using the YouTube API I can manufacture a feed URL like this:"spitzer+space+telescope"&duration=medium&hd=true&restriction=AU&orderby=published&v=2
The ordering is necessary because the default is to order videos by 'relevance'. I just want the newest at the top. That's how feed readers usually operate, and since I'm customising this API call to act like an RSS feed, then reverse chronological order is the go. If you don't specify otherwise the number of videos returned will be 25, which is fine in my case. If it was 100, then I could add "&max-results=25" to minimise unread (in this case unwatched) items and thereby avoid the dreaded nagging bold number of infamy that feed readers love to inflict. And the main search phrase ("spitzer space telescope") must be in quotes, as is usual for a Google search, to be preserved in its integrity for the search.

You have to specify the version ("v=2") because "If your request does not specify an API version, YouTube will handle your request using API version 1." I find that weird: you'd think they would default to the latest version for a version-agnostic request. The "restriction=AU" part means that you can be sure it won't include videos that are blocked to Australian viewers.

Here are some other example YouTube feeds I subscribe to.
Any videos to do with ASP.Net MVC3. I put the Asp in there too because MVC3 in YouTubeland has more to do with the testosterone-addled shenanigans of (yes, you have to shout it) MARVEL VS. CAPCOM 3 than the refined, chappish pursuit of programming in the ASP.NET MVC framework."official+video"&author=subpoprecords&restriction=AU&v=2
Official videos from Sub Pop Records.
Episodes of "The What If Machine" by gamespot.
One of the main purposes of doing all this, for me at least, is so I can watch YouTube videos via a video podcast - a "vodcast" if you will - catcher - a "vodcatcher", again if you will - such as Doggcatcher, which you can run on an Android tablet for instance. This is très convenient. You get home from work, flop down on the couch, swat away irritating questions from your wife and children, and consume art and popular science directly with your eyes!

1 comment:

  1. Someone Sometimes with visits your blog regularly and recommended it in my experience to read as well. The way of writing is excellent and also the content is top-notch. Thanks for that insight you provide the readers! movies