Skip to content

Instantly share code, notes, and snippets.

@mmsamiei
Last active July 23, 2020 11:09
Show Gist options
  • Save mmsamiei/c9201775f9b1b866ad3bfba3a7239f2a to your computer and use it in GitHub Desktop.
Save mmsamiei/c9201775f9b1b866ad3bfba3a7239f2a to your computer and use it in GitHub Desktop.
! wget -q "https://drive.google.com/uc?export=download&id=1-3tnHTdDjtMd9O2LgKN2ir3t5KvnqrXI" -O dataset.zip
! unzip dataset.zip
import subprocess
import shlex
file_id = "1xhiGDTihHYUbGES88sYt4S6nLDjKEji1"
file_name = "mscoco.zip"
url_get_cookie = f"https://drive.google.com/uc?export=download&id={file_id}"
! curl -sc /tmp/cookie "{url_get_cookie}" > /dev/null
code = subprocess.run(shlex.split("awk '/_warning_/ {print $NF}' /tmp/cookie"),
stdout=subprocess.PIPE).stdout.decode('utf8').strip()
url_download = f"https://drive.google.com/uc?export=download&confirm={code}&id={file_id}"
! curl -Lb /tmp/cookie "{url_download}" -o {file_name}
! unzip -q mscoco.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment