## 获取 gdown.pl 脚本

• wget
• perl

 1 2 wget https://raw.githubusercontent.com/circulosmeos/gdown.pl/master/gdown.pl chmod +x gdown.pl

 1 #!/usr/local/bin/perl

 1 perl: /usr/bin/perl /etc/perl /usr/share/perl /usr/share/man/man1/perl.1.gz

gdown.pl文件的第一行，我修改为：

 1 #!/usr/bin/perl

## 如何使用 gdown.pl 脚本下载

 1 ./gdown.pl 'Gdrive 文件地址' ['保存的文件名']

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 #!/usr/local/bin/perl # # Google Drive direct download of big files # ./gdown.pl 'gdrive file url' ['desired file name'] # # v1.0 by circulosmeos 04-2014. # v1.1 by circulosmeos 01-2017. # http://circulosmeos.wordpress.com/2014/04/12/google-drive-direct-download-of-big-files # Distributed under GPL 3 (http://www.gnu.org/licenses/gpl-3.0.html) # use strict; my $TEMP='gdown.cookie.temp'; my$COMMAND; my $confirm; my$check; sub execute_command(); my $URL=shift; die "\n./gdown.pl 'gdrive file url' [desired file name]\n\n" if$URL eq ''; my $FILENAME=shift;$FILENAME='gdown' if $FILENAME eq ''; if ($URL=~m#^https?://drive.google.com/file/d/([^/]+)#) { $URL="https://docs.google.com/uc?id=$1&export=download"; } execute_command(); while (-s $FILENAME < 100000) { # only if the file isn't the download yet open fFILENAME, '<',$FILENAME; $check=0; foreach () { if (/href="(\/uc\?export=download[^"]+)/) {$URL='https://docs.google.com'.$1;$URL=~s/&/&/g; $confirm='';$check=1; last; } if (/confirm=([^;&]+)/) { $confirm=$1; $check=1; last; } if (/"downloadUrl":"([^"]+)/) {$URL=$1;$URL=~s/\\u003d/=/g; $URL=~s/\\u0026/&/g;$confirm=''; $check=1; last; } } close fFILENAME; die "Couldn't download the file :-(\n" if ($check==0); $URL=~s/confirm=([^;&]+)/confirm=$confirm/ if $confirm ne ''; execute_command(); } unlink$TEMP; sub execute_command() { $COMMAND="wget --no-check-certificate --load-cookie$TEMP --save-cookie $TEMP \"$URL\""; $COMMAND.=" -O \"$FILENAME\"" if $FILENAME ne ''; $COMMAND; return 1; }