奇怪的行为 Youtube v3 api [英] Strange behaviour Youtube v3 api

查看:30
本文介绍了奇怪的行为 Youtube v3 api的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 api 浏览 Youtube 频道的所有内容:

I am trying to page through all content of a Youtube channel by using the api:

https://www.googleapis.com/youtube/v3/search?channelId=UC5nc_ZtjKW1htCVZVRxlQAQ&part=snippet,id&order=date&maxResults=50&key=<myKey>

结果我得到:

{
 "kind": "youtube#searchListResponse",
 "etag": "\"CuSCwMPVmgi8taDtE2LV6HdgkN0/N3YNEZY0rLQ94onYIYp3nPLN57E\"",
 "nextPageToken": "CDIQAA",
 "regionCode": "CZ",
 "pageInfo": {
  "totalResults": 1381,
  "resultsPerPage": 50
 },
 "items": [ ...

到这里一切都好;项目存在.但是,当我开始通过 nextPageToken 对结果进行分页时:

all fine until here; items are present. however when i start paging through the results via the nextPageToken:

https://www.googleapis.com/youtube/v3/search?channelId=UC5nc_ZtjKW1htCVZVRxlQAQ&part=snippet,id&order=date&maxResults=50&key=<myKey>&pageToken=CJADEAA

事情开始变得奇怪.几次 nextPageTokens 之后,结果中没有更多项目,尽管我什至不接近结果总数 (1381).

Things start to get strange. After a couple of nextPageTokens there are no more items in the result, despite I wasn't even close to the total number of results (1381).

在第 11 页之后的测试中,我得到了一个空结果.我仍然得到下一页和上一页令牌,totalResults 保持不变,但没有更多项目.

In my test after the 11th page, I got an empty result. I still get next and prev page tokens, also totalResults stays same, but no more items.

推荐答案

无论找到的结果总数是多少,YouTube API 的软限制为 500 个结果,并且不会返回更多.

Regardless of the total results found, the YouTube API has a soft limit of 500 results and will not return any more than that.

这篇关于奇怪的行为 Youtube v3 api的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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