Gdata api v3 youtube, unable to get content details
I am trying to get the duration of a YouTube video via search
var request = gapi.client.youtube.search.list({
q: q,
type : "video",
maxResults : 10,
part: 'snippet,contentDetails'
});
I added contentDetails as a parameter for the extra part to get the duration, as you can see in your document. https://developers.google.com/youtube/v3/getting-started
Now comes the stupid part. The answer I get is the following:
[
{
"error": {
"code": -32602,
"message": "contentDetails",
"data": [
{
"domain": "youtube.part",
"reason": "unknownPart",
"message": "contentDetails",
"locationType": "parameter",
"location": "part"
}
]
},
"id": "gapiRpc"
}
]
"So the detail parameter requires you to select the resource components that the application actually uses." Is this what I did and now they no longer know their own parameter?
So I was wondering how can I get the content of the duration order in general? Best Phil
source to share
As it is written in the document, for search-> list of calls , the part can only take the value "snippet".
Depending on the kind of response, as a secondary call, you can make one of the video-> list, playlists-> list, channels-> lists using id and part = snippet, contentDetails to get more details about each result element.
source to share