Youtube API nextPageToken becoming invalid

Viewed 170

I'm trying to go through a Youtube playlist's items using the youtube data API, and I'm running into an issue in which the nextPageToken will be invalid seemingly at random. Here is my code:

enter image description here

After running the code, the program begins moving through pages. At some point in the program, it sometimes throws the invalid page token error, though. It does this inconsistently - sometimes it will make it through all the pages, sometimes it won't make it through the first, and sometimes it will mess up half way. This all happens in back-to-back runs in which I don't touch the code. Here, a run went all the way through:

enter image description here

After it did, I just loaded up the program again:

enter image description here

Note: I'm not saving or loading anything between runs except OAuth credentials.

1 Answers
Related