【发布时间】:2021-08-28 22:48:35
【问题描述】:
我想通过脚本(python、wget、终端等)从 Google-drive 下载整个公用文件夹。
该过程无需身份验证即可完成,因为它是一个公共文件夹,任何拥有链接的人都可以访问。
链接示例:https://drive.google.com/drive/folders/1Gt-W8jMrADizXYGF5QZwJh_Gc8QpKflX
如果无法直接下载整个文件夹,那么只需列出其内容(文件)就足够了,无需身份验证,然后我就可以单独下载每个文件。如何获得这样的listing功能?
注意:
我发现了许多类似的讨论,但都假设文件下载或身份验证,我找不到该特定问题的匹配项,例如:
- Python: How do download entire folder from Google Drive
- download folder from google drive
- Download entire Google Drive folder from the shared link using Google drive API
- How to download specific Google Drive folder using Python?
- Download Shared Google Drive Folder with Python
- Python: download files from google drive using url
- https://unix.stackexchange.com/questions/136371/how-to-download-a-folder-from-google-drive-using-terminal
- https://github.com/vikynandha-zz/google-drive-backup/blob/master/drive.py
【问题讨论】:
-
例如,在您的情况下,这个 CLI 工具有用吗? github.com/tanaikech/goodls 但是,当公用文件夹中的文件时,至少需要使用 API 密钥,因为需要从公用文件夹中检索文件列表。如果这没有用,我很抱歉。
-
您好 Tanaike,这似乎确实相关,我不知道那个 CLI。我试试看,谢谢!
-
感谢您的回复。如果这对您的情况没有用,我深表歉意。而且,如果您不能使用 API 密钥,例如,如何通过手动操作或 Google Apps 脚本从公用文件夹创建文件列表?这样,您可以在没有 API 密钥的情况下下载文件。
-
这是个好主意,感谢 Tanaike。在您的启发下,我还找到了这个 Google Apps 脚本,谢谢 --> gist.github.com/mesgarpour/07317e81e9ee2b3f1699
-
感谢您的回复。如果您的问题已解决,您可以将其发布为答案吗?这样,它对遇到相同问题的其他用户很有用。
标签: download python-requests google-drive-api google-drive-shared-drive