Youtube API 2.0 检查视频是否有年龄限制

Youtube API 2.0 检查视频是否有年龄限制

问题描述:

我想查看 YouTube 视频是否有年龄限制.没有很多视频,但有些是.我一直在 youtube api 文档和互联网上进行挖掘,但似乎找不到检测到这一点的方法.

I would like to check and see if a youtube video is age restricted. There are not many videos that are, but some are. I have been digging around in the youtube api documents and on the internet, but can't seem to find a way to detect this.

我使用的是 Youtube API V2,一次只查找一个视频.

I am using the Youtube API V2 and only looking for one video at a time.

要检查某个视频是否在给定区域内有(年龄)限制,可以查看 media:rating 属性视频条目,记录在

To check whether a video is (age) restricted in a given region, you can take a look at the media:rating attribute of the video entry, which is documented at

https://developers.google.com/youtube/2.0/reference#youtube_data_api_tag_media:评分

如果您想进行搜索并过滤掉有年龄限制的视频,您可以使用 safeSearch=strict 参数:

If you want to do a search and filter out videos that are age restricted, you can use the safeSearch=strict parameter:

https://developers.google.com/youtube/2.0/reference#safeSearchsp