Skip to content

Instantly share code, notes, and snippets.

@harish2704
Created April 13, 2020 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harish2704/bfb8abece94893c53ce344548ead8ba5 to your computer and use it in GitHub Desktop.
Save harish2704/bfb8abece94893c53ce344548ead8ba5 to your computer and use it in GitHub Desktop.
Download publicly accessible files from google drive using curl
#!/usr/bin/env bash
urlBase='https://drive.google.com'
fCookie=tmpcookies
curl="curl -L -b $fCookie -c $fCookie"
confirm(){
$curl "$1" | grep jfk-button-action | sed -e 's/.*jfk-button-action" href="\(\S*\)".*/\1/' -e 's/\&/\&/g'
}
$curl -O -J "${urlBase}$(confirm $1)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment