Youtube API 2.0 Checking if a video is age restricted - youtube

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.

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

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.

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

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.

Related

YouTube API: Check if Someone Else's Video is Monetized or Not

There is a website called: TubeSift
This tool determines whether a video is "monetized" or not.
My simple question is...
Is there a way to determine if a specific YouTube video is monetized (can show in-stream ads) via some YouTube API?
If yes, which YouTube API?
If no, how then might TubeSift be determining this? Scraping the response?
Important distinction: this would be a video that you DON'T have authentication or credentials to manage - ie: it's someone else's video.
Similar questions asking slightly different things
youtube api to get channel monetization status?
Disclaimer
I realize this question seems off-topic because it doesn't have a code example but YouTube's How to Get Help says to basically ask questions here on StackOverflow for help.
We support the YouTube Data API on Stack Overflow. Google engineers
monitor and answer questions with the youtube-api, youtube-data-api,
and youtube-v3-api tags.
There's really nowhere else to ask.
Youtube provides API to YouTube content partners. I also checked the tubetarget and used scraping also but scraping is very slow as compared to the tubetarget
See this page to get enrolled.
According to youtube: When using delegation in the YouTube Data API, the onBehalfOfContentOwner parameter is always required. The parameter's value is an ID that uniquely identifies the content owner. You can retrieve the ID programmatically by calling the YouTube Content ID API's contentOwners.list method.
Detailed description here
YouTube Partner Program overview, application checklist, & FAQs
Also, check this
YouTube Partner Program policies
Please let me know if you are able to get Content Id API
In my opinion, i think if the video is greater than 10 minutes, therefore that video is being monetized, i read somewhere before that a video needs to have at least 10 minutes in order to be monetized, and obviously we can get the video duration via the API.
The json key is:
+"contentDetails": {#213 ▼
+"duration": "PT4M21S"
The time is formatted as an ISO 8601 string. PT stands for Time Duration, 4M is 4 minutes, and 13S is 13 seconds.
But the way Tubesift does it is just an intelligent guess or maybe some randomizing the "monetized" tagged of a video.
Hope that helps.

YouTube API V3 - How to get normalized game title?

I am trying to get the normalized game name using youtube API for a video if it is in Gaming category.
For example: https://www.youtube.com/watch?v=qIvWgSpy31k, for this video I can see its normalized game name is the description:
But when I use the videos.list method, I can not see this returned. After checking all the properties for the video, I can not find it either.
Is there any way to fetch the game name?
That information isn't exposed by the YouTube API. You can see that by checking the documentation for Videos.list which returns a list of videos resources this is the information available about a video.
You can request it as a new feature here gdata-issues why they are using a gdata forum for issues I have no idea.
I've encountered the same problem, so far in 2020 they haven't implemented it yet. It looks more like business issue. The only way to get game title bound to video is webscraping. I've used headless browser library for Java called HtmlUnit. When you go to the direct url of the video you want to scrape just get html from it and use the regex listed below to acquire game title.
(?<=,"title":\{"simpleText":").*?(?="},"subtitle")

How can we figure out that the YouTube video is monetized using youtube/v3/videos?id=<> call?

Given a YouTube Video id, and using youtube/v3/videos?id=<> API call, how can we find that the video is monetized? Which param in response signifies that?
e.g. https://www.youtube.com/watch?v=E1iqGiX0lSg
Thanks,
Nimish
There is no way to determine whether or not a video is monetized with a call to the YouTube Data API (which appears to be what you mean by youtube/v3/videos?id).
Instead, you'll need the YouTube Content ID API. Keep in mind that you'll have to be a partner of the CMS, and have the authentication of the CMS, to get visibility to a video's policy this way. You'll probably want to determine a video's policyId, and then use the policies.list resource to determine the type of policy (I've never attempted this myself, though this is how I would start).
See this question for more info.

YouTube API comments streaming

Is there any YouTube API which enables external applications to search for keyword/brand name across all video comments on YouTube and send it back to some URL? Also, pull method is fine if the proposed push idea does not exist.
So I would like to know if my brand was mentioned in any video comment on YouTube, similar as what Twitter allows with User/Site Streams.
The YouTube API (v2.0) defines comments as a property of the video object. Details on this relationship here:
https://developers.google.com/youtube/2.0/developers_guide_protocol_comments?hl=en#Retrieve_comments
Therefore, in order to search every YouTube comment you would need to traverse the entire collection of videos. If you're going to attempt something like this, it makes sense to validate your concept by first focusing on the feeds or categories that are most relevant to your brand. Details on feed and categories here:
https://developers.google.com/youtube/2.0/developers_guide_protocol_video_feeds
https://developers.google.com/youtube/2.0/developers_guide_protocol_category_keyword_browsing
No, there isn't anything like this available from the existing youtube api (neither V2 nor V3)

Retrieving artist and song information from youtube

A long time ago, I developed a chrome extension that is able to scrobble the songs you listen to on youtube (via your last.fm account). What I did was simply taking the title of the video and assuming it had the proper format: "Artist - Track name" (obviously, I would send a request to last.fm, confirming it was a proper artist/song pair, before scrobbling). Recently (well, probably a couple of months ago) youtube started to provide artist and song information directly under the video (see image), and I was wondering how best to extract this information.
I was hoping to retrieve the information via the youtube feed api call (http://gdata.youtube.com/feeds/api/videos/videoID?alt=json), but it doesn't apear to be featured in the returned json element. Alternatly, I could try extracting it via xpath, but I figure that might lead to complications when no artist/song information is present. If anybody could help me extract this information, and thereby greatly improving my extension, I would be very grateful.
I don't think YouTube API can provide you with the artist name
as the videos can be other things that songs
you need to stick with what you have , unless they updated there API

Resources