Google Drive Public File/Folder Downloader
Project Links
Meta
Author: Kentaro Wada
Requires Python: >=3.8
Classifiers
Development Status
- 5 - Production/Stable
Environment
- Console
Intended Audience
- Developers
License
- OSI Approved :: MIT License
Operating System
- OS Independent
Programming Language
- Python
- Python :: 3 :: Only
- Python :: 3.8
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
Topic
- Software Development :: Libraries :: Python Modules
gdown
Google Drive Public File Downloader when Curl/Wget Fails


Gdown downloads a public file/folder from Google Drive.
Gdown provides what curl/wget doesn't for Google Drive:
- Skip the security notice allowing you to download large files (curl/wget fails);
- Recursive download of files in a folder (maximum 50 files per folder);
- Specify download file format for Google Slides/Sheet/Docs like PDF/XML/CSV.
Installation
pip install gdown
# to upgrade
pip install --upgrade gdown
Usage
via Command Line
$ gdown --help
usage: gdown [-h] [-V] [-O OUTPUT] [-q] [--fuzzy] [--id] [--proxy PROXY]
[--speed SPEED] [--no-cookies] [--no-check-certificate]
[--continue] [--folder] [--remaining-ok]
url_or_id
...
$ # a large file (~500MB)
$ gdown https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ
$ md5sum fcn8s_from_caffe.npz
256c2a8235c1c65e62e48d3284fbd384
$ # same as the above but with the file ID
$ gdown 1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ
$ # a small file
$ gdown https://drive.google.com/uc?id=0B9P1L--7Wd2vU3VUVlFnbTgtS2c
$ cat spam.txt
spam
$ # download with fuzzy extraction of a file ID
$ gdown --fuzzy 'https://drive.google.com/file/d/0B9P1L--7Wd2vU3VUVlFnbTgtS2c/view?usp=sharing&resourcekey=0-WWs_XOSctfaY_0-sJBKRSQ'
$ cat spam.txt
spam
$ # --fuzzy option also works with Microsoft Powerpoint files
$ gdown --fuzzy "https://docs.google.com/presentation/d/15umvZKlsJ3094HNg5S4vJsIhxcFlyTeK/edit?usp=sharing&ouid=117512221203072002113&rtpof=true&sd=true"
$ # a folder
$ gdown https://drive.google.com/drive/folders/15uNXeRBIhVvZJIhL4yTw4IsStMhUaaxl -O /tmp/folder --folder
$ # 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://github.com/wkentaro/gdown/archive/refs/tags/v4.0.0.tar.gz -O - --quiet | tar zxvf -
$ ls gdown-4.0.0/
gdown github2pypi LICENSE MANIFEST.in pyproject.toml README.md setup.cfg setup.py tests
via Python
import gdown
# a file
url = "https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ"
output = "fcn8s_from_caffe.npz"
gdown.download(url, output)
# same as the above, but with the file ID
id = "0B9P1L--7Wd2vNm9zMTJWOGxobkU"
gdown.download(id=id, output=output)
# same as the above, and you can copy-and-paste a URL from Google Drive with fuzzy=True
url = "https://drive.google.com/file/d/0B9P1L--7Wd2vNm9zMTJWOGxobkU/view?usp=sharing"
gdown.download(url=url, output=output, fuzzy=True)
# Cached download with identity check via MD5 (or SHA1, SHA256, etc).
# Pass postprocess function e.g., extracting compressed file.
md5 = "md5:fa837a88f0c40c513d975104edf3da17"
gdown.cached_download(url, output, hash=hash, postprocess=gdown.extractall)
# a folder
url = "https://drive.google.com/drive/folders/15uNXeRBIhVvZJIhL4yTw4IsStMhUaaxl"
gdown.download_folder(url)
# same as the above, but with the folder ID
id = "15uNXeRBIhVvZJIhL4yTw4IsStMhUaaxl"
gdown.download_folder(id=id)
FAQ
I get a 'Permission Denied' error.
Have you made sure you set the file permission to 'Anyone with Link'?
I set the permission 'Anyone with Link', but I still can't download.
Google restricts access to a file when the download is concentrated.
If you can still access to the file from your browser, downloading cookies file might
help. Follow this step: 1) download cookies.txt using browser extensions like
(Get cookies.txt LOCALLY);
2) mv the cookies.txt
to ~/.cache/gdown/cookies.txt
; 3) run download again.
If you're using gdown>=5.0.0
, it should be able to use the cookies same as your browser.
License
MIT
May 12, 2024
5.2.0
Feb 03, 2024
5.1.0
Jan 26, 2024
5.0.1
Jan 20, 2024
5.0.0
Jan 20, 2024
5.0.0rc1
Jan 16, 2024
4.7.3
Jan 16, 2024
4.7.2
Mar 25, 2023
4.7.1
Mar 25, 2023
4.7.0
Mar 24, 2023
4.6.6
Mar 24, 2023
4.6.5
Feb 21, 2023
4.6.4
Feb 13, 2023
4.6.3
Feb 11, 2023
4.6.2
Feb 11, 2023
4.6.1
Dec 05, 2022
4.6.0
Nov 25, 2022
4.5.4
Oct 18, 2022
4.5.3
Oct 17, 2022
4.5.2
Jun 26, 2022
4.5.1
Jun 25, 2022
4.5.0
Feb 26, 2022
4.4.0
Feb 20, 2022
4.3.1
Feb 17, 2022
4.3.0
Feb 20, 2022
4.2.2
Jan 31, 2022
4.2.1
Oct 20, 2021
4.2.0
Oct 18, 2021
4.1.1
Oct 18, 2021
4.1.0
Oct 06, 2021
4.0.2
Oct 03, 2021
4.0.1
Oct 03, 2021
4.0.0
Oct 03, 2021
3.15.0
Sep 29, 2021
3.14.0
Sep 15, 2021
3.13.1
May 02, 2021
3.13.0
Aug 18, 2020
3.12.2
Aug 17, 2020
3.12.1
Jul 22, 2020
3.12.0
Jun 06, 2020
3.11.1
May 04, 2020
3.11.0
Apr 29, 2020
3.11.0rc1
Apr 16, 2020
3.10.3
Mar 31, 2020
3.10.2
Feb 05, 2020
3.10.1
Jan 19, 2020
3.10.0
Jan 10, 2020
3.9.1
Jan 04, 2020
3.9.0
Sep 01, 2019
3.8.3
Aug 28, 2019
3.8.2
Mar 17, 2019
3.8.1
Mar 17, 2019
3.8.0
Mar 01, 2019
3.7.4
Jan 29, 2019
3.7.3
Jan 16, 2019
3.7.1
Jan 15, 2019
3.7.0
Jan 02, 2019
3.6.4
Jan 02, 2019
3.6.3
Jan 02, 2019
3.6.2
Dec 21, 2018
3.6.1
Oct 23, 2018
3.6.0
Jun 05, 2018
3.5.0
Mar 23, 2018
3.4.6
Feb 21, 2018
3.4.5
Feb 21, 2018
3.4.4
Dec 27, 2017
3.4.3
Dec 27, 2017
3.4.2
Dec 22, 2017
3.4.1
Dec 22, 2017
3.4.0
Aug 07, 2017
3.3.2
Aug 05, 2017
3.3.1
Aug 03, 2017
3.3.0
May 08, 2017
3.2.5
Nov 22, 2016
3.2.4
Nov 15, 2016
3.2.3
Nov 15, 2016
3.2.2
Nov 15, 2016
3.2.1
Nov 15, 2016
3.2.0
Nov 15, 2016
3.1.0
Nov 15, 2016
3.0.0
Nov 15, 2016
2.3.1
Nov 15, 2016
2.3.0
Jun 02, 2016
2.2.0
Jun 02, 2016
2.1.1
Jun 02, 2016
2.1.0
May 31, 2016
2.0.2
May 31, 2016
2.0.1
May 01, 2016
2.0.0
Dec 16, 2015
1.0.2
Oct 17, 2015
1.0.1