【问题标题】:Retrieve Youtube Tags using Jquery使用 Jquery 检索 Youtube 标签
【发布时间】:2015-03-15 16:03:56
【问题描述】:

我试图弄清楚如何检索 Youtube 标签并在我的代码中使用它们,但我什至似乎无法检索任何信息。使用 ,; 之类的分隔符检索标签的最佳方法是什么?

  var video_id='VA770wpLX-Q';

$.getJSON('http://gdata.youtube.com/feeds/api/videos/'+video_id+'?v=2&alt=jsonc',function(data,status,xhr){
alert(data.data.tags);
 });

这是 Json 对象的样子:

 {
"apiVersion": "2.1",
"data": {
    "id": "VA770wpLX-Q",
    "uploaded": "2011-02-24T22:31:02.000Z",
    "updated": "2012-04-08T21:37:06.000Z",
    "uploader": "drdrevevo",
    "category": "Music",
    "title": "Dr. Dre - I Need A Doctor (Explicit) ft. Eminem, Skylar Grey",
    "description": "Music video by Dr. Dre performing I Need A Doctor featuring Eminem and Skylar Grey (Explicit). © 2011 Aftermath Records",
    "tags": ["Dr", "Dre", "Eminem", "New", "Song", "Skylar", "Grey", "GRAMMYs", "Dr.", "Need", "Doctor", "video", "Eazy", "N.W.A.", "NWA", "easy", "drdre", "and", "em"],
    "thumbnail": {
        "sqDefault": "http://i.ytimg.com/vi/VA770wpLX-Q/default.jpg",
        "hqDefault": "http://i.ytimg.com/vi/VA770wpLX-Q/hqdefault.jpg"
    },
    "player": {
        "default": "http://www.youtube.com/watch?v=VA770wpLX-Q&feature=youtube_gdata_player"
    },
    "content": {
        "5": "http://www.youtube.com/v/VA770wpLX-Q?version=3&f=videos&app=youtube_gdata"
    },
    "duration": 457,
    "aspectRatio": "widescreen",
    "rating": 4.902695,
    "likeCount": "430519",
    "ratingCount": 441253,
    "viewCount": 88270796,
    "favoriteCount": 306556,
    "commentCount": 270597,
    "status": {
        "value": "restricted",
        "reason": "requesterRegion"
    },
    "restrictions": [{
        "type": "country",
        "relationship": "deny",
        "countries": "DE"
    }],
    "accessControl": {
        "comment": "allowed",
        "commentVote": "allowed",
        "videoRespond": "allowed",
        "rate": "allowed",
        "embed": "allowed",
        "list": "allowed",
        "autoPlay": "denied",
        "syndicate": "allowed"
    }
}
}

【问题讨论】:

  • 上面的api没有给tags。我不确定您从哪里获得 json 数据,但当前 api 不再提供标签
  • @DhirajBodicherla 真不幸!如何获取标签?
  • 它确实给出了标签,但只给视频所有者。您可以去这里developers.google.com/apis-explorer/#p/youtube/v3/…,使用 OAuth 2.0 授权您的请求,然后在您自己的视频中,您将获得标签。遗憾的是,由于某些错误,即使使用身份验证,这也不适用于 PHP API。

标签: javascript c# jquery asp.net youtube


【解决方案1】:

Youtube 的 API 不再支持“标签”功能。

【讨论】:

猜你喜欢
  • 2020-07-07
  • 2013-04-20
  • 2013-03-06
  • 1970-01-01
  • 1970-01-01
  • 2012-07-03
  • 2018-02-19
  • 1970-01-01
  • 2020-04-24
相关资源
最近更新 更多