Getting access to YouTube Content ID API - youtube-api

My original purpose is to get all of the channels that a user manages. I found a code snippet that does exactly that: https://developers.google.com/youtube/partner/code_samples/python#retrieve_a_content_owner_s_managed_channels
However, it seems to rely on the YouTube Content ID API, when I run it I get the following error:
YouTube Content ID API has not been used in project ... before or it is disabled.
However, the YouTube Content ID API doesn't show in the projects console. I manage several YouTube channels, and one of them is part of the YouTube Partner Program. So, my question is, how do I get access to the YouTube Content ID API?
I've been reading about this for several hours and found several conflicting statements.
Here, saying:
As a YouTube partner, you can use the API...
Here, saying:
in order to be able to access the ContentID API, you have to be part of
the ContentID Partner Program, not the YouTube Partner Program.
However, you're not likely going to have ContentID access if you don't have major copyright management control issues
Which is weird, since the data I need has nothing to do which copyrights at all, so why would I need an API that relates to that to get it?
Here, saying:
You don't see it in the list auf available APIs, unless your account
is connected to a CMS and some time has past... It takes 7-14 days
unless the Content ID API is available for your account. This is a
information i got from the support, but they told me, that it is an
automated step.
So, which one is it? If I'm only part of the YouTube Partner Program, should I just wait for 2 weeks until the API shows up in my console?
Or does it actually require to be in the ContentID Partner Program (which is not the case here)?

Related

YouTube may disable your inactive project's access to the YouTube Data API Service

I was using Youtube Data APIto get youtube video but after getting mail from youtube which says api is disable due to inactive.
Youtube Data api not working since it was disabled by youtube because of inactive for 90 Days. I am not able to call(It is enable in API Console) it even with delete and add new delete back. Please help.
Error shows when i am calling from Web Browsers with api Key i also tried to generate new API key also delete and regenerate new api key but still no luck.
"Access Not Configured. YouTube Data API has not been used in project
264969722993 before or it is disabled. Enable it by visiting
https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=264969722993
then retry. If you enabled this API recently, wait a few minutes for
the action to propagate to our systems and retry."
There are things you can do to try and solve this issue. This first option is to apply for an API exception by filling out this out this form. I've filled out this form and am waiting for a response.
The second option is to create a new project and use that project to generate an API key. Because Google has only disabled access to the Youtube Data API for your current project, the new project's API key should work just fine. I've tried this and can confirm this works. This is probably the more hassle-free option if you have extra projects to spare as Google only allows 10 projects at any point in time.
I'm in the same position, disabled for no calls in 90 days. You can request an exemption but after about 25 back and forth emails it's clear that it is just a smokescreen. After explaining what it's used for they then wanted screenshots, then videos of you using the application, how we use the videos we pull up, and then a shot of the room where it was being used. They even asked who made the video we were looking at (we have no idea!). They want your whole business model and what you do. It was just never ending questions and more stuff to send them. After about 2 1/2 months of slow back and forth, I get a message saying I am out of compliance.
Our application uses YouTube to pull up videos for manufacturers product for research and training in a small training/conference room for internal use only. That's all!
Nothing was out of compliance.
This is the email we received:
Hello ,
We have reviewed your quota extension request for project number
#### and have revoked the allocated quota for your API Client(s) as it is out of compliance on the following YouTube API Services -
Developer Policy:
Policy F. 1 (User Experience - YouTube Look and Feel) Please do not
reply to this email, you may complete and submit this form to re-apply
once the above concern has been addressed.
Thanks, YouTube API Services team
The form link in the email is just a link to start the whole process over again.
According to YouTube policy
If your API Client's quota is reduced or eliminated, you may reapply for quota or a quota extension, and YouTube will review that application based on YouTube’s determination of your expected use of the YouTube API Services.
https://developers.google.com/youtube/terms/developer-policies
I suggest reapplying.
To add to avatarhzh's answer:
If you have already used up your initial cap of max. 12 projects and your channel is a brand account and you do not want to go through the process of applying for more quota/getting back your previous quota, you can also create new projects on a different google account and then add that account to your channel as a manager. It is then possible to access your channel through this new account via the youtube data API.
If your channel is not a brand account yet, you can move your channel to a brand account. This allows you to add different google accounts as managers/co-owners of the channel. Warning: certain things (e.g. comments) cannot be transferred when moving to a brand account.

Storing YouTube metadata

I've read YouTube's Terms of Service several times and have Googled this question tirelessly with no concrete answer. This is not a legal question about my specific YouTube API client, I just want to know if any YouTube developer has used the API in this way. I'm working on a side project for myself that's essentially an Instagram-YouTube mashup. I am a YouTube developer with an API key. Can my API client store a videos title, description and id in my database when my users like a video on my client? I don't know how else I can keep track of my users liked videos within my client.
Since you already specified that this is in fact not a legal question, the short answer is: Yes, you can (meaning it is possible).
There is one more possibility coming to mind, though:
You could authenticate users via OAuth 2.0 using the https://www.googleapis.com/auth/youtube scope. That way, you can manage their liked videos and add/remove videos to this list when a user clicks the according buttons on your website (you can also check if any given video is already liked by the user). In this case, all the track-keeping is done by YouTube itself. This ultimately means that whenever a user likes a video in your app, they also like it on the YouTube website. This may or may not be desired, it is for you to decide that.

Youtube Content ID API has not been used - error 403

I'm trying to get my content-owner-id for upload videos to other channels that I have, as described here.
I'm using the code below to get content-owner-id: (PHP)
$youtubePartner = new Google_Service_YouTubePartner($this->client);
$contentOwnersListResponse = $youtubePartner->contentOwners->listContentOwners(
array('fetchMine' => true));
$contentOwnerId = $contentOwnersListResponse['items'][0]['id'];
And this is the error I got:
A service error occurred: Error calling GET
googleapis.com/youtube/partner/v1/contentOwners?fetchMine=true:
(403) Access Not Configured. Youtube Content ID API has not been used
in project XXXXXXXXXXXXX before or it is disabled. Enable it by
visiting
console.developers.google.com/apis/api/youtubePartner/overview?project=XXXXXXXXXX
then retry. If you enabled this API recently, wait a few minutes for
the action to propagate to our systems and retry.
I tried to go the the link https://console.developers.google.com/apis/api/youtubePartner/overview?project=XXXXXXXXXX but I get "The API doesn't exist or you don't have permission to access it".
Then I searched on google and find out that I need to become a CMS youtube account (I'm also a youtube partner). I also tried to go to cms.youtube.com and log in with my youtube account but I got:
Your Google Account is not linked with YouTube Content Manager. Please
try a different account or contact your Technical Account Manager for
assistance.
Can anyone explain me how to connect to CMS account?
Based from this thread:
You don't see it in the list auf available APIs, unless your account is connected to a CMS and some time has past... It takes 7-14 days unless the Content ID API is available for your account. This is a information i got from the support, but they told me, that it is an automated step.
Your account needs to be connected with a content owner. Be noted that a content owner and a partnered channel are not the same thing.
From this documentation, to request data from a YouTube Content Owner, you need to set the ids parameter value to contentOwner==OWNER_NAME, where OWNER_NAME is the content owner ID.
Check these related SO questions:
How do I get revenue reports from a YouTube CMS account using an API (for an MCN)?
Using the YouTube Analytics API with a CMS account

Using YouTube API v3 to tell if a channel has a live stream

The goal of my YouTube API call is, given a channelId, to return whether that channel is currently live streaming. This is the call I'm making currently:
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId={CHANNEL_ID}&eventType=live&type=video&key={YOUR_API_KEY}
While this call is functional, there is a significant delay between the channel starting a live stream and this call returning the stream.
Is there a better call to use in the YouTube v3 API that doesn't require oAuth? The functionality of my app is read-only.
Thanks!
Probably late but still someone else would use it, i found the answer on google api docs:
https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/list
(Scroll to bottom, you can use their onsite api to make calls on the fly)
The call you have to make is:
GET https://www.googleapis.com/youtube/v3/liveBroadcasts?part=id%2Csnippet%2Cstatus&mine=true&broadcastStatus=active&key={YOUR_API_KEY}
(atm, they have an issue wth the status field). You can remove the filter and check the returned results for
{ "status": { "lifeCycleStatus": "live"}}
And as per google docs:
Before you start
You need a Google Account to access the Google Developers Console, request an >API key, and register your application.
Register your application with Google so that it can submit API requests.
After registering your application, select the YouTube Data API as one of the >services that your application uses:
Go to the Developers Console and select the project that you just registered.
Open the API Library in the Google Developers Console. If prompted, select a >project or create a new one. In the list of APIs, make sure the status is ON for >the YouTube Data API v3 and, if you are a YouTube Content Partner, the YouTube >Content ID API.
Calling the Data API
The API request must be authorized by the Google Account that owns the >broadcasting YouTube channel.
You can check this link for generating an access(OAuth 2.0) token: https://developers.google.com/identity/protocols/OAuth2?hl=en
I hope this helps.
I was digging for a "cheaper" way to find if a channel is live to save some API quota. I attempted to use Konstantin's workaround by looking at the {channel/channel_id}/live but this appears to not work anymore.
The channel no longer redirects when a person is live. Instead it runs on that page.
If they have a username URL then /c/ works: https://www.youtube.com/c/USER_NAME/live
If they have don't have a username and use the default like UC4R8DWoMoI7CAwX8_LjQHig, then you need to use https://www.youtube.com/channel/USER_NAME/live
The /search call is rather expensive. If you are only allotted the initial 10k quota points, you'd run out of points after only 100 queries. That may not be a bother for some use cases, but it is nevertheless limited.
Instead, you can use Playwright and do the following:
page.goto("https://YouTube.com/channel/{channel id}/live")
Then check for a redirection which will happen when the channel is live:
const redirect = page.url()
If redirect contains a link to a YouTube video, then you know the channel is live. Otherwise it is not live and will yield a link similar to the one that's passed in to the goto() function.

How to use the Youtube Analytics API to get the metric "earnings"?

I am a Youtube Partner and I have monetized videos on Youtube. Already receive a small monthly amount through some channels that have associated with my Google Adsense account.
Now, I would like to generate a report gathering the monetary values and views received from each channel.
I did the following question on Google Code, because I thought there was some problem in the API, but it happened that I was using the API incorrectly. See the link below.
http://code.google.com/p/gdata-issues/issues/detail?id=4826#makechanges
Now, I still could not make it work because I do not know where to find the requested data in the response I got from the link above.
Where do I find this CMS_ID? I have more than one channel, so I need to have each accepted as a Youtube Content Manager to use the API and retrieve the gains?
Someone here on Stack Overflow already managed to use the Youtube Analytics API using the metric "earnings"?
My code is in Python based on the example from Google here:
https://developers.google.com/youtube/analytics/v1/code_samples/python
I'm using the following scopes:
YOUTUBE_SCOPES = ["https://www.googleapis.com/auth/youtube.readonly",
"https://www.googleapis.com/auth/yt-analytics.readonly",
"https://www.googleapis.com/auth/youtubepartner",
"https://www.googleapis.com/auth/yt-analytics-monetary.readonly"]
As of right now, it's only possible to retrieve monetary information in YouTube Analytics API reports when those reports are run via the context of a content owner, as described in the documentation.
It is possible to have a monetized channel that is opted in for Google AdSense ads without having that channel managed by a content owner, in which case you would not be able to get those metrics via the YouTube Analytics API.
Let's use the issue you previously opened to track the request to open up this type of report to non-content owners as well, as that's a more appropriate place for feature requests than Stack Overflow.

Resources