June 08, 2007

Google Gadgets - RSS Feed Powered YouTube Playlist Player

Some time ago, I posted a bookmarklet that created a YouTube Playlist RSS feed by scraping a playlist page and calling a feed generating service with the IDs for the movies in that playlist.

Although YouTube provides RSS feeds for many services, playlists is not (currently) one of them. For example feeds by user, tag, most recently viewed, most favourited and so on (see the full list of YouTube RSS feeds/feed URL patterns).

One problem with the bookmarklet approach was that a static feed was created for movies listed on the playlist at the time the feed was created. If the playlist changed, the changes would not be propagated to the feed.

So here's a temporary stopgap - a minimal, Dapper created YouTube Playlist RSS feed. Given a YouTube playlist ID, the Dapp scrapes the actual YouTube playlist page and generates a feed. The link element in each feed item points to the YouTube page for each movie described in the playlist.

The Dapp actually creates a feed with an additional empty link on the end (bad scraping design on my part). Rather than tidy the feed in the Dapp, I thought I'd create a Yahoo! Pipe that would clean the Dapp feed and only pass on links that genuinely referred to a YouTube movie page: clean YouTube playlist feed pipe.

Having generated this feed, I thought I should provide a player for it. The feed items don't contain enough information to power a Splashcast channel - each feed item is limited to a title and a link at the current time - so I thought I'd try to find a way of wiring the feed into another widget platform, in this case Google Gadgets.

For inspiration (i.e. code I could reuse ;-), I had a look at the Google create your own YouTube Channel gadget and a simple RSS viewing gadget (I've lost the reference for this at the mo :-(.

(To simplify the internals of the gadget, which actually feeds off the tidied Yahoo pipes filtered version of the scraped Youtube playlist feed, I use a good old fashioned URL rewrite, which takes URLs of the form http://searchfeedr.com/youTubePlaylistFeed/FEEDURL and rewrites them to the Yahoo pipe URL, which has the form http://pipes.yahoo.com/pipes/pipe.run?_id=TEM_6l0Q3BG6fZjojknRlg&_render=rss&_run=1&textinput1=FEEDURL.)

Here's the result: a Google RSS Feed Powered YouTube Playlist Player gadget for iGoogle, Google RSS Feed Powered YouTube Playlist Player gadget for your webpage . (If you want the code, you can find it here: Google Gadget - Youtube Playlist video player code.)

This gadget can be added to your Google iGoogle Personal page, or embedded in your own blog or social network personal page, in the normal way. Add Google Youtube playlist player gadget

By default, the gadget is subscribed to a demo OUseful Media Futures YouTube Video Playlist.

[UPDATE: if you don't want to use a Google Gadget, here's a live youTube playlist feed video playing Grazr widget]

To customise the gadget to use a YouTube playlist of your own (or your own choosing), simply go to the gadget customisation panel and paste in the URL of the YouTube playlist page you want to subscribe to:

In retrospect, a far more efficient way of creating the gadget would be to simply use the gadget to scrape the YouTube playlist page directly rather than letting Dapp do this. I shouldn't really be using the extra URL rewrite step either, but it's a trick that can help speed up prototyping, so in that sense it's worth recording here. The gadget based scraper on my to do list, by the way, but way down there at the moment. (If you beat me to it, please post me a link. ;-)

Rather more pressing is the need to improve the gadget interface a little. What I have in mind is displaying a list of movie titles as the initial gadget view (simply reusing the simple feed gadget code). An additional Menu control item between the Next and Previous controls would link back to this list. Clicking on any menu item would play the corresponding movie in the gadget.

As to why would I want to access playlist feed? Partly because it provides an easy way of allowing users to programme an embedded YouTube player from a personally managed control panel, thus getting round the problem of subscribing a tag based feed that is open to spam attacks via the tags (that is, third parties injecting content into the tag feed by tagging movies in that way).

Posted by ajh59 at June 8, 2007 12:30 PM
Comments

Interesting, but this approach seems hellishly complicated.
The info on YouTube is only really going to be leveraged when YT creates RSS fees for keyword-specific searches in the way that Google News does.

Posted by: AJ Cann at June 8, 2007 01:02 PM

The approach is very convoluted - yes... it was just the way things evolved, a rambling wander through web APIs as I looked around for things to wire toegther - not how I'd do it now, knowing that I wanted a Google Gadget YouTube Playlist player...;-)

In use it's easy though - just grab the gadget and past in a YouTube playlist url taken straight from any youtube playlist page - if you use/find a relevant playlist that is...

One of the things I keep exploring is using rss to pipe around managed STATIC content, rather than live search feeds for example. This means I can control the content, and manage it on one location (eg a youtube playlist) and not have to worry about updating it at point of use/publication (in a gadget on a blog, or on iGoogle, or on my Google desktop, for example)

Posted by: Tony Hirst at June 8, 2007 02:30 PM