Created
August 4, 2018 08:24
-
-
Save afunTW/2b2dedc667e505d7f3a4915a451fcfc1 to your computer and use it in GitHub Desktop.
download the big file on google drive which will pop-up the virus scanner warning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
download_from_gdrive() { | |
file_id=$1 | |
file_name=$2 | |
# first stage to get the warning html | |
curl -c /tmp/cookies \ | |
"https://drive.google.com/uc?export=download&id=$file_id" > \ | |
/tmp/intermezzo.html | |
# second stage to extract the download link from html above | |
download_link=$(cat /tmp/intermezzo.html | \ | |
grep -Po 'uc-download-link" [^>]* href="\K[^"]*' | \ | |
sed 's/\&/\&/g') | |
curl -L -b /tmp/cookies \ | |
"https://drive.google.com$download_link" > $file_name | |
} | |
# download_from_gdrive <FILE_ID> <OUTPUT_FILENAME> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment