通过 YouTube 合作伙伴频道使用 YouTube 直播 API
Using the youtube livestream API with a youtube partner channel
我一直对这个感到困惑。我有一个 youtube 频道,我是其中的所有者。我一直在使用 OAuth2 并向我的所有者帐户进行身份验证,然后使用以下访问域
提供对我的 youtube 帐户的访问权限
https://www.googleapis.com/auth/youtubepartner, https://www.googleapis.com/auth/youtube.force-ssl, https://www.googleapis.com/auth/youtube.readonly, https://www.googleapis.com/auth/youtube
我在 python google api 界面中使用各种参数发出 youtube.liveStreams().list
命令,但我从未得到有用的信息。
我目前有一个未列出的流 运行,DsjbycJHosw。
list_streams_request = youtube.liveStreams().list( part="snippet", id="DsjbycJHosw" )` responds with `{'etag': '"m2...gE"', 'kind': 'youtube#liveStreamListResponse', 'items': [], 'pageInfo': {'totalResults': 0, 'resultsPerPage': 5}}
list_streams_request = youtube.liveStreams().list( part="snippet", mine="true" )` responds with `{'etag': '"m2...gE"', 'kind': 'youtube#liveStreamListResponse', 'items': [], 'pageInfo': {'totalResults': 0, 'resultsPerPage': 5}}
list_streams_request = youtube.liveStreams().list( part="snippet", broadcastStatus="all" )
给我一个 python 错误。看起来 Python API 不支持。 TypeError: Got an unexpected keyword argument "broadcaststatus
list_streams_request = youtube.liveStreams().list( part="snippet", onBehalfOfContentOwner="[Channel Youtube UserID (base64)]" )` responds with `b'{\n "error": {\n "errors": [\n {\n "domain": "youtube.parameter",\n "reason": "missingRequiredParameter",\n "message": "No filter selected. Expected one of: mine, id, default",\n "locationType": "parameter",\n "location": ""\n }\n ],\n "code": 400,\n "message": "No filter selected. Expected one of: mine, id, default"\n }\n}\n'
好的,那么,我需要结合我的频道 ID 给它一些东西,对吗?让我们添加一个 "mine"=true.
list_streams_request = youtube.liveStreams().list( part="snippet", onBehalfOfContentOwner="[Channel Youtube User ID(base64)]", mine="true" )` responds with `b'{\n "error": {\n "errors": [\n {\n "domain": "youtube.parameter",\n "reason": "invalidMine",\n "message": "The \u003ccode\u003emine\u003c/code\u003e parameter cannot be used in requests where the authenticated user is a YouTube partner. You should either remove the \u003ccode\u003emine\u003c/code\u003e parameter, authenticate as a YouTube user by removing the \u003ccode\u003eonBehalfOfContentOwner\u003c/code\u003e parameter, or act as one of the partners channels by providing the \u003ccode\u003eonBehalfOfContentOwnerChannel\u003c/code\u003e parameter if available for the called method.",\n "locationType": "parameter",\n "location": "mine"\n }\n ],\n "code": 400,\n "message": "The \u003ccode\u003emine\u003c/code\u003e parameter cannot be used in requests where the authenticated user is a YouTube partner. You should either remove the \u003ccode\u003emine\u003c/code\u003e parameter, authenticate as a YouTube user by removing the \u003ccode\u003eonBehalfOfContentOwner\u003c/code\u003e parameter, or act as one of the partners channels by providing the \u003ccode\u003eonBehalfOfContentOwnerChannel\u003c/code\u003e parameter if available for the called method."\n }\n}\n'
真的吗? API 先生,加油吧。如果我使用 onBehalfOfContentOwnerChannel
呢?
list_streams_request = youtube.liveStreams().list( part="snippet", onBehalfOfContentOwnerChannel="[My base64 channel ID]" )` yeilds `b'{\n "error": {\n "code": 500,\n "message": null\n }\n}\n'
我能想到的每一种组合都会给我一大堆错误代码 500。
我似乎也无法在 python API 中设置 forContentOwner
,所以那里没有骰子。如何做到这一点?
这不再是问题。截至 2018 年 1 月,他们已经解决了这个问题。 API 的行为完全符合预期,因为 youtube 合作伙伴现在可以执行 oauth 权限。
我一直对这个感到困惑。我有一个 youtube 频道,我是其中的所有者。我一直在使用 OAuth2 并向我的所有者帐户进行身份验证,然后使用以下访问域
提供对我的 youtube 帐户的访问权限https://www.googleapis.com/auth/youtubepartner, https://www.googleapis.com/auth/youtube.force-ssl, https://www.googleapis.com/auth/youtube.readonly, https://www.googleapis.com/auth/youtube
我在 python google api 界面中使用各种参数发出 youtube.liveStreams().list
命令,但我从未得到有用的信息。
我目前有一个未列出的流 运行,DsjbycJHosw。
list_streams_request = youtube.liveStreams().list( part="snippet", id="DsjbycJHosw" )` responds with `{'etag': '"m2...gE"', 'kind': 'youtube#liveStreamListResponse', 'items': [], 'pageInfo': {'totalResults': 0, 'resultsPerPage': 5}}
list_streams_request = youtube.liveStreams().list( part="snippet", mine="true" )` responds with `{'etag': '"m2...gE"', 'kind': 'youtube#liveStreamListResponse', 'items': [], 'pageInfo': {'totalResults': 0, 'resultsPerPage': 5}}
list_streams_request = youtube.liveStreams().list( part="snippet", broadcastStatus="all" )
给我一个 python 错误。看起来 Python API 不支持。 TypeError: Got an unexpected keyword argument "broadcaststatus
list_streams_request = youtube.liveStreams().list( part="snippet", onBehalfOfContentOwner="[Channel Youtube UserID (base64)]" )` responds with `b'{\n "error": {\n "errors": [\n {\n "domain": "youtube.parameter",\n "reason": "missingRequiredParameter",\n "message": "No filter selected. Expected one of: mine, id, default",\n "locationType": "parameter",\n "location": ""\n }\n ],\n "code": 400,\n "message": "No filter selected. Expected one of: mine, id, default"\n }\n}\n'
好的,那么,我需要结合我的频道 ID 给它一些东西,对吗?让我们添加一个 "mine"=true.
list_streams_request = youtube.liveStreams().list( part="snippet", onBehalfOfContentOwner="[Channel Youtube User ID(base64)]", mine="true" )` responds with `b'{\n "error": {\n "errors": [\n {\n "domain": "youtube.parameter",\n "reason": "invalidMine",\n "message": "The \u003ccode\u003emine\u003c/code\u003e parameter cannot be used in requests where the authenticated user is a YouTube partner. You should either remove the \u003ccode\u003emine\u003c/code\u003e parameter, authenticate as a YouTube user by removing the \u003ccode\u003eonBehalfOfContentOwner\u003c/code\u003e parameter, or act as one of the partners channels by providing the \u003ccode\u003eonBehalfOfContentOwnerChannel\u003c/code\u003e parameter if available for the called method.",\n "locationType": "parameter",\n "location": "mine"\n }\n ],\n "code": 400,\n "message": "The \u003ccode\u003emine\u003c/code\u003e parameter cannot be used in requests where the authenticated user is a YouTube partner. You should either remove the \u003ccode\u003emine\u003c/code\u003e parameter, authenticate as a YouTube user by removing the \u003ccode\u003eonBehalfOfContentOwner\u003c/code\u003e parameter, or act as one of the partners channels by providing the \u003ccode\u003eonBehalfOfContentOwnerChannel\u003c/code\u003e parameter if available for the called method."\n }\n}\n'
真的吗? API 先生,加油吧。如果我使用 onBehalfOfContentOwnerChannel
呢?
list_streams_request = youtube.liveStreams().list( part="snippet", onBehalfOfContentOwnerChannel="[My base64 channel ID]" )` yeilds `b'{\n "error": {\n "code": 500,\n "message": null\n }\n}\n'
我能想到的每一种组合都会给我一大堆错误代码 500。
我似乎也无法在 python API 中设置 forContentOwner
,所以那里没有骰子。如何做到这一点?
这不再是问题。截至 2018 年 1 月,他们已经解决了这个问题。 API 的行为完全符合预期,因为 youtube 合作伙伴现在可以执行 oauth 权限。