way1 wget “https://docs.google.com/uc?export=download&id=?" ? 从share link 获得
way2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 set -xgURL=$1 ggID=$(echo "$gURL " | egrep -o '(\w|-){26,}' ) ggURL='https://drive.google.com/uc?export=download' curl -sc /tmp/gcokie "${ggURL} &id=${ggID} " >/dev/null getcode="$(awk '/_warning_/ {print $NF}' /tmp/gcokie) " cmd='curl --insecure -C - -LOJb /tmp/gcokie "${ggURL}&confirm=${getcode}&id=${ggID}"' echo -e "Downloading from " $gURL "...\n" eval $cmd
way3 (推荐) 1 https?://drive.google.com/file/d/id
安装 1 2 wget https://raw.githubusercontent.com/circulosmeos/gdown.pl/master/gdown.pl chmod +x gdown.pl
修改perl地址 而我系统环境使用命令whereis perl显示:
1 perl: /usr/bin/perl /etc/perl /usr/share/perl /usr/share/man/man1/perl.1.gz
则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 71 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 $URL="https://docs.google.com/uc?id=$1&export=download" ; } execute_command(); while (-s $FILENAME < 100000 ) { open fFILENAME, '<' , $FILENAME; $check=0 ; foreach (<fFILENAME>) { 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 ; }
https://onebox.site/archives/250.html