为了账号安全,请及时绑定邮箱和手机立即绑定

http.Client 拒绝使用 >unsupported protocol scheme ""<

http.Client 拒绝使用 >unsupported protocol scheme ""<

Go
侃侃尔雅 2022-01-17 10:16:26
我尝试将一些视频上传到 youtube。在堆栈中的某个地方归结为http.Client. 这部分在某种程度上表现得很奇怪。请求和所有内容都是在 youtube 包中创建的。最后完成我的请求后,它失败了:Error uploading video: Post https://www.googleapis.com/upload/youtube/v3/videos?alt=json&part=snippet%2Cstatus&uploadType=multipart: Post : unsupported protocol scheme ""我稍微调试了库并打印了URL.Scheme内容。作为一个字符串,结果是https并且在[]byte [104 116 116 112 115]https://golang.org/src/net/http/transport.go第 288 行是抛出错误的位置。https://godoc.org/google.golang.org/api/youtube/v3我使用的库我准备/上传视频的代码://create video struct which holds info about the videovideo := &yt3.Video{//TODO: set all required video info}//create the insert callinsertCall := service.Videos.Insert("snippet,status", video)//attach media data to the callinsertCall = insertCall.Media(tmp, googleapi.ChunkSize(1*1024*1024)) //1MB chunkvideo, err = insertCall.Do()if err != nil {    log.Printf("Error uploading video: %v", err)    return    //return errgo.Notef(err, "Failed to upload to youtube")}所以我不知道为什么模式检查失败。
查看完整描述

1 回答

?
慕运维8079593

TA贡献1876条经验 获得超5个赞

好的,我想通了。问题不在于对 YouTube 本身的调用。

库试图在后台刷新令牌,但TokenURL.

确保有一个有效的 URL 可以解决问题。

一个更好的错误消息会很有帮助,但是...


查看完整回答
反对 回复 2022-01-17
  • 1 回答
  • 0 关注
  • 1496 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号