How to detect restricted youtube videos via the api?

Viewed 919

How can I use the youtube api to determine if a video is blocked for students in restricted mode? I have looked through quite a few resources and they all seem like outdated or inaccurate responses. When I go to https://www.googleapis.com/youtube/v3/videos?part=contentDetails&id=IERz1PmkdC4&key={myAPIKey} I get contentDetails but it does not include "contentRating": { "ytRating": "ytAgeRestricted"} even though I know this video is blocked for students in restricted mode.

Is this the wrong api to determine restriction information on a video? Or do I need to be the owner of the video to fetch this info? Or is it no longer possible to get this info via this api?

Currently I have found that I can use a call to https://www.youtube.com/get_video_info?html5=1&video_id=IERz1PmkdC4 when logged in as a student in restricted mode, this will return an error but unrestricted videos will not return an error. But this is an unsupported solution that I would rather avoid.

Resources I have already looked at:

The V3 API documentation - https://developers.google.com/youtube/v3/docs/videos#properties

There is a question here in stack overflow that seems to have an inaccurate response - Checking if video is age restricted with v3 of YouTube API

An untagged question with no response - http://stackoverflow.hex1.ru/questions/35120259/how-can-i-tell-if-a-youtube-video-cannot-be-viewed-with-restricted-mode-enabled

This didn't help - How do I check if a youtube video is blocked/restricted/deleted

0 Answers
Related