我想检索大视频文件的下载链接。我对小视频文件没有问题,但对于大视频,服务器的响应是文件
“超过Google可以扫描的最大文件大小”
我想使用该链接作为video标记的源。但是因为这个链接给了我错误,所以我不能使用它。
我正在使用Java SDK和File.getWebContentLink()获取链接。我试过getDownloadLink(),但那个甚至不起作用。
基本上,有没有什么办法可以让我得到大视频文件的下载链接?
发布于 2016-06-02 01:09:26
getWebContentLink()是为交互式用户(浏览器)设计的。
取而代之的是,在原始应用程序接口级别,你需要使用带有alt=Media的File.get,并且如果你最初得到的结果是“Google can't scan”,还要设置acknowledgeAbuse标志。阅读有关downloading files here和abuse flag here的更多信息。
在Java客户端库中,它看起来像这样:
String fileId = "0BwwA4oUTeiV1UVNwOHItT0xfa2M";
OutputStream outputStream = new ByteArrayOutputStream();
driveService.files().get(fileId)
.set("acknowledgeAbuse", true)
.executeMediaAndDownloadTo(outputStream);免责声明,我没有编译上面的内容。
注意:不要使用另一个答案中提到的.../host/id方法-该方法是2016年8月底(今年)的deprecated and scheduled to stop serving content
发布于 2016-06-01 22:54:55
尝试使用受http://www.scriptscoop2.com/t/1eb5579419c6/issue-when-trying-to-stream-a-video-from-google-drive-inside-html5-vid.html启发的https://googledrive.com/host/id,其中ID是文件的id。
https://stackoverflow.com/questions/26053011
复制相似问题