Skip to content

Instantly share code, notes, and snippets.

@rebornplusplus
Last active June 2, 2021 04:11
Show Gist options
  • Save rebornplusplus/709d75ba32248e8ba987bb673304181d to your computer and use it in GitHub Desktop.
Save rebornplusplus/709d75ba32248e8ba987bb673304181d to your computer and use it in GitHub Desktop.
Download Google Drive Files using wget
# USAGE: (saves to FILENAME)
# ./wget_gdrive.sh FILEID FILENAME
# https://medium.com/@acpanjan/download-google-drive-files-using-wget-3c2c025a8b99
# Copy the link for sharing: https://drive.google.com/file/d/1UibyVC_C2hoT_XEw15gPEwPW4yFyJFeOEA/view?usp=sharing
# Extract FILEID part: 1UibyVC_C2hoT_XEw15gPEwPW4yFyJFeOEA
# For small (<100MB) files:
# wget --no-check-certificate "https://docs.google.com/uc?export=download&id=$1" -O $2
# For large files:
wget -c --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget -c --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://docs.google.com/uc?export=download&id=$1" -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=$1" -O $2 && rm -rf /tmp/cookies.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment