Adham shafik
Adham shafik

Reputation: 1044

How to get the number of youtube playlist videos with php

As you know, the maximum number of videos to retrieve from a YouTube playlist is 50, i need to retrieve more, so i need to know how much videos in a playlist and then loop a number of times to get them all 50 by 50.

How can i do this using YouTube PHP API, without crawling playlist page.

Upvotes: 0

Views: 400

Answers (1)

Chad Befus
Chad Befus

Reputation: 1968

If your response from youtube includes a nextPageToken in the body then you need to resend the exact same request but with the additional parameter "pageToken": {VALUE FROM nextPageToken in response} to get the next page of results. Keep doing this until there isn't a nextPageToken in the response body.

Upvotes: 1

Related Questions