gdata api v3 youtube,无法检索contentDetails [英] gdata api v3 youtube, can not retrieve contentDetails

查看:90
本文介绍了gdata api v3 youtube,无法检索contentDetails的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过搜索获取​​YouTube视频的时长

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'
});

作为附加的零件参数,我添加了contentDetails以获得持续时间,如您在其文档中所见. https://developers.google.com/youtube/v3/getting-started

as an additional part parameter I added contentDetails in order to get the duration as you can see in their doc. https://developers.google.com/youtube/v3/getting-started

现在是愚蠢的部分.我得到的响应如下:

Now comes the silly part. The response I get is the following:

[
{
"error": {
   "code": -32602,
   "message": "contentDetails",
   "data": [
     {
     "domain": "youtube.part",
     "reason": "unknownPart",
     "message": "contentDetails",
     "locationType": "parameter",
     "location": "part"
    }
   ]
  },
  "id": "gapiRpc"
 }
]

因此,part参数要求您选择应用程序实际使用的资源组件" 那就是我所做的,现在他们不再知道自己的参数了?

"As such, the part parameter requires you to select the resource components that your application actually uses" Thats what I did and now they dont know their own parameter anylonger?

所以我想知道一般如何检索工期单contentDetails? 最好 菲尔

So I was wondering how can I retrieve the duration order contentDetails in general? best phil

推荐答案

如文档中所写,对于search-> list调用,part只能使用值"snippet".

As written in the document, for search->list call, part can only take value "snippet".

根据响应的种类,作为辅助呼叫,您可以执行一次视频->列表,播放列表->列表,频道->具有ID和part = snippet,contentDetails的列表,以获取每个结果项的更多详细信息.

Depending on the kind of the response, as a secondary call, you can do one of videos->list, playlists->list, channels->list with the id and part=snippet,contentDetails to get more details of each result item.

这篇关于gdata api v3 youtube,无法检索contentDetails的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆