Created
December 6, 2018 15:48
-
-
Save bkj/986534373b2f041fa506ef5655027fcc to your computer and use it in GitHub Desktop.
script to download large file from google drive programatically
This file contains hidden or 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
#!/bin/bash | |
# download_google_drive.sh | |
function download_google_drive { | |
SRC=$1 | |
DST=$2 | |
echo "$SRC -> $DST" | |
curl -c /tmp/cookies "https://drive.google.com/uc?export=download&id=$SRC" > /tmp/intermezzo.html | |
DL_LINK=$(cat /tmp/intermezzo.html |\ | |
grep -Po 'uc-download-link" [^>]* href="\K[^"]*' |\ | |
sed 's/\&/\&/g' | |
) | |
curl -L -b /tmp/cookies https://drive.google.com$DL_LINK > $DST | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment