Skip to content

Instantly share code, notes, and snippets.

@petermchale
Last active May 2, 2019 21:08
Show Gist options
  • Save petermchale/efb4140dcebf6e2a7b59760fab482b5d to your computer and use it in GitHub Desktop.
Save petermchale/efb4140dcebf6e2a7b59760fab482b5d to your computer and use it in GitHub Desktop.
Download public, large files from Google Drive over HTTP(S), without setup or authentication
#!/bin/bash
# python solution at: https://stackoverflow.com/a/39225039/6674256
# another solution is "rclone", but it requires setup and OAuth
# another solution is Google Drive API, but it requires setup and OAuth too
# another solution is https://github.com/odeke-em/drive, but it requires setup and OAuth too
fileid=$1 # use "Get shareable link" in your Google Drive to access the file ID
filename=$2
curl --cookie-jar ./cookie --location "https://drive.google.com/uc?export=download&id=${fileid}" > /dev/null
curl --location --cookie ./cookie "https://drive.google.com/uc?export=download&confirm=`awk '/download/ {print $NF}' ./cookie`&id=${fileid}" --output ${filename}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment