Skip to content

Instantly share code, notes, and snippets.

@hsfzxjy
Created May 15, 2019 15:36
Show Gist options
  • Save hsfzxjy/d706efadd769a313bc60e9a6498f1aad to your computer and use it in GitHub Desktop.
Save hsfzxjy/d706efadd769a313bc60e9a6498f1aad to your computer and use it in GitHub Desktop.
Download large file from google-drive using terminal only.
# Usage: gdl <URL> <OUTPUT>
function gdl() {
URL=$1
tmp_file=$(mktemp)
code=$(wget --save-cookies $tmp_file --keep-session-cookies --no-check-certificate $URL -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1/p')
echo $code
URL+="&confirm=$code"
wget --load-cookies $tmp_file $URL -O $2
rm $tmp_file
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment