Shylor
Shylor

Reputation: 456

Youtube API 2.0 Checking if a video is age restricted

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.

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

Upvotes: 1

Views: 5738

Answers (4)

Alter
Alter

Reputation: 1223

You can un-restrict those videos by following this link: https://www.quora.com/How-do-you-change-the-settings-of-the-the-age-restrictrincts-on-my-YouTube-videos/answer/Doyle-Lorraine Then your iframes should be back to normal. enter image description here

Upvotes: 0

ajayarjunan
ajayarjunan

Reputation: 101

I agree to Greg Schechter. The actual question was like if we have a video id (eg: In the link http://www.youtube.com/watch?v=RyDY0hiMZy8 the video id is RyDY0hiMZy8), how can we get the age restriction details based on that?

There is an API provided by Youtube to get the details based on the video id. For the above example the API link is: http://gdata.youtube.com/feeds/api/videos/RyDY0hiMZy8?v=2&alt=json But there is no information about the age restriction in the response.

Update on the above post: In the API response from http://gdata.youtube.com/feeds/api/videos/tA4wytG3uh0?v=2&alt=json we have a media$rating content coming and the data coming there can be compared with the rules mentioned in the link https://developers.google.com/youtube/2.0/reference#youtube_data_api_tag_media:rating

For non restricted videos, the media$rating value is not coming in the response. eg: in the link http://gdata.youtube.com/feeds/api/videos/RyDY0hiMZy8?v=2&alt=json

Any updates are welcome.

Upvotes: 2

Jeff Posnick
Jeff Posnick

Reputation: 56104

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:rating

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

Upvotes: 2

Greg Schechter
Greg Schechter

Reputation: 2299

Age gating is not supported for embedded playbacks; so it's not something that is returned in the YouTube data api.

Upvotes: 0

Related Questions