Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

youtube api v3 - get videos from a playlist with view count data ordered by number of views

I want to get all the videos from a playlist with statistics data like viewCount and the videos should be ordered by number of video views. So far I have managed the following:

https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=UUbW18JZRgko_mOGm5er8Yzg&key={YOUR_KEY_HERE}&maxResults=50

In the youtube api v2 we can pass part=statistics to get the view count but this is not working with v3 playlists. How can I get the above the video data in the above mentioned format.

like image 525
seadrag0n Avatar asked Apr 01 '15 11:04

seadrag0n


1 Answers

From the results of playlistItems.list call, collect the video ids, make a comma-separated list and set it as id parameter of videos.list call. That call will give you the data you need.

like image 177
Ibrahim Ulukaya Avatar answered Oct 10 '22 13:10

Ibrahim Ulukaya