建立 YouTube 頻道
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本文將說明產生 Android WebView
、iOS UIWebView
或類似物件的程序,讓使用者建立 YouTube 頻道,然後將控制權交還給應用程式。應用程式應實作這個流程,以便在使用者嘗試完成需要 YouTube 頻道的操作時,處理發生的 API 錯誤。
注意:如開發人員指南所述,如果使用者擁有 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 頻道,才能完成要求的操作。
其他資源
下列資源或許可協助您在應用程式中實作此流程:
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間: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"]],["上次更新時間: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"]]