我尝试将一些视频上传到 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 可以解决问题。
一个更好的错误消息会很有帮助,但是...
- 1 回答
- 0 关注
- 1496 浏览
添加回答
举报
0/150
提交
取消
