Get video ID from a YouTube playlist

时光总嘲笑我的痴心妄想 提交于 2020-04-30 07:49:11

问题


I need to get the Video Ids from a YouTube Playlist.

e.g.: Thats our demo playlist: http://www.youtube.com/playlist?list=PL8B03F998924DA45B

That's my c# code:

SyndicationFeed feed = await client.RetrieveFeedAsync("https://gdata.youtube.com/feeds/api/playlists/PL8B03F998924DA45B?v=2");

I then can not find the IDs of the single videos from the playlist in my feed object. Any Ideas?


回答1:


I suggest you to use Data API v3. Data API is the one that reflects playlists in YouTube and highly supported.

In v3, you will do a playlistItems->list call with setting the playlistId.

In the response, if the playlist item is a video, you can get videoId from either snippet.resourceId.videoId or contentDetails.videoId

You can find C# examples here.



来源:https://stackoverflow.com/questions/18694568/get-video-id-from-a-youtube-playlist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!