Using the Google APIs Client Library for Python and the search endpoint API V3 did the follwing query:
search_response = youtube.search().list(
q="Mallorca",
part="id,snippet",
maxResults=50,
order="date",
publishedBefore="2014-1-1T2:00:00Z",
publishedAfter="2014-1-1T1:00:00Z",
).execute()
The response shows a search_response.pageInfo.totalResults
of 186. That means that paging is needed to retrieve all results. However in this response I get only one result (one video) under search_response.items
instead of the expected 50 of the first page.
If I use the nextPageToken
(=CDIQAA) to query for the next results page:
search_response = youtube.search().list(
q="Mallorca",
part="id,snippet",
maxResults=50,
order="date",
publishedBefore="2014-1-1T2:00:00Z",
publishedAfter="2014-1-1T1:00:00Z",
pageToken= "CDIQAA"
).execute()
I obtain again only one result, the same video (same videoId
) retrieved at the first query. Same thing happens when I navigate through the next pages of the search_response
until no more pages are available (nextPageToken
not included in the response).
Have read this previous question:
page tokens use youtube api v3
and this:
Is youtube data api paging consistent if you use pagetokens? (v3 data api)
but they don't explain why I get only one result, the same video for all pages delivered by the response.
Is this an issue of the youtube API or I am doing something wrong? Thanks for your help.