How can i get a youtube playlist duration (the sum of all it's videos durations).
I used this endpoint to get the playlist videos :
and it's return the videos object with all videos ids, in this case i need to make an api call to get each video length with separate api call to :
I searched for a solution for this and found that we can make a call to previous api with all ids each id with a query param ex. id=aaaaa&id=bbbbb, but i need to be the owner of these videos to make the request.
Is there any way to get all videos with one call and without being the owner of the videos ?
Yes you can calculate length of any youtube playlist.
'https://www.googleapis.com/youtube/v3/playlistItems?part=contentDetails&maxResults=500&fields=items/contentDetails/videoId,nextPageToken,pageInfo&key=${API_KEY}&playlistId=${link}&pageToken='
https://www.googleapis.com/youtube/v3/videos?&part=contentDetails&id=${id}&key=${API_KEY}&fields=items/contentDetails/duration
create an api key in https://console.cloud.google.com/apis/dashboard and get API_KEY. Use it in first url and make a get request you will get all the id's. video id of playlist
Use id in second url make a request you will get duration