检查视频是否受 YouTube API v3 的年龄限制 [英] Checking if video is age restricted with v3 of YouTube API

查看:26
本文介绍了检查视频是否受 YouTube API v3 的年龄限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

YouTube API v3 有没有办法检查视频是否有年龄限制?查看文档我无法确认这一点.

Is there a way with v3 of the YouTube API to check if a video has an age restriction on it? Looking at the documentation I've been unable to confirm this.

推荐答案

我找到了与此相关的内容,请检查

I found something related to this,check

 https://www.googleapis.com/youtube/v3/videos?part=contentDetails&id={VIDEO_ID}&key={YOUR_API_KEY}

VIDEO_ID 替换为您要检查的视频的 ID.

replace VIDEO_ID with the id of video you want to check.

API 响应:

{
 "kind": "youtube#videoListResponse",
 "etag": "\"mPrpS7Nrk6Ggi_P7VJ8-KsEOiIw/el3Y0P65UwM366CJD3POX-W4y0c\"",
 "pageInfo": {
  "totalResults": 1,
  "resultsPerPage": 1
 },
 "items": [
  {

   "kind": "youtube#video",
   "etag": "\"mPrpS7Nrk6Ggi_P7VJ8-KsEOiIw/Rn64PVwC0Uhr4xp41vDOqygjJ9c\"",
   "id": "VIDEO_ID",
   "contentDetails": {
    "duration": "PT10M6S",
    "dimension": "2d",
    "definition": "hd",
    "caption": "false",
    "licensedContent": false,
    "contentRating": {
     "ytRating": "ytAgeRestricted"
    }
   }
  }
 ]
}

检查ytRating,它的值为ytAgeRestricted,表示视频有年龄限制.

Check the ytRating, it has value ytAgeRestricted, means the video is age restricted.

来自 Youtube-API 文档:

contentDetails.contentRating.ytRating : string
       A rating that YouTube uses to identify age-restricted content.
       Valid values for this property are: ytAgeRestricted

这篇关于检查视频是否受 YouTube API v3 的年龄限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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