将Google Drive文件下载到Ubuntu终端

时间:2018-05-19 23:50:37

标签: unix curl wget

我正在尝试通过wget:

下载以下链接中的文件

Google landmark competitions files

我已经尝试了以下答案中提出的解决方案,但一直无法使其发挥作用。

  1. wget/curl large file from google drive
  2. Downloading zip folder/file from google drive from shared with me folder
  3. wget/curl large file from google drive
  4. Using Wget on a google drive file
  5. Download file from Google Drive via HTTP GET request
  6. wget not working for shared files in Google drive
  7. 它继续下载一个大小从0K到3.1K的文件,具体取决于答案,但不是.zip文件。

    我做错了什么?

1 个答案:

答案 0 :(得分:1)

您可以简单地使用它通过wget

从Google驱动器下载文件
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

因此,您要查找的两个文件可以按以下方式下载:

>> wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1J5QX6PflSnmXr428i7rWi0dAz80SOzqN' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1J5QX6PflSnmXr428i7rWi0dAz80SOzqN" -O test.zip && rm -rf /tmp/cookies.txt
>> wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1rO1xQzMUNxNobKNDdofgW5VihQkeW3j2' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1rO1xQzMUNxNobKNDdofgW5VihQkeW3j2" -O train.zip && rm -rf /tmp/cookies.txt