Skip to content

Instantly share code, notes, and snippets.

@tzmartin
Created July 24, 2020 14:41
Show Gist options
  • Save tzmartin/7e0b6a558f8d4659a757e9d20af27fd1 to your computer and use it in GitHub Desktop.
Save tzmartin/7e0b6a558f8d4659a757e9d20af27fd1 to your computer and use it in GitHub Desktop.
Download files from Google Drive using wget in Jupyter or Colab

Programmatically download files from a Google Drive link:

For large file run the following command with necessary changes in FILEID and FILENAME:

!wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment