YouTube Data API - Get Channel ID from Email

早过忘川 提交于 2019-12-11 10:29:18

问题


I'm trying to retrieve Youtube channel ID and name using Youtube data API but I'm getting empty item. I have only the Youtube user email account. Is there away to get the channel details from the email only?

https://www.googleapis.com/youtube/v3/channels?part=snippet&key={YOUR_API_KEY}


回答1:


There is no way to get the user channel ID from user email. I have tried to use forUsername parameter but this works only for some users (legacy issue). The only I have found is to use Google Signin for iOS implementation which allow you yo signin with your google account. In order to have that ability to get YouTube data it require additional scope configuration as follows:

let scope: NSString = "https://www.googleapis.com/auth/youtube.readonly"
let currentScopes: NSArray = GIDSignIn.sharedInstance().scopes
GIDSignIn.sharedInstance().scopes = currentScopes.arrayByAddingObject(scope)

Now, you can run the following YouTube data API with Access Token:

https://www.googleapis.com/youtube/v3/channels?part=id&mine=true&access_token={oauth_token}

The access token, you will get from user.authentication.accessToken




回答2:


There is no way of retrieving YouTube channels via their associated e-mailaddress at this moment.



来源:https://stackoverflow.com/questions/33451543/youtube-data-api-get-channel-id-from-email

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!