创建 YouTube 频道
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本文档介绍了生成 Android WebView
、iOS UIWebView
或类似对象的过程,以允许用户创建 YouTube 频道,然后将控制权返回给您的应用。您的应用应实现此流程,以处理以下情况所发生的 API 错误:用户使用未关联的 Google 账号尝试执行实际上需要 YouTube 频道的操作。
注意:如开发者指南中所述,如果用户拥有 Google 账号但没有 YouTube 频道,则系统会将其识别为未关联 Google 账号。此类用户可以使用许多需要用户授权的 YouTube 功能,例如创建播放列表或为视频评分。不过,这些用户必须先创建 YouTube 频道,然后才能上传视频到 YouTube。
使用场景
以下步骤介绍了此用例:
-
未关联 Google 账号的用户尝试执行需要 YouTube 频道的操作。您的应用会针对该操作发送已获授权的 API 请求。
-
YouTube 返回 youtubeSignupRequired
错误,表示用户必须注册 YouTube 账号才能完成请求的操作。
-
您的应用启动 WebView
或等效程序,该程序会加载以下网址:
https://m.youtube.com/create_channel?chromeless=1&next=/channel_creation_done
用户可在此页面登录并创建 YouTube 频道。
-
您的应用会监控 WebView
,以确定其位置何时更改为以下网址,这表示用户的 Google 账号已与 YouTube 频道相关联。
https://m.youtube.com/channel_creation_done
-
您的应用会关闭 WebView
,然后重新发送第 1 步中已获授权的 API 请求。
如果用户关闭 WebView
而不完成创建 YouTube 频道的步骤,您的应用将无法重新发送第 1 步中的 API 请求并使其成功。在这种情况下,您的应用可以重申用户需要创建 YouTube 频道才能完成请求的操作。
其他资源
以下资源可能有助于您在应用中实现此流程:
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-05-08。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-05-08。"],[[["Users with Google accounts but without YouTube channels may encounter errors when performing actions requiring a YouTube channel."],["Developers should implement a process to handle the `youtubeSignupRequired` error by directing users to create a channel."],["This process involves launching a WebView or similar object to a specific YouTube URL for channel creation."],["Applications should monitor the WebView for a specific URL indicating channel creation completion before resending the initial API request."],["If the user abandons channel creation, the application should inform them about the requirement to complete the action."]]],["When an unlinked Google Account user attempts an action requiring a YouTube channel, the application receives a `youtubeSignupRequired` error. The application then opens a `WebView` to `https://m.youtube.com/create_channel?chromeless=1&next=/channel_creation_done`, enabling channel creation. Upon the `WebView`'s URL changing to `https://m.youtube.com/channel_creation_done`, the application closes it and resends the original API request. If the user closes the `WebView` without creating a channel, the action fails.\n"]]