获取我自己的YouTube频道的完整列表

发布于 2025-01-24 14:50:38 字数 898 浏览 2 评论 0原文

我正在尝试获取自己频道的订户的完整列表,但这不起作用。

https://www.googleapis.com/youtube/v3/subscriptions?part=snippet&mine=true&key=[API_KEY]

我正在遵循官方文档 https:// https://developers.google.com/youtube.com/youtube/ V3/DOCS/订阅/列表

但获取此错误

{
  "error": {
    "code": 401,
    "message": "The request uses the \u003ccode\u003emine\u003c/code\u003e parameter but is not properly authorized.",
    "errors": [
      {
        "message": "The request uses the \u003ccode\u003emine\u003c/code\u003e parameter but is not properly authorized.",
        "domain": "youtube.parameter",
        "reason": "authorizationRequired",
        "location": "mine",
        "locationType": "parameter"
      }
    ]
  }
}

I am trying to get the full list of my own channel's subscribers, but this does not work.

https://www.googleapis.com/youtube/v3/subscriptions?part=snippet&mine=true&key=[API_KEY]

I am following the official documentation https://developers.google.com/youtube/v3/docs/subscriptions/list

But get this error

{
  "error": {
    "code": 401,
    "message": "The request uses the \u003ccode\u003emine\u003c/code\u003e parameter but is not properly authorized.",
    "errors": [
      {
        "message": "The request uses the \u003ccode\u003emine\u003c/code\u003e parameter but is not properly authorized.",
        "domain": "youtube.parameter",
        "reason": "authorizationRequired",
        "location": "mine",
        "locationType": "parameter"
      }
    ]
  }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

╰ゝ天使的微笑 2025-01-31 14:50:38

当前,您仅使用一个API密钥,该密钥只​​能使您访问公共数据,使用我的是私人用户数据,需要授权。

这可以在文档页面中看到
subscriptions:list state

​必须使用OAuth2授权您访问此通道的订阅。然后,您将拥有一个访问令牌,您可以作为授权标题载体令牌发送。

GET https://youtube.googleapis.com/youtube/v3/subscriptions?part=snippet&mine=true&key=[YOUR_API_KEY] HTTP/1.1

Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json

Currently you are only using an api key which will only give you access to public data, using mine is private user data and will require authorization.

This can be seen in the documentation page for
Subscriptions: list States

enter image description here

This means that you must be authorized using Oauth2 to access the subscriptions for this channel. You will then have an access token that you can send as an authorization header bearer token.

GET https://youtube.googleapis.com/youtube/v3/subscriptions?part=snippet&mine=true&key=[YOUR_API_KEY] HTTP/1.1

Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文