如何检查所选帐户是否为YouTube频道 [英] how to check if selected account is YouTube channel

查看:97
本文介绍了如何检查所选帐户是否为YouTube频道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的网络应用中,我必须要求用户获得访问其YouTube频道的权限.

In my web app, I have to ask the users for permission to access their YouTube channels.

身份验证网址是这样的:

The authentication url is something like this:

"

此URL提示用户选择YouTube频道.但是,在频道列表中,也会出现Google/YouTube帐户.此帐户未直接与任何渠道关联.

This URL prompts the user to choose a YouTube channel. But in the channel list, the Google/YouTube account also appears. This account isn't linked with any channels directly.

在我的应用中,用户应该只选择一个频道.我的问题是,如何确定用户是否选择了频道而不选择了Google/YouTube帐户? YouTube API中有什么方法可以帮助我知道吗?

In my app, the users are supposed to select only a channel. My question is, how can I tell if the user selected a channel and not the Google/YouTube account? Is there some method in the YouTube API that can help me know?

我注意到,如果用户选择了一个频道并调用了channel/list方法,则返回的信息与预期的一样,但是如果我选择了相同的方法选择了Google/YouTube帐户,则该频道的标题为空.但是我想知道是否还有其他(更清晰,更干净)的方法来判断用户是否选择了渠道或帐户.

I noticed that if the user has selected a channel and I call the channels/list method then the information it returns is as expected but if I call the same method having selected the Google/YouTube account then the channel title is empty. But I'd like to know if there is some other (nicer and cleaner) way to tell if the user has selected a channel or an account.

谢谢!

推荐答案

youtube.channels.list(mine=true, part='snippet, status, contentDetails')调用的响应中,您可以检查

From the response of youtube.channels.list(mine=true, part='snippet, status, contentDetails') call, you can check status.isLinked and contentDetails.googlePlusUserId to get a hint. If it's not linked, you have a channel, if it's linked, it could be either of them. Then you can follow your title approach etc. There is not a definite filter for this.

如果您详细说明用例,也许我们可以建议一个更好的解决方案.

If you elaborate on your use case, maybe there is a better solution we can suggest.

这篇关于如何检查所选帐户是否为YouTube频道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆