简体   繁体   English

如何使用 linux 中的链接下载谷歌驱动器文件夹

[英]How to download a google drive folder using link in linux

I have a shared google drive folder link(Anyone on the internet with this link can view) as below Ex: https://drive.google.com/drive/folders/1i_c8LhSLf-LttV-UOMDcY4rLAalxxxx?usp=sharing我有一个共享的谷歌驱动器文件夹链接(互联网上任何人都可以通过此链接查看)如下示例: https://drive.google.com/drive/folders/1i_c8LhSLf-LttV-UOMDcY4rLAalxxxx?usp=sharing

I want to download using any of the wget/CURL/any python packages.我想使用任何 wget/CURL/any python 包下载。

I have tried the below and it doesn't work.我已经尝试了以下方法,但它不起作用。

 curl -L "https://drive.google.com/uc?id=1i_c8LhSLf-LttV-UOMDcY4rLAalkcayn&export=download" > test.tar.gz
import gdown
import time
url='https://drive.google.com/uc?id=1i_c8LhSLf-LttV-UOMDcY4rLAalkxxxx'
output='/data/test/test.zip'
time.sleep(100)
gdown.download(url, output, quiet=False)

Error:错误:

Permission denied: https://drive.google.com/uc?id=1i_c8LhSLf-LttV-UOMDcY4rLAalkcayn
Maybe you need to change permission over 'Anyone with the link'?

The below command worked for files but not for folders以下命令适用于文件但不适用于文件夹

wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=11e85AnMEGEjrxPuewlmeg-ABOZ8asdf' -O test

Thanks for your help in advance!提前感谢您的帮助!

Using "gdown"使用“gdown”

gdown is a great application to download single file from gdrive with only file id or link required, but there were several great minds of github who were inspired to implement a folder download functionality. gdown是一个很棒的应用程序,可以从 gdrive 下载单个文件,只需要文件 id 或链接,但是github 的一些伟大思想受到启发,实现了文件夹下载功能。

Actually, state of this feature can be viewed in gdown:90 github PR .实际上,此功能的 state 可以在gdown:90 github PR中查看。

You can use it, since it is implemented almost perfectly (there is an issue of only 50 files in folder as maximum to download):您可以使用它,因为它实现得几乎完美(存在一个问题,即文件夹中最多只有 50 个文件可供下载):

  1. install gdown with developed folder_download feature via pip:通过 pip 安装带有开发folder_download功能的 gdown:
pip install git+https://github.com/giuliano-oliveira/gdown_folder.git
  1. Now we need to run gdown.download_folder function in python3 shell (since cli support for folder download is not implemented):现在我们需要在 python3 shell 中运行gdown.download_folder function (因为没有实现对文件夹下载的 cli 支持):

$ python3

import gdown
gdown.download_folder(gdrive_folder_link, quiet=True)

Use your own gdrive_folder_link in format https://drive.google.com/drive/u/1/folders/{id} (others weren't checked).使用您自己的gdrive_folder_link格式https://drive.google.com/drive/u/1/folders/{id} (其他未检查)。

Note:笔记:

  • You might be required to signup to gdown application.您可能需要注册 gdown 应用程序。
  • Also, remember about maximum downloaded elements from folder is 50, since there is internal problems with acquiring relevant information about all items via gdrive request API.另外,请记住从文件夹中下载的最大元素是 50,因为通过 gdrive 请求 API 获取有关所有项目的相关信息存在内部问题。
  • You might be required to create the target folder name您可能需要创建目标文件夹名称

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python:从谷歌驱动器中查找并下载丢失的文件(使用共享链接) - Python: find and download missing files from google drive (using a sharable link) 如何使用 python 脚本在谷歌驱动器中创建和显示文件夹? - How to create and show a folder in google drive using python script? 如何获取Google Drive下载的内容长度? - How to get content length for google drive download ? Python-如何使用 Google Drive API 将文件上传到一个文件夹? - Python- How to upload files to one folder using Google Drive API? 如何在单个请求中使用 Python 在 Google Drive 中上传文件夹(不是文件)? - How do I upload a folder (not files) in Google Drive using Python at a single request? 如何在 Python 中使用 Google API v3 使驱动器文件夹“对网络公开”? - How to make drive folder "public to the web" using Google API v3 in Python? 如何使用空闲的 python 将requirements.txt 中提到的所有 python 包下载到 linux 的文件夹中? - how to download all the python packages mentioned in the requirement.txt to a folder in linux using python idle? 使用 Python 3.10 从 Google 云端硬盘下载文件 - Download file from Google Drive using Python 3.10 Python - 无法使用 Google Drive API 从 Google Drive 下载文件 - Python - Can not download file from Google Drive using Google Drive API 下载文件谷歌驱动器 python - Download file google drive python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM