获取当前用户的 YouTube 内容所有者 ID [英] Obtaining the current user's YouTube content owner id

查看:36
本文介绍了获取当前用户的 YouTube 内容所有者 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下午好

我创建了一个从 YouTube Analytics API 中提取数据的应用.我的任务是获取 contentOwner 货币报告,为此我需要一个 OWNER_NAME,这对我来说是个问题.我测试了 YouTube 帐户,上面有货币报告,但没有连接到 YouTube CMS.

I've created an app that is pulling data from YouTube Analytics API. My task is to get contentOwner monetary reports, and for that I need an OWNER_NAME which is an issue for me. I have test YouTube account that have monetary reports on it but its not connected to a youTube CMS.

  1. 与 cms.youtube.com 的连接是否需要提取显示在 youtube 分析中的 contentOwner 报告?
  2. 用户是否必须自己提供 OWNER_NAME(或 ContentOwner_ID ?),或者我可以以某种方式提取它?

授权会授予对 yt-analytics-monetary.readonly、yt-analytics.readonly、youtubepartner 和其他几个的访问权限.

Authorization grants access to the yt-analytics-monetary.readonly, yt-analytics.readonly, youtubepartner and few others.

推荐答案

假设您有一个 OAuth 2 令牌可以访问 https://www.googleapis.com/auth/youtubepartner 范围,您可以对 youtubePartner.contentOwners.list(fetchMine=true) 进行 API 调用,以获取与当前 OAuth 2 令牌关联的 YouTube 内容所有者列表.(通常只会返回一个项目.)然后您可以从返回的 items 列表中每个项目的 id 属性中获取内容所有者 id 值.这是您在制作内容所有者 YouTube 分析 API 报告或使用 YouTube 数据 API v3 中的 onBehalfOfContentOwner 委托参数时可以使用的值.

Assuming you have an OAuth 2 token with access to the https://www.googleapis.com/auth/youtubepartner scope, you can make an API call to youtubePartner.contentOwners.list(fetchMine=true) to get back a list of YouTube content owners associated with the current OAuth 2 token. (There will normally only be one item returned.) You can then get the content owner id value from the id property of each item in the items list that's returned. This is the value that you can use when making content owner YouTube Analytics API reports, or using the onBehalfOfContentOwner delegation parameter in the YouTube Data API v3.

如果您无权访问 https://www.googleapis.com/auth/youtubepartner 范围,但仍想编写请求 YouTube 分析 API 内容所有者报告的代码,则需要让与您合作的内容合作伙伴告诉您他们的内容所有者 ID.

If you don't have access to the https://www.googleapis.com/auth/youtubepartner scope but you still want to write code that requests YouTube Analytics API content owner reports, you need to ask the content partner you're working with to tell you their content owner id.

我会链接到文档,但目前尚未公开.不过,这是一个足够常见的问题,我认为应该回答.

I'd link to the documentation, but it's currently not exposed publicly. This is a common enough question that I thought it should be answered, though.

这篇关于获取当前用户的 YouTube 内容所有者 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆