如何从终端从谷歌驱动器下载大文件?(gdown 不起作用)

zey*_*un1 7 terminal ubuntu curl wget google-drive-api

这是这个问题的延伸。不幸的是,我厌倦的那个帖子上的所有解决方案现在都不起作用,因为我没有足够的声誉来评论那个帖子,所以我只能就此发表一个新帖子。

问题是如何仅使用终端下载大文件。一个大文件的例子是这样的

我认为最新的解决方案是使用gdown。由于上面文件的 id 是 1Vq_UO-T9345uYs8a7zloukGfhDXSDd2A,我尝试了:

gdown --id 1Vq_UO-T9345uYs8a7zloukGfhDXSDd2A

我收到错误消息:

        Too many users have viewed or downloaded this file recently. Please
        try accessing the file again later. If the file you are trying to
        access is particularly large or is shared with many people, it may
        take up to 24 hours to be able to view or download the file. If you
        still can't access a file after 24 hours, contact your domain
        administrator. 
Run Code Online (Sandbox Code Playgroud)

此 github讨论页面上建议的最新解决方案还表明,在下载大于 50gb 的大文件时会收到相同的错误

小智 24

您可以尝试生成 OAuth 令牌

  • 转到 OAuth 2.0 Playground https://developers.google.com/oauthplayground/
  • Select the Scope盒子里粘贴https://www.googleapis.com/auth/drive.readonly
  • 单击Authorize APIs然后Exchange authorization code for tokens
  • 复制访问令牌
  • 在终端中运行
curl -H "Authorization: Bearer ACCESS_TOKEN" https://www.googleapis.com/drive/v3/files/FILE_ID?alt=media -o FILE_NAME 
Run Code Online (Sandbox Code Playgroud)

  • 2022 年 12 月开始运行! (2认同)