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

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.

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")

Youtube api v3 - list of deleted vids

we are using the youtube api to keep track of youtube videos. currently we "watch" around 30k videos. now we have the issue that we want to figure out which videos have been deleted. is there some way to get e.g. a list of all deleted vids of a channel or some other way?
sending a single request (and handling 404) for each video doesn't seem to be a good idea.
I guess you can not do it with only youtube api.
You can create your own database of all your videos and channels and periodically sync it with youtube to check what video status changed or not exists in list anymore.
Youtube API has method Videos.list, it returns list of all your videos.
Another tricky way: load every video url and check the size of content instead of parsing html.
If video exists then content size about 50kb, if not - 15kb. It seems youtube do not pass Content-Length header. That's why you need to load content to check size.
But I prefer the first way.

YouTube API Search by Tags

I'm trying to add videos to an existing ASP.NET MVC site, and I'd like to show videos from our YouTube channel.
I have added a tag to each video to indicate what page it should appear on. I had thought that I could search our channel by tag on each page to render the relevant video on that page.
I'm trying to exclusively use the API v3, but it seems I can't do this.
I can't use developer tags, because videos are uploaded by multiple users using the standard YouTube front end. This seems like basic functionality, so I'm assuming it's my inexperience with this API.
As an example, our YouTube channel is ChillinWithCharlie. During development, one video is tagged 20141213Cheneys.
I can get all videos in our channel, but is there a way to query the v3 API to retrieve just this video?
I've seen one suggestion here that I retrieve all videos, and filter in code. This feels inefficient, so I'd rather not do this, but I can't even see where the tag is returned with all channel videos, that I could interrogate in code.
It's not just you. There seems to be no specific query parameter to search by tag with API v3.
I would recommend doing a search with your tag in the 'q' (search) parameter, then checking the results to see if the tag exists in the returned snippet->tags property to verify the exact video.
Note YouTube tags are only visible to the video's uploader.
https://developers.google.com/youtube/v3/docs/videos#snippet.tags[]

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.
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.

Resources