Obtaining the current user's YouTube content owner id

我的梦境 提交于 2019-12-18 16:30:42

问题


Good afternoon

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. Is the connection to cms.youtube.com neccessay to pull contentOwner reports which are shown on youtube analytics?
  2. Does a user have to provide OWNER_NAME ( or ContentOwner_ID ? ) by himself, or can I pull it somehow?

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


回答1:


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.

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.



来源:https://stackoverflow.com/questions/17209606/obtaining-the-current-users-youtube-content-owner-id

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!