如何使用 YouTube API 检查视频是否受到限制? [英] How to use YouTube API to check if a video is restricted?
问题描述
例如,当嵌入此 YouTube 视频时,我们得到 此视频包含来自... 谁阻止了它在网站上显示
错误消息.
When embedding this YouTube video for example, we get This video contains content from... who has blocked it from display on the website
error message.
如何使用 API 来确定视频是否被屏蔽?
How can I use the API to find if a video is blocked or not?
我找到的最接近的参数是 status
和 contentDetails
:
The nearest parameters I found are status
and contentDetails
:
GET https://www.googleapis.com/youtube/v3/videos?part=status&id=dYQ2IyMuPes&key={YOUR_API_KEY}
不返回有关限制的指示:
Which returns no indication about the restriction:
"contentDetails": {
"duration": "PT2M",
"dimension": "2d",
"definition": "hd",
"caption": "false",
"licensedContent": true,
"projection": "rectangular"
},
"status": {
"uploadStatus": "processed",
"privacyStatus": "public",
"license": "youtube",
"embeddable": true,
"publicStatsViewable": false
}
推荐答案
检查是否限制在区域 contentDetails.regionRestriction
或有年龄限制的内容 contentDetails.contentRating
或合作伙伴 contentDetails.licensedContent
声明的内容?我也只是在这里猜测.
Check if it is restricted in the region contentDetails.regionRestriction
or age-restricted content contentDetails.contentRating
or content claimed by partner contentDetails.licensedContent
? I am just speculating here too.
您可以使用它来检查它是否也可嵌入status.embeddable
.
You can use this to check if it is embeddable too status.embeddable
.
这篇关于如何使用 YouTube API 检查视频是否受到限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!