Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve all videos from youtube playlist using youtube v3 API

I'm 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 I'm only getting 50. How can I get the next 50 items? I tried start-index but it does not work for v3 API. Any help is appreciated.

like image 919
amrinder007 Avatar asked Sep 14 '13 18:09

amrinder007


People also ask

How do I get a list of videos in a playlist on YouTube?

YouTube also uses a playlist to identify a channel's list of uploaded videos, with each playlistItem in that list representing one uploaded video. You can retrieve the playlist ID for that list from the channel resource for a given channel. You can then use the playlistItems. list method to the list.

How do I restore my playlist on YouTube?

To find your playlists, go to the Guide and click Library.

Is YouTube data API v3 free?

Yes, using the YouTube API does not incur any monetary cost for the entity calling the API. If you go over your quota an 403 Error will be returned by the API.


1 Answers

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.

like image 91
Ibrahim Ulukaya Avatar answered Sep 20 '22 16:09

Ibrahim Ulukaya