Created
January 22, 2020 17:56
-
-
Save maestrow/2f324f1c73cc6313f02eca09c799d1f6 to your computer and use it in GitHub Desktop.
gdrive.sh
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
# Usage: gdrive.sh FILEID local_file_path | |
# Steps to make gdrive link downloadable: | |
# 1. Select a file that is need to be downloaded and do right click. | |
# 2. Click Share. A dialog box will appear. | |
# 3. Click Advance in the right bottom corner. | |
# 4. Click on the Change.. under who has access. | |
# 5. Make it On- Public on the web. | |
# 6. Click Save button. | |
# source: https://medium.com/@acpanjan/download-google-drive-files-using-wget-3c2c025a8b99 | |
key=$(wget --quiet --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') | |
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$key&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