Look at this link , there is an example given
https://www.googleapis.com/youtube/v3/videos?id=7lCDEYXw3mM&key=YOUR_API_KEY
&part=snippet,contentDeta
Step 1: You have a list video id by using Search: list
For example you receive 3 youtube video id like:
{ zOYW7FO9rzA, zOYW7FO9rzA, -vH2eZAM30s}
Step 2: You have to put the list of youtube video id for the second call.
https://www.googleapis.com/youtube/v3/videos?part=contentDetails&id=zOYW7FO9rzA,zOYW7FO9rzA,-vH2eZAM30s&key={Your API KEY}
Therefore, you won't have to make a call for each video
The result will be:
{
"kind": "youtube#videoListResponse",
"etag": "\"iDqJ1j7zKs4x3o3ZsFlBOwgWAHU/p3KyUGr7ZRowLgKTqVFixrx7-mQ\"",
"pageInfo": {
"totalResults": 3,
"resultsPerPage": 3
},
"items": [
{
"kind": "youtube#video",
"etag": "\"iDqJ1j7zKs4x3o3ZsFlBOwgWAHU/psAhg0bxv1n1IfKwXhrPMV223YE\"",
"id": "zOYW7FO9rzA",
"contentDetails": {
"duration": "PT1M21S",
"dimension": "2d",
"definition": "hd",
"caption": "false",
"licensedContent": false
}
},
{
"kind": "youtube#video",
"etag": "\"iDqJ1j7zKs4x3o3ZsFlBOwgWAHU/YCi772AbPZizPuAFci702rE55tU\"",
"id": "T3Ysb9O3EWI",
"contentDetails": {
"duration": "PT1H28M47S",
"dimension": "2d",
"definition": "hd",
"caption": "false",
"licensedContent": false
}
},
{
"kind": "youtube#video",
"etag": "\"iDqJ1j7zKs4x3o3ZsFlBOwgWAHU/2BnWErqkysQERsaRNyd1ffGgJes\"",
"id": "-vH2eZAM30s",
"contentDetails": {
"duration": "PT12M57S",
"dimension": "2d",
"definition": "hd",
"caption": "false",
"licensedContent": false
}
}
]
}
The format duration: 1H1M1S = 1 hour & 1 minute & 1 second