Youtube Data API v3, Receiving 403 after creating multiple streams - youtube

I am using the Youtube Data API to create live broadcasts programatically. Within the hour, I am able to create around 5-6 streams at which point I will begin to receive 403 insufficientLivePermissions error. If I wait another 30 minutes and try again, it allows me to make 2 more broadcasts but will then return 403s again.
I checked to see if my access token was expired, but it works when making listing requests. It almost seems to be that I am getting rate limited. When I check my Youtube account however, all indicators are in green so I don't believe I am abusing their API.
This is the response from the YouTube Data v3 API:
{
"error": {
"errors": [
{
"domain": "youtube.liveBroadcast",
"reason": "insufficientLivePermissions",
"message": "Request is not authorized",
"extendedHelp": "https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/insert#auth_required"
}
],
"code": 403,
"message": "Request is not authorized"
}
}
I am also not hitting anywhere near the Quota limits for the API. Any ideas to why the 403 insufficientLivePermissions would be much appreciated!

This issue means that you actually created too many live streams :
if you go to https://www.youtube.com/my_live_events?action_create_live_event=1 and try to create a new livestream you will see :
You are creating too many live streams. Please wait a while before creating further streams.
I think the maximum is set to 6 to 7 streams per 24 hours.
ps : It's really not related to the issue in the documentation
(missing scopes)

Based on this documentation, the error insufficientLivePermissions means that the request is not authorized to create the live broadcast.
First, try to use the scope https://www.googleapis.com/auth/youtube.force-ssl together with https://www.googleapis.com/auth/youtube and check if the error 403 will gone.
If not, then I suggest you to check this YouTube Live Streaming API - Understanding Broadcasts and Streams to understand more how the broadcast work.
According to this guide, the stream enables you to transmit audio-video content to YouTube, and it defines the settings for how you stream your content to YouTube. The same stream can be bound to up to three live broadcasts.
So if you want to create many live broadcast, this guide Use one stream to create simultaneous broadcasts can help you to do it.

Related

Youtube liveBroadcast insert limits?

I'm providing management of live streaming to the International Sporting Competition. At the request of the client we're using YouTube as a delivery platform. I've built an interface so the events and stream keys can be easily managed outside of the Youtube API. Ideally I would like to insert all events, so end users can have a direct link to the YouTube event.
After inserting 30 events (inserting at a rate of 1 per second) I seem to have hit an undocumented limit. I get a 403 error "request not authorised". I can still use the credentials for other actions so I have not crossed the global quota for the user or the account.
Unfortunately the Youtube API increase form is broken so I cannot contact Youtube there and request a rate increase.
Looks like there's a limit of 50 liveBroadcast.inserts(). This may be per 24 hour period I will confirm tomorrow. The web gui confirms that it is denying my requests because I have made too many live events and to try again "later".

Increase the quota for Youtube v3

I'm a developer of a program for streamers. It receives and displays various information, such as chat, super chat, sponsors. The problem is that at the moment the program is close to the limit. And this despite the fact that I increased the delay between requests, but it did not help, because every day there are new users.
How can I increase the quota for Youtube v3?
Check this quota request page for Youtube API. You'll be required to answer several questions:
This application also requires you to submit screenshots and design
documents relating to your API Client(s) and your use of YouTube
API(s). If you do not have these ready, please apply once these are
available.

YouTube Streaming API says user is not enabled for live streaming

I'm using Google's YouTube API Explorer (alternate) to look up information on an arbitrary streaming broadcast belonging to someone else.
No matter what I put into the id field, I always get back
{
"error": {
"errors": [{
"domain": "youtube.liveBroadcast",
"reason": "liveStreamingNotEnabled",
"message": "The user is not enabled for live streaming.",
"extendedHelp": "https://www.youtube.com/features"
}],
"code": 403,
"message": "The user is not enabled for live streaming."
}
}
This seems ridiculous, considering that the video is plainly streaming.
It occurred to me that I might have misunderstood the instructions for the id field, so I've tried a couple different possibilities. These include...
The Channel ID (UCHZoP1Jy-g_h3sqzScrOEwQ)
The User ID (GWTV)
The Video ID (J_RrkyIOVhg)
...each to no avail.
How can I ask a channel about its live streaming videos? This question would have answered that in the past, but the comments indicate that the answer no longer works. This question wasn't really any help either.
Edit 2022
If you are looking for how to get streaming state and currently streaming video from an arbitrary channel, check out this question and particularly this answer.
The Errors heading of the API documentation has this interesting chart:
Error Type
Error Detail
Description
insufficientPermissions
insufficientLivePermissions
The request is not authorized to retrieve the live broadcast
insufficientPermissions
liveStreamingNotEnabled (This is the error I'm getting.)
The user that authorized the request is not enabled to stream live video on YouTube. The user can find more information at https://www.youtube.com/features
which implies that because my account is not enabled for live streaming, I can't look at anyone else's live stream information in the API, even if I can pull it up in the browser. This seems kind of arbitrary, but the error I got in the original question turned out to be the permissions problem.
Note that even after enabling live streaming for myself, I still can't get useful data for third-party streams because Google does not allow checking the Live Streaming API for users that are not you.
I had the same error message when trying to get Youtube Livestream status.
In my case I'm using 'Youtube Brand Account' and it's worth trying to switch the brand account as the authorized user. That worked fine.
HTH
In order to fix this we need to enable live stream in studio > setting > channel > feature > enable broadcast
Live stream services will work after 24 hours

Is there an API available for the Youtube "stream now (beta)" service?

I recently found a new service on Youtube located at "stream now". It appears to still be in Beta
I would like to interact with this service using the Youtube Data API. To be more specific I would like to get the streaming address (after oauth authorization).
But the problem is I can't find it in the Youtube APIs Explorer.
Unfortunately, there is no endpoint available for this particular function (yet). As an alternative, you can create a new live event using youtube.liveStreams.insert and work with that.
At a minimum you can query the "Stream now" stream, and it returns a LiveBroadcast object the same as any other stream.
As per this answer to find the "Stream now" stream you call LiveBroadcasts.List with broadcastType=persistent and mine=true.
You can check the liveBroadcast.status.lifeCycleStatus to determine whether the "Stream now" stream is live.

Can I use YouTube API to enable YouTube Live Streaming?

I'm developing a YouTube live streaming related program. I know there're APIs to create/list/delete broadcasts and live streams. But all these are assuming that YouTube Live Streaming is already enabled on your account.
I tried to but failed to find any API with which I can use to enable YouTube live streaming on my account. Is there such an API?
As far as I can tell, there is not. As you can see here: https://support.google.com/youtube/answer/2474026?hl=en, in order to create live events on youtube an account must be verified and in good standing.
If you are making the API requests using a YouTube account that fulfills these requirements you can use the YouTube Data API to create liveBroadcasts, otherwise you will likely receive an insufficientPermissions error. This error is detailed here: https://developers.google.com/youtube/v3/live/docs/errors#youtube.liveBroadcasts.insert-insufficientPermissions-liveStreamingNotEnabled-permission.userNotEnabled
One potential way you could tell if an account is able to create live events programmatically would be to call the channels.list() method, and return the status. The status of the channels will have status.longUploadStatus. Long uploads also require an account to be verified and in good standing, so if this value returns allowed you likely have the permissions to work with live events. More details of this can be found in the YouTube Data API documentation.
Let me know if you find information to the contrary.

Resources