Download a large file from Google Drive (curl/wget fails because of the security notice).
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gdown Use six.moves.urllib_parse for compatibility Oct 23, 2018
tests Add parse_url Oct 23, 2018
.gitignore Update .gitignore May 21, 2017
.travis.yml 3.7 is not yet available and we should use 3.7-dev Oct 23, 2018
LICENSE Add LICENSE Mar 25, 2018
README.md Update README.md Oct 23, 2018
setup.cfg Add parse_url Oct 23, 2018
setup.py 3.6.0 Oct 23, 2018

README.md

gdown

PyPi Version Travis Status

Download a large file from Google Drive.
If you use curl/wget, it fails with a large file because of the security warning from Google Drive.

Installation

pip install gdown

Usage

From Command Line

$ # gdown [-h] [-V] [-O OUTPUT] [-q] [--id] url_or_id

$ # a large file (~400MB)
$ gdown https://drive.google.com/uc?id=0B_NiLAzvehC9R2stRmQyM3ZiVjQ
$ # gdown --id 0B_NiLAzvehC9R2stRmQyM3ZiVjQ
$ md5sum pose_estimation_2d_chainermodel.pkl
587933c2c0adf335ebed0486c183541f

$ # a small file
$ gdown https://drive.google.com/uc?id=0B9P1L--7Wd2vU3VUVlFnbTgtS2c
$ cat spam.txt
spam

$ # as an alternative to curl/wget
$ gdown https://httpbin.org/ip -O ip.json
$ cat ip.json
{
  "origin": "126.169.213.247"
}

$ # write stdout and pipe to extract
$ gdown https://drive.google.com/uc?id=0B9P1L--7Wd2vNm9zMTJWOGxobkU -O - --quiet | tar zxvf -
$ ls 20150428_collected_images/

$ # it can handle urls created from [Share] -> [Copy Url] on Google Drive
$ gdown 'https://drive.google.com/a/jsk.imi.i.u-tokyo.ac.jp/uc?id=0B_NiLAzvehC9R2stRmQyM3ZiVjQ'

From Python

import gdown

url = 'https://drive.google.com/uc?id=0B9P1L--7Wd2vU3VUVlFnbTgtS2c'
output = 'spam.txt'
gdown.download(url, output, quiet=False)

License

See LICENSE.