如何使用YouTube v3 API检索YouTube视频的标签?



我想使用YouTube API v3检索特定YouTube视频的标签。

我可以通过对搜索端点https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=1&q=cats&type=video&key={YOUR_API_KEY}的请求检索视频。

现在我点击视频端点,试图从上面的查询中获取视频的标签。https://www.googleapis.com/youtube/v3/videos?id=IytNBm8WA1c&部分= snippet&关键= {YOUR_API_KEY}

,

{
 "kind": "youtube#videoListResponse",
 "etag": ""PMn2rAVTRiZHkX45qiqfcLZoTXM/rYBuk4KeZFmSMoiSuaXfy6-Pm28"",
 "items": [
  {
   "id": "IytNBm8WA1c",
   "kind": "youtube#video",
   "etag": ""PMn2rAVTRiZHkX45qiqfcLZoTXM/_6K6Qz8rLYf0d5gUnucV1LwbwU4"",
   "snippet": {
    "publishedAt": "2007-07-09T14:02:03.000Z",
    "channelId": "UCFMV3DqmnaRc4oNGvi-3OvQ",
    "title": "Funny Cats",
    "description": "it's soo funny :Drnrnaudio content is licensed by UMGrnrnSong 1: Gioachino Rossini - The Thieving Magpie  0:00 - 1:37rnSong 2: The Presidents of the United States of America - Kitty  1:38 - 2:47rnSong 3: The Nutcracker  2:48 - 3:51rnSong 4: Smash Mouth - All Star  3:51 - 7:06rnSong 5: The Wiseguys - Ooh La La  7:07 - 7:43rnrnPS: i will ignore messages with the subjectrn"Business Proposal Regarding Your YouTube Videos"",
    "thumbnails": {
     "default": {
      "url": "https://i.ytimg.com/vi/IytNBm8WA1c/default.jpg"
     },
     "medium": {
      "url": "https://i.ytimg.com/vi/IytNBm8WA1c/mqdefault.jpg"
     },
     "high": {
      "url": "https://i.ytimg.com/vi/IytNBm8WA1c/hqdefault.jpg"
     }
    },
    "channelTitle": "nguoap",
    "categoryId": "15"
   }
  }
 ]
}

此请求的API资源管理器- https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videos.list?id=IytNBm8WA1c∂snippet&_h=3&

即使我授权这个请求,我也会得到相同的结果。尽管如果被授权的帐户拥有视频,它返回标签

如何在不要求最终用户授权其帐户的情况下获得我拥有的视频的标签?这个实现是使用JS的客户端。

UPDATE: GData Issue Link: https://code.google.com/p/gdata-issues/issues/detail?id=4513

根据https://developers.google.com/youtube/v3/docs/videos/list,最新版本的YouTube API现在返回标签:

https://www.googleapis.com/youtube/v3/videos?key={API-key}&fields=items(snippet(title,description,tags))&part=snippet&id={video_id}

不幸的是,目前只有当您认证自己为频道所有者时才能获得带有标签的视频。

获取YouTube标题、描述和标签的方法

  1. 首先创建Google API密钥
    https://console.cloud.google.com/home/dashboard

  2. 转到凭据-创建API密钥
    项目https://console.cloud.google.com/apis/credentials?folder=& organizationId =, =

  3. 启用YouTube API
    https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=

  4. 下载邮差软件在google服务器YouTube API上POST数据
    https://www.googleapis.com/youtube/v3/videos?key=your-key&字段=项目(片段(标题、描述、标签),部分= snippet& id = youtube-id

相关内容

  • 没有找到相关文章