在我的Google帐户(不是主要帐户)上,我创建了OAuth凭据,可以访问CMS及其 channel 。使用此凭据,我可以从YouTube Analytics(分析)API中获取数据,因此这里没有问题。
但是,当我尝试访问YouTube Reporting API时,仅获得内容所有者报告的报告列表,其中包含onBehalfOfContentOwner = cms._id参数和CMS ID。
def list_report_types(cms):
reporting = youtube.reporting()
request = reporting.reportTypes().list(onBehalfOfContentOwner=cms._id)
results = youtube.query(request)
return results.get('reportTypes')
report_types = list_report_types(cms)
谁能帮我也获得 channel 的报道 list ?
因此,当我尝试安排channel_basic_a2报告时,出现以下错误
HttpError 403 when requesting https://youtubereporting.googleapis.com/v1/jobs?alt=json&onBehalfOfContentOwner=cmsid returned "The caller does not have permission">
提前致谢。
最佳答案
两个可能的问题:
您正在使用服务帐户凭据的oauth凭据吗?服务帐户不适用于Youtube Reporting API。参见this答案。
另外,您是否检查了范围定义?
关于youtube - YouTube报告API HttpError 403错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48785951/