views:

336

answers:

2

Is it possible to find the context of a video in respect to any playlist that it is included in? I would like to be able to check if the videoEntry is included in a playlist and, if so, figure out the next video in the playlist.

Flickr has a lot of great photo context methods, I hope YouTube does too, I just can't find anything on it.

A: 

Well, obviously you want to know the VideoId of the video in question first, right? So say it's "4eUibFQKJqI" and it's in a playlist whose Id is "6C0464B5CC81A607" (You can easily get those Ids from your 'My Account' section in YouTube).

If I get the feed for that playlist, then the resulting xml file gives you all the information you need to check if that Video is present, and the order that you have set in 'My Account' is preserved.

So, you have two ways of analysing the results that YouTube sends you. One is to make a request to that playlist address and parsing the results using Linq-to-Sql, if you use Asp.Net, for example. Whatever language you use, it will have Xml-parsing capabilities, so it's just a case of iterating through the entries in the feed.

If you use a library for your language, it may well have a specific method to determine whether a given video is in a given playlist, but if it doesn't, it's pretty easy to query the raw xml file and get that information, as described above.

Hope that helps - it's hard to tell from your question what level you're at with this stuff... Anyway, it's all at the Developers' Guide.

Rafe Lavelle
right. i use the php library recommended by the youtube api developers. it is the GData PHP library. i was hoping somebody with more experience with the library would be able to tell me a quick way to use the features of the library to accomplish this. i try to analyze the GData object for the playlistVideoFeed but there is so much raw data. i know i could do this manually but i was hoping for a built in function.thanks
andrhamm
A: 

http://gdata.youtube.com/feeds/api/playlists/PLAYLIST_ID?v=2

from http://code.google.com/apis/youtube/2.0/reference.html

Gabo