question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid page token on get_playlist_items(count=None)

See original GitHub issue

Sometimes by running:
playlist = api.get_playlist_items(playlist_id=playlist_id, count=None)

I get the following exception: pyyoutube.error.PyYouTubeException: YouTubeException(status_code=400,message=The request specifies an invalid page token.)

I have a script that runs this line of code every 10 minutes and it happens to break at least 4 times per hour. It tries to get data from the same playlist so results should be the same, unless a new video is added to that playlist. Sometimes I get that error, sometimes it works just fine. This issue started to happen a week ago on my end. I never experienced similar issues before.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
z1lccommented, Aug 17, 2021

Same here, my most recent run succeeded for all the cases I posted above.

1reaction
marco97pacommented, Aug 16, 2021

On my end the issue seems solved since 19:46 CEST, August 17 2021.
I already executed 26 calls of playlist = api.get_playlist_items(playlist_id=playlist_id, count=None) without any exception.
I think it was a bad response from the YouTube servers and now it has been solved. I will test it (one call every 15 minutes) for some days and mark the issue as closed if it will continue to work as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error paginating the videos in a playlist using Youtube Data ...
Here is an example for the 4th page of a playlist: ... { "error": { "code": 400, "message": "The request specifies an invalid...
Read more >
'400 invalidPageToken' error returned for a valid Next Page ...
Same issue here: URL with a page token sometimes works correctly and sometimes returns an error saying 'The request specifies an invalid page...
Read more >
Error: 300 - The next page token is invalid or expired
I'm getting the above error when using the following code. //Call to ge the JSON file that is a list of all the...
Read more >
PlaylistItems: list | YouTube Data API - Google Developers
The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and ...
Read more >
Solved: Invalid Token: Measure in PowerBI
I'm trying to create a measure to give me a % of assessments that were completed in a given period of time, but...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found