youtube api 401错误youtubeSigupRequired

2024-09-29 19:32:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图使用youtubeapiv3和python将视频上传到Youtube,但我得到了以下错误。在

发生HTTP错误401:

{  "error": {   "errors": [    {
    "domain": "youtube.header",
    "reason": "youtubeSignupRequired",
    "message": "Unauthorized",
    "locationType": "header",
    "location": "Authorization"    }   ],   "code": 401,   "message": "Unauthorized"  } }

我已经创建了我的项目,创建了我的密钥和客户端aouth2.0和google控制台,并下载了客户端_机密.json. 在

我运行的代码是Youtube API示例代码提供的,可以下载(here)for python。在

例如,如果我尝试使用相应的示例代码和我的凭证进行搜索,它工作得很好,我不知道为什么当我想上传一个视频时它不起作用。在

你能告诉我我做错了什么吗?在

提前谢谢


Tags: 代码http客户端示例message视频youtubedomain
1条回答
网友
1楼 · 发布于 2024-09-29 19:32:58

YouTube Data API - Errors

unauthorized (401) youtubeSignupRequired This error indicates that the user has an unlinked Google Account, which means that the user has a Google Account but does not have a YouTube channel. Such users can access many features that are dependent on user authorization, such as rating videos or adding videos to a watch_later playlist. However, as an example, the user would need a YouTube channel to be able to upload a video. A user who has a Gmail account or an Android device is certain to have a Google Account but may not have already linked that Google Account to a YouTube channel.

This error is commonly seen if you try to use the OAuth 2.0 Service Account flow. YouTube does not support Service Accounts, and if you attempt to authenticate using a Service Account, you will get this error.

The YouTube API blog post introducing Google Account support also discusses the youtubeSignupRequired error in more detail. Although the blog post explains the error for API version 2.1, the meaning of the error is still applicable.

相关问题 更多 >

    热门问题