YouTube数据API - 从电子邮件中获取频道ID

时间:2015-10-31 12:24:23

标签: youtube-api youtube-data-api

我正在尝试使用Youtube数据API检索Youtube频道ID和名称但我得到的是空项目。我只有Youtube用户电子邮件帐户。是否只能从电子邮件中获取频道详细信息?

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

2 个答案:

答案 0 :(得分:1)

无法从用户电子邮件中获取用户频道ID。 我尝试使用forUsername参数,但这仅适用于某些用户(遗留问题)。 我唯一发现的是使用Google Signin for iOS实现,它允许您使用Google帐户登录。为了获得获取YouTube数据的能力,需要额外的范围配置,如下所示:

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

现在,您可以使用访问令牌运行以下YouTube数据API:

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

访问令牌,您将从user.authentication.accessToken

获取

答案 1 :(得分:0)

目前无法通过关联的电子邮件地址检索YouTube频道。

相关问题