Retrieve all videos from youtube playlist using youtube v3 API

amrinder007 picture amrinder007 · Sep 14, 2013 · Viewed 68k times · Source

Im retrieving videos of a playlist using youtube v3 API and getting 50 items without any problem with this link:-

https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=50&playlistId=PLB03EA9545DD188C3&key=MY_API_KEY

But the video count is 100 and im only getting 50. How can i get the next 50 items? I tried start-index but it doesnot work for v3 API. Any help is appreciated.

Answer

Ibrahim Ulukaya picture Ibrahim Ulukaya · Sep 14, 2013

YouTube Data API v3 results are paginated. So you need to get the next page of results for the others.

Basically in the response you have nextPageToken.

To get the remaining results, do the same exact call but setting pageToken into that token you received.