YouTube Streaming API says user is not enabled for live streaming - youtube-api

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

Related

How to know when a user complete viewing a video with youtube api?

I currently working on a project where I send a youtube video id and show it to the user. And I want to know if there are a method to know when the video is completely viewed by the user. In my application's client, I send a response to the server when the view is completed, and I want to prevent receiving falsed data from untrusted user. And that's why I want to know if youtube api make a things like that. I have seen other similar topics, but I haven't found a safe way to secure communication between client and server for this problem.
Thank you.
From this SO post, it was mentioned that you can use onStateChange event to log that a user viewed a video. But the general idea here is about safety which I think is more important, from there I don't think you can do this as per the privacy of a user. You can understand more about YouTube Reporting and Analytics here.

Youtube Data API v3, Receiving 403 after creating multiple streams

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.

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.

YouTube API v3: Liking a video with no channel set up

I have code that will "like" a video through the YouTube API v3. At first, my code was throwing a 403 Forbidden error, and I tracked this down to the fact that my youtube account did not have a channel associated with it. I created a channel by going to youtube.com, and clicking the "add to" link underneath a video. A popup came up that said "Set up your channel to create your playlist on YouTube". As soon as I filled out that form, and clicked continue, the code stopped returning a 403, and started working.
Is there anyway to "like" a video without having to go through this channel setup process? Or if not, is there any way to tell if a user does not have a channel on their account, and prompt them to set it up if needed?
For reference, my code is written in python and is based off of the example here:
https://developers.google.com/youtube/v3/docs/playlistItems/insert
Thanks,
Josh
Edit: There's now a channel.status.isLinked property which will reliably tell you whether a channel resource is "linked" in v3.
That being said, it is possible to like a video using the YouTube.com web interface for an account that doesn't have a channel, and I also believe that it was possible using v2.1 of the legacy GData API. The fact that you can't do that in v3 sounds like a bug to me, and I'll escalate that internally.

Resources