如何区分 Youtube-Google 链接帐户与未与 Youtube API 链接的帐户。通过发送此请求成功检索有关当前登录用户的信息后:
https://gdata.youtube.com/feeds/api/users/default?v=2?access_token=YSECURITY_TOKEN&alt=json
我得到包含用户信息的 JSON 结构。但没有任何属性表明该用户是否已链接或取消链接谷歌帐户。通过搜索 Youtube API 文档和谷歌搜索,我找不到直接答案,只能找到如何进入此页面,您可以在其中检查您的帐户是否已链接:
http://support.google.com/youtube/bin/answer.py?hl=en&answer=69964
我正在使用 javascript 和 jQuery。
最佳答案
看来我找到了。描述 API 版本 2.0 和 2.1 之间差异的 Youtube API 文档部分说道:
In version 2.1, a YouTube user profile entry for a user with an unlinked Google Account will contain a
<yt:incomplete>
tag. This tag is useful if you prefer to modify your application so that it does not display unsupported features (or provides a different display for those features) to users with unlinked Google Accounts.In addition, in version 2.1, a profile entry for a user with an unlinked Google Account only contains a few of the tags that can be included in a profile entry for a user with a YouTube account. The
<entry>
tag definition lists the tags that may appear within a profile entry for both YouTube accounts and unlinked Google Accounts.
这样我就可以搜索是否存在不完整的标签。
关于javascript - 区分 Youtube-Google 关联帐户与未关联帐户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11063536/