无法在 YouTube 搜索 API v3 上使用 nextPageToken 翻阅所有结果 [英] Cannot page through all results using nextPageToken on YouTube search API v3
问题描述
我使用的是 YouTube 搜索 API v3.我正在尝试获取频道所有视频的片段.为了从一个页面转到另一个页面,我使用 nextPageToken
.我感兴趣的频道共有 3,628 个结果.在我获得 500 个视频后(第 10 页,因为我要求每页 50 个视频),nextPageToken
不再传回.
对于特定频道,我可以翻阅的视频总数是否有限制?
最初,我从以下 URL 开始,并通过附加到查询字符串 &pageToken=[nextPageToken]
来跟随 nextPageToken
.
第 10 页的 URL 如下.
另外,我注意到一些奇怪的地方,从页面到页面,视频总数会发生变化.这是一个已知的错误?
下表列出了页面以及相应的页面标记和总结果.请注意,我没有(需要)为第一页传入 pageToken
.
也许您想使用 PlaylistItem 而不是 Search.根据配额(100 对 6),它要便宜得多,并且为给定的播放列表提供多达 100.000 个视频.每个频道都有一个上传播放列表,其中存储了所有上传的视频.
更多详情,请观看:https://www.youtube.com/watch?v=RjUlmco7v2M
I am using the YouTube search API v3. I am trying to get snippets of all the videos of a channel. To go from page to page, I use the nextPageToken
. The channel that I am interested in has 3,628 total results. After I get to 500 videos (the 10th page, as I am requesting 50 videos per page), the nextPageToken
is no longer passed back.
Is there a limit on the total number of videos I can page through for a particular channel?
Initially, I start off with the following URL and follow the nextPageToken
by appending to the query string &pageToken=[nextPageToken]
.
The URL for the 10th page is as follows.
Also, I note something weird in that from page to page, the total number of videos changes. Is this a known bug?
The following table list the page along with the corresponding page token and total results. Note that I do not (need to) pass in a pageToken
for the first page.
+------+------------+---------------+ | Page | Page Token | Total Results | +------+------------+---------------+ | 1 | [none] | 3628 | | 2 | CDIQAA | 3628 | | 3 | CGQQAA | 3626 | | 4 | CJYBEAA | 3626 | | 5 | CMgBEAA | 3625 | | 6 | CPoBEAA | 3625 | | 7 | CKwCEAA | 3625 | | 8 | CN4CEAA | 3624 | | 9 | CJADEAA | 3624 | | 10 | CMIDEAA | 3624 | +------+------------+---------------+
Maybe you want to use PlaylistItem instead of Search. It is much cheaper according to quota (100 vs 6) and gives up to 100.000 Videos for a given playlist. Every channel has got a uploads-playlist, in which all uploaded videos are stored.
For more details, watch: https://www.youtube.com/watch?v=RjUlmco7v2M
这篇关于无法在 YouTube 搜索 API v3 上使用 nextPageToken 翻阅所有结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!