我正在尝试使用以下方法获取自己的 channel 订阅者列表
但是它给了我错误
{
"error": {
"errors": [
{
"domain": "youtube.parameter",
"reason": "incompatibleParameters",
"message": "Incompatible parameters specified in the request: channelId, mySubscribers",
"locationType": "parameter",
"location": ""
}
],
"code": 400,
"message": "Incompatible parameters specified in the request: channelId, mySubscribers"
}
}
最佳答案
documentation for the parameter mySubscribers
of subscribers.list
指出:
请务必注意,有两种方法可以查询YouTube API:
&key=
的请求中,就像您所做的一样。 后面的过程稍微复杂一点,但是如果您想使用
mySubscriptions
或mine
参数,则有必要。当仅使用API密钥时,这些参数不可用,因为API密钥未绑定(bind)到用户/ channel 。自从您写了您想获得“自己的 channel 订户列表”以来,我假设您对已订阅您的人员列表感兴趣,而不对已订阅的人员列表感兴趣。对于这种情况,您实际上不能使用
channelId
端点的subscriptions.list
参数,因为文档指出:(实际上,这意味着您已经订阅了所有 channel ,这不是您想要的。)
为了检索已订阅您 channel 的人员列表,您需要使用OAuth 2.0 token 授权您的请求(请参见上面链接的指南)。
另请注意,就像您不会通过YouTube网站看到这些订阅者一样,如果用户决定在其隐私设置中隐藏其订阅,则这些订阅者也不会显示在API中。
关于php - 获取youtube订阅者列表给出400错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43424483/