问题描述
我需要从 YouTube 播放列表中获取视频 ID.
I need to get the Video Ids from a YouTube Playlist.
例如:这是我们的演示播放列表:http://www.youtube.com/playlist?list=PL8B03F998924DA45B
e.g.: Thats our demo playlist: http://www.youtube.com/playlist?list=PL8B03F998924DA45B
这是我的 C# 代码:
That's my c# code:
SyndicationFeed feed = await client.RetrieveFeedAsync("https://gdata.youtube.com/feeds/api/playlists/PL8B03F998924DA45B?v=2");
然后我在我的 feed
对象中找不到播放列表中单个视频的 ID.有什么想法吗?
I then can not find the IDs of the single videos from the playlist in my feed
object. Any Ideas?
推荐答案
我建议你使用 Data APIv3.Data API 是反映 YouTube 中播放列表的 API,并且受到高度支持.
I suggest you to use Data API v3. Data API is the one that reflects playlists in YouTube and highly supported.
在 v3 中,您将执行 playlistItems->list 调用设置 playlistId.
In v3, you will do a playlistItems->list call with setting the playlistId.
在响应中,如果播放列表项是视频,您可以从 snippet.resourceId.videoId 或 contentDetails.videoId
In the response, if the playlist item is a video, you can get videoId from either snippet.resourceId.videoId or contentDetails.videoId
您可以在 此处找到 C# 示例.
这篇关于从 YouTube 播放列表中获取视频 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!