Skip to content

Instantly share code, notes, and snippets.

@xhdix
Last active August 10, 2018 09:37
Show Gist options
  • Save xhdix/ec10f6429984bc59371f9584663c3437 to your computer and use it in GitHub Desktop.
Save xhdix/ec10f6429984bc59371f9584663c3437 to your computer and use it in GitHub Desktop.
Google Drive/Docs any big file downloader
#!/bin/bash
##orginal: https://gist.github.com/iamtekeste/3cdfd0366ebfd2c0d805#gistcomment-2359248
##alternative: https://jl-workshop.com/Cloud-Storage-Direct-Link-Generator/
##command:
## bash gddl.sh subdomain_name(drive|docs) long_google_drive_file_id filename.ext
CONFIRM=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://$1.google.com/uc?export=download&id=$2" -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')
wget --load-cookies /tmp/cookies.txt "https://$1.google.com/uc?export=download&confirm=$CONFIRM&id=$2" -O $3
rm -rf /tmp/cookies.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment