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
Related
I want to use the Youtube API to determine if a video is membership-only or not.
I tried to find out the actual video information using YoutubeAPI's videos, channels, playlists, etc., but it doesn't seem to contain any information related to membership.
Is there any good idea?
One more time YouTube Data API v3 doesn't provide a basic feature.
I would suggest you to use my open-source YouTube operational API, indeed by requesting https://yt.lemnoslife.com/videos?part=isMemberOnly&id=VIDEO_ID you would get a JSON with the boolean value interesting you in item['isMemberOnly'].
I host a wiki with many YouTube links and have a script that checks them all regularly to make sure they still exist and are not blocked (by region). I'd like to also check for videos that are inaccessible due to requiring Premium Music membership, but I cannot find that data point in the API documentation.
Example of a restricted Premium Video: https://www.youtube.com/watch?v=NCRnj62bFOY
Thanks for any guidance.
As said #stvar it doesn't seem that any YouTube Data API v3 endpoint meets your needs. However you can bypass the need of the YouTube Data API by downloading the webpage https://www.youtube.com/watch?v=NCRnj62bFOY and checking whether or not this one contains "Music Premium". If so it is a Music Premium limited video.
I have a situation where I need to invite users to to be able to watch a private playlist on videos on Youtube.
I have found information about this at: Add or remove access to your YouTube channel
However that uses the user interface (Youtube page) and I'm looking for doing it in a programmatic way.
The best I found about managing channels is this: Implementation: Channels however there is nothing about invites and access removing.
Is there a way to invite users and and remove a user's permission using the YouTube API or a library?
Thanks.
No there is no way to add or remove permissions on channels though the YouTube Data api.
You might want to check though the issue log and see if anyone has already submitted a feature request for this. YouTube Issue forum.
I would like to get already watched time of YouTube video.
Example:
It is visible in UI, so it must be possible to get somehow. I checked https://developers.google.com/youtube/v3/docs/videos and https://developers.google.com/youtube/v3/docs/search, but this info doesn't seems to be at any of those two.
There is no API endpoint which returns how far along a user is in watching a video. The YouTube api is mostly a file store for videos it doesn't expose information about user progress in a video.
How can I verify whether a user has "YouTube Premium" account via YouTube Data API. I've gone through all the APIs listed in the reference, but couldn't find any.
https://developers.google.com/youtube/v3/docs/
The Youtube api is channel based. This means that all the information is about a specific channel there is no information about the user themselves. That information is not currently available in the YouTube api. You should consider submitting a featuer request to google requesting that they add this information to the api.
You can find the YouTube issue forum here. feature request