dasAnderl ausMinga
dasAnderl ausMinga

Reputation: 357

Strange behaviour Youtube v3 api

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>

as I result I get:

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

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

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).

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.

Upvotes: 2

Views: 467

Answers (2)

AL.
AL.

Reputation: 37768

Due to the results of the YouTube Search API being less accurate/related with more results provided, it was decided that the limit is to be set to 500 and no more. The issue can actually be seen here.

Upvotes: 1

johnh10
johnh10

Reputation: 4185

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

Upvotes: 3

Related Questions