2015 年 12 月 8 日更新根据谷歌支持 https://support.google.com/drive/answer/2881970?hl=en使用
googledrive.com/host/ID
该方法将于 2016 年 8 月 31 日关闭。
我刚刚遇到这个问题。
The trick就是像网络主机一样对待您的 Google Drive 文件夹。
2015年4月1日更新
Google 云端硬盘已发生变化,有一种简单的方法可以直接链接到您的云端硬盘。我在下面留下了以前的答案以供参考,但这里有一个更新的答案。
- 在 Google 云端硬盘中创建一个公共文件夹。
- Share this drive publicly.
- Get your Folder UUID from the address bar when you're in that folder
- 将该 UUID 放入此 URL 中
https://googledrive.com/host/<folder UUID>/
- 将文件名添加到文件所在的位置。
https://googledrive.com/host/<folder UUID>/<file name>
Which is intended functionality by Google https://googledrive.com/host/0B716ywBKT84AMXBENXlnYmJISlE/GoogleDriveHosting.html
new Google Drive Link https://i.stack.imgur.com/ArDpc.png.
您所要做的就是简单地获取host公共共享云端硬盘文件夹的 URL。为此,您可以上传纯 HTML 文件并preview它在 Google 云端硬盘中查找您的主机 URL。
步骤如下:
- 在 Google 云端硬盘中创建一个文件夹。
- Share this drive publicly.
- Upload a simple HTML file. Add any additional files (subfolders ok)
- Open and "preview" the HTML file in Google Drive
- Get the URL address for this folder
- Create a direct link URL from your URL folder base
- 此 URL 应允许直接下载大文件。
[edit]
我忘了补充。如果您使用子文件夹来组织文件,则只需使用您在 URL 层次结构中所期望的文件夹名称即可。
https://googledrive.com/host/<your public folders id string>/images/my-image.png
我想要做什么
我使用 Virtual Box for Vagrant 创建了一个自定义 Debian 映像。我想与同事共享这个“.box”文件,以便他们可以将直接链接放入他们的 Vagrantfile 中。
最后,我需要一个指向实际文件的直接链接。
谷歌云端硬盘问题
如果您将文件权限设置为公开可用,并使用类似以下内容创建/生成直接访问链接gdocs2direct https://sites.google.com/site/gdocs2direct/工具或自己制作链接:
https://docs.google.com/uc?export=download&id=<your file id>
您将得到一个基于 cookie 的验证码,并提示“Google 无法扫描此文件”提示,这不适用于以下情况:wget或 Vagrantfile 配置。
它生成的代码是附加 GET 查询变量的简单代码...&confirm=###
到字符串,但它是每个用户特定的,因此您不能为其他人复制/粘贴该查询变量。
但如果你使用上面的“网页托管”方法,你就可以绕过这个提示。
我希望这有帮助!