Retour au classement

wkentaro/gdown

Python

Google Drive public file downloader when curl/wget fails.

google-drivewgetcurldownloaddownloaderpython
Croissance des étoiles
Étoiles
5.3k
Forks
422
Croissance hebdomadaire
Issues
2
2k4k
oct. 2015mai 2019déc. 2022juil. 2026
ArtefactsPyPIpip install gdown
README

gdown

PyPI Python Build License

Google Drive public file/folder downloader when curl/wget fails.

Why?

Downloading public files from Google Drive with curl or wget doesn't work — Google serves a confirmation page for large files, and the URL formats are a mess.

gdown gets around that:

  • Skips the virus-scan confirmation page so large downloads actually finish
  • Downloads folders recursively
  • Exports Google Docs/Sheets/Slides as PDF, DOCX, CSV, etc.
  • Resumes partial downloads with --continue
  • Also works with plain HTTP/HTTPS URLs as a curl/wget replacement

Install

Requires Python 3.10 or later.

pip install gdown

Or with uv:

uv tool install gdown

Quick start

# Just paste a Google Drive URL
gdown https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ

# Or copy-paste a share link directly
gdown 'https://drive.google.com/file/d/0B9P1L--7Wd2vU3VUVlFnbTgtS2c/view?usp=sharing'

Usage

CLI

Files

# Download by URL
gdown https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ

# Download by file ID
gdown 1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ

# Download from a share link
gdown 'https://drive.google.com/file/d/0B9P1L--7Wd2vU3VUVlFnbTgtS2c/view?usp=sharing'

# Save to a specific path
gdown https://drive.google.com/uc?id=0B9P1L--7Wd2vU3VUVlFnbTgtS2c -O /tmp/spam.txt

# Resolve the filename (with its real extension) without downloading
gdown https://drive.google.com/uc?id=0B9P1L--7Wd2vU3VUVlFnbTgtS2c --json

--json is in beta and its output format may change in a future release; pass --quiet to silence the beta warning in scripts. The output is an array of {url, path} entries, where path is the filename Google Drive reports. This lets you choose a name while keeping the original extension:

url="https://drive.google.com/uc?id=0B9P1L--7Wd2vU3VUVlFnbTgtS2c"
filename=$(gdown "$url" --json | jq -r '.[0].path')
gdown "$url" -O "my_name.${filename##*.}"

Folders

# Download an entire folder
gdown https://drive.google.com/drive/folders/15uNXeRBIhVvZJIhL4yTw4IsStMhUaaxl -O /tmp/folder --folder

# List folder contents as a JSON array (each entry has url and path)
gdown https://drive.google.com/drive/folders/15uNXeRBIhVvZJIhL4yTw4IsStMhUaaxl --folder --json

# Filter by path and download matches
gdown https://drive.google.com/drive/folders/15uNXeRBIhVvZJIhL4yTw4IsStMhUaaxl --folder --json \
  | jq -r '.[] | select(.path | test("shad")) | .url' \
  | xargs -n1 gdown

Google Docs, Sheets, Slides

# Download a Google Slides file (default: pptx)
gdown "https://docs.google.com/presentation/d/15umvZKlsJ3094HNg5S4vJsIhxcFlyTeK/edit?usp=sharing"

# Export as PDF instead
gdown "https://docs.google.com/presentation/d/15umvZKlsJ3094HNg5S4vJsIhxcFlyTeK/edit" --format pdf

Default export formats: Docs → docx, Sheets → xlsx, Slides → pptx.

Resume, speed limit, proxy

# Resume a partially downloaded file
gdown https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ --continue

# Limit download speed
gdown https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ --speed 10MB

# Download via proxy
gdown https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ --proxy http://proxy:8080

Other options

# Skip TLS certificate verification
gdown https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ --no-check-certificate

# Don't use cookies from ~/.cache/gdown/cookies.txt
gdown https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ --no-cookies

# Use a custom User-Agent
gdown https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ --user-agent "MyApp/1.0"

Pipe to stdout

gdown https://github.com/wkentaro/gdown/archive/refs/tags/v4.0.0.tar.gz -O - --quiet | tar zxvf -

Any URL

gdown also works with regular URLs, not just Google Drive:

gdown https://httpbin.org/ip -O ip.json

[!NOTE] For Google Drive URLs, gdown automatically extracts the file ID and downloads the actual file. Use curl or wget to download the raw HTML page instead.

Python

import gdown

# Download a file
url = "https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ"
gdown.download(url=url, output="fcn8s_from_caffe.npz")

# Download by file ID
gdown.download(id="0B9P1L--7Wd2vNm9zMTJWOGxobkU", output="output.npz")

# Download from a share link
url = "https://drive.google.com/file/d/0B9P1L--7Wd2vNm9zMTJWOGxobkU/view?usp=sharing"
gdown.download(url=url, output="output.npz")

# Download with hash verification and caching
gdown.cached_download(
    url=url,
    path="output.npz",
    hash="md5:fa837a88f0c40c513d975104edf3da17",
    postprocess=gdown.extractall,
)

# Track download progress
def on_progress(bytes_so_far: int, bytes_total: int | None) -> None:
    if bytes_total is not None:
        print(f"\r{bytes_so_far / bytes_total * 100:.1f}%", end="")

gdown.download(url=url, output="output.npz", quiet=True, progress=on_progress)

# Download a folder
url = "https://drive.google.com/drive/folders/15uNXeRBIhVvZJIhL4yTw4IsStMhUaaxl"
gdown.download_folder(url=url)

# Download a folder by ID
gdown.download_folder(id="15uNXeRBIhVvZJIhL4yTw4IsStMhUaaxl")

FAQ

"Permission Denied" error

Make sure the file sharing is set to "Anyone with the link".

Google throttles downloads when too many people access the same file. If you can still open the file in your browser, try exporting cookies:

  1. Install a browser extension like Get cookies.txt LOCALLY
  2. Export cookies.txt and move it to ~/.cache/gdown/cookies.txt
  3. Run the download again

Once the file is in place, gdown loads it automatically (no extra flags needed).

Download stops after ~1 hour

Google Drive terminates connections after approximately 1 hour for large files. Use --continue to resume, and retry until the download completes:

gdown --continue https://drive.google.com/uc?id=<file_id>

Can I use gdown for non-Google-Drive URLs?

Yes. It works with any public HTTP/HTTPS URL.

Contributing

git clone https://github.com/wkentaro/gdown.git
cd gdown
make setup   # install dependencies
make test    # run tests
make lint    # run linters

License

MIT (LICENSE)

Dépôts similaires
rclone/rclone

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

GoGo ModulesMIT Licensegolanggo
rclone.org
58.6k5.2k
googleworkspace/cli

Google Workspace CLI — one command-line tool for Drive, Gmail, Calendar, Sheets, Docs, Chat, Admin, and more. Dynamically built from Google Discovery Service. Includes AI agent skills.

Rustcrates.ioApache License 2.0google-workspaceagent-skills
developers.google.com/workspace
29.9k1.7k
benweet/stackedit

In-browser Markdown editor

JavaScriptnpmApache License 2.0markdowneditor
stackedit.io
23k2.8k
astrada/google-drive-ocamlfuse

FUSE filesystem over Google Drive

OCamlMIT Licensegoogle-driveocaml
astrada.github.io/google-drive-ocamlfuse/
6k369
iterate-ch/cyberduck

Cyberduck is a libre FTP, SFTP, WebDAV, Amazon S3, Backblaze B2, Microsoft Azure & OneDrive and OpenStack Swift file transfer client for Mac and Windows.

JavaMavenGNU General Public License v3.0webdavsftp
cyberduck.io
4.6k359
stewartmcgown/uds

📀 Unlimited Google Drive Storage by splitting binary files into base64

PythonPyPIGNU Affero General Public License v3.0google-driveunlimited
4.4k274
GAM-team/GAM

command line management for Google Workspace

PythonPyPIApache License 2.0googlegsuite
github.com/GAM-team/GAM/wiki
4.2k530
anasty17/mirror-leech-telegram-bot

Official Repository: Telegram bot which can download direct links, torrents, nzb, google drive, telegram document, any file/folder from rclone supported clouds, all yt-dlp supported sites and jdownloader supported sites, then upload them to google drive, telegram cloud or to one of rclone supported clouds

PythonPyPIGNU General Public License v3.0mirrorleech
t.me/mltb_official_channel
4.2k5.1k
sabeechen/hassio-google-drive-backup

Automatically create and sync Home Assistant backups into Google Drive

PythonPyPIMIT Licensehome-assistantgoogle-drive
3.6k212
P3TERX/aria2.conf

Aria2 配置文件 | OneDrive & Google Drvive 离线下载 | 百度网盘转存

ShellMIT Licensearia2aria2-config
p3terx.com/archives/aria2_perfect_config.html
3.4k724
tobychui/arozos

Web Desktop Operating System for low power platforms, Now written in Go!

JavaScriptnpmGNU General Public License v3.0aroz-onlinegolang
os.aroz.org
2.9k215
taylorwilsdon/google_workspace_mcp

Control Gmail, Google Calendar, Docs, Sheets, Slides, Chat, Forms, Tasks, Search & Drive with AI - Comprehensive Google Workspace / G Suite MCP Server & CLI Tool

PythonPyPIMIT Licenseaigmail
workspacemcp.com
2.9k889