PyGAE
PyGAE

Reputation: 51

A bug in YouTube's API example on GAE? Or am I missing something?

I'm working with this list videos example for GAE and if you try to run it on that page you can see that there's no next_page_token I've even tried to self.response.out.write(next_page_token) and got None.

For example purposes I've submitted Channel name to be Google (which surely has more than 50 videos). I only get 50, no token that I can see, no pagination indication or anything like that.

What am I missing here?

Please advise, Thanks a lot

Upvotes: 0

Views: 74

Answers (1)

Josh J
Josh J

Reputation: 6893

Here is the first request pre-filled for you. Click execute at the bottom:

https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.channels.list?part=snippet%252CcontentDetails&forUsername=Google&_h=1&

Following that result and hitting the next api in the code,

https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.playlistItems.list?part=snippet&maxResults=50&playlistId=UUK8sQmJBp8GCxrOtXWBpyEA&_h=3&

Clicking execute on that shows that nextPageToken set. Either the code example from Google has a bug in it, or it is a copy paste error somewhere.

EDIT: There is a bug in the code sample provided.

playlistitems_response looks similar to this:

{
 "kind": "youtube#playlistItemListResponse",
 "etag": "\"eYE31WLho912TfxEBDDRSwEQ5Ms/vUtg-sAFafmsExy-5XOvaMIfVN0\"",
 "nextPageToken": "CDQQAA",
 "prevPageToken": "CDIQAQ",
 "pageInfo": {
  "totalResults": 1634,
  "resultsPerPage": 2
 },
 "items": [{...}]
}

The nextPageToken is being extracted like playlistitems_response.get('tokenPagination', {}).get('nextPageToken') when it should read playlistitems_response.get('nextPageToken').

Upvotes: 1

Related Questions