YouTube Streaming API says user is not enabled for

2020-04-09 23:28发布

问题:

I'm using Google's YouTube API Explorer (alternate) to look up information on an arbitrary streaming broadcast.

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.

回答1:

The Errors heading of the API documentation has this interesting chart:

Error Type | Error Detail                | Description
-----------+-----------------------------+------------------------------------------
insuf...ns | insufficientLivePermissions | The request is not authorized to retrieve
           |                             | the live broadcast.
-----------+-----------------------------+------------------------------------------
insuf...ns | liveStreamingNotEnabled     | The user that authorized the request is not
           |                             | enabled to stream live video on YouTube.
           |             ^               | The user can find more information at
           |   (I'm getting this one)    | 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 it turned out to be the permissions problem.

Note that I still can't get useful data.



标签: youtube-api