开发者

YouTube API: videoEntry context in playlist

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.


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.


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

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜