如何使用 YouTube Data API v3 获取频道中所有视频的列表? [英] How do I obtain a list of all videos in a channel using the YouTube Data API v3?

查看:38
本文介绍了如何使用 YouTube Data API v3 获取频道中所有视频的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为客户使用 YouTube API 3,但无法获取所有当前视频.

I'm using the YouTube API 3 for a client and am not getting all current videos.

API Explorer 有 4 个结果:https://www.googleapis.com/youtube/v3/search?part=id%2C+snippet&channelId=UCwB4tpXCMWi-bw5HpMlY6Bg&maxResults=50&key={YOUR_API_KEY}

The API Explorer has 4 results: https://www.googleapis.com/youtube/v3/search?part=id%2C+snippet&channelId=UCwB4tpXCMWi-bw5HpMlY6Bg&maxResults=50&key={YOUR_API_KEY}

这里是客户端 YouTube 页面:http://www.youtube.com/user/Goldensteinart/视频其中有 7 个视频.它们必须全部公开,否则它们不会出现在页面上,对吗?

And here is the client YouTube page: http://www.youtube.com/user/goldensteinart/videos which has 7 videos. They must all be public or they wouldn't appear on the page, right?

我错过了什么?

推荐答案

如果您想获取频道中的视频,您应该进行的 API 调用是 youtube.playlistItems.list()带有频道上传"播放列表的播放列表 ID.(这通常以 UU... 开头,但这是将来可能会更改的实现细节.

The API call that you should make if you want to get the videos in a channel is a youtube.playlistItems.list() with the playlistId of the "uploads" playlist for the channel. (This usually stars with UU..., but that's an implementation detail that might change in the future.

以下是 API 资源管理器.

通过搜索操作获取相同的数据并不能保证返回所有内容;搜索索引不能替代您可以通过 youtube.playlistItems.list() 调用获取的后端数据.这与这篇博文中提出的观点非常相似(尽管重点是 v2).

Getting the same data via a search operation isn't guaranteed to return everything; the search index isn't a replacement for the backend data that you can obtain via the youtube.playlistItems.list() call. It's very much the same point raised in this blog post (though the focus there is on v2).

我们刚刚发布了一个 YouTube 视频,讨论如何在频道中获取视频,并且有示例说明了如何从文档中的代码进行实际的 API 调用.

We just posted a YouTube video talking about how to get the videos in a channel, and there's samples illustrates how to make the actual API calls from your code in the documentation.

这篇关于如何使用 YouTube Data API v3 获取频道中所有视频的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆