本文介绍了YouTube API3.0 视频.插入(上传)--“无法启动可续传上传"例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有基于 Google 的 YouTube 数据 API (v3.0)videos.insert 示例,对于特定用户和授权令牌始终失败,并出现无法启动可恢复上传异常.该代码适用于其他用户/身份验证令牌.

I've got code based on Google's YouTube Data API (v3.0) videos.insert example, which fails consistently for a particular user and authorization token with a Failed to start the resumable upload exception.The code works well for other user/auth tokens.

我可以使用身份验证令牌列出用户的 YouTube 频道资源(表明令牌有效),并与其他用户频道进行比较.显示的唯一区别是特定用户的频道资源不显示 googlePlusUserId.

I can use the auth token to list the users YouTube channel resources (showing that the token is valid), and compare with other users channels. The only difference that shows up is that the channel resources for the particular user doesn't show a googlePlusUserId.

对我遗漏了什么,或者接下来要检查什么有什么想法吗?

Any thoughts as to what I'm missing, or what to check next?

推荐答案

事实证明,用户可以在实际上没有 YouTube 帐户的情况下授予 YouTube 帐户权限;-)

Turns out it's possible for a user to give YouTube account permissions without actually having a YouTube account ;-)

Google_MediaFileUpload::getResumeUri 中,如果未收到有效响应,则抛出 Failed to start the resumable upload 异常,并且响应(包含错误原因)被扔掉.

In Google_MediaFileUpload::getResumeUri, if a valid response isn't received, a Failed to start the resumable upload exception is thrown, and the response (containing the error reason) is thrown away.

在这种情况下,转储响应显示了原因:youtubeSignupRequired.

In this case, dumping the response showed the reason: youtubeSignupRequired.

(对于我的本地代码,我正在保存响应,以便调用者可以报告上传失败的原因)

(For my local code, I'm saving the response so the caller can report why the upload failed)

更新 -- 来自 YouTube 数据 API -错误

此错误表示用户的 Google 帐户未关联,这意味着该用户拥有 Google 帐户但没有 YouTube 频道.此类用户可以访问许多依赖于用户授权的功能,例如对视频进行评级或将视频添加到 watch_later 播放列表.但是,例如,用户需要一个 YouTube 频道才能上传视频.拥有 Gmail 帐户或 Android 设备的用户肯定拥有 Google 帐户,但可能尚未将该 Google 帐户关联到 YouTube 频道.

这篇关于YouTube API3.0 视频.插入(上传)--“无法启动可续传上传"例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 11:38
查看更多