Google Drive Public File/Folder Downloader that bypasses security notices and provides recursive folder downloads
npx @tessl/cli install tessl/pypi-gdown@5.2.0A Python library for downloading files and folders from Google Drive that bypasses security notices and download restrictions. Provides both command-line and Python API interfaces with support for recursive folder downloads, format conversion for Google Workspace documents, and intelligent URL parsing.
pip install gdownimport gdownCommon usage patterns:
from gdown import download, cached_download, download_folder, extractallimport gdown
# Download a single file from Google Drive
url = "https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ"
output = "my_file.npz"
gdown.download(url, output)
# Download using file ID directly
file_id = "1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ"
gdown.download(id=file_id, output=output)
# Download with fuzzy URL matching (copy-paste any Google Drive URL)
messy_url = "https://drive.google.com/file/d/1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ/view?usp=sharing"
gdown.download(messy_url, output, fuzzy=True)
# Download entire folder
folder_url = "https://drive.google.com/drive/folders/15uNXeRBIhVvZJIhL4yTw4IsStMhUaaxl"
gdown.download_folder(folder_url, output="./my_folder")
# Cached download with integrity verification
gdown.cached_download(url, output, hash="sha256:abc123...")gdown's design centers around three main functional areas:
The library automatically handles Google Drive's security redirects, authentication via cookies, and format conversion for Google Workspace documents (Docs/Sheets/Slides).
Core file downloading with Google Drive URL parsing, security bypass, format conversion for Google Workspace documents, and progress tracking.
def download(
url=None, output=None, quiet=False, proxy=None, speed=None,
use_cookies=True, verify=True, id=None, fuzzy=False, resume=False,
format=None, user_agent=None, log_messages=None
) -> str: ...Download files with caching, hash verification, and optional post-processing for automation workflows.
def cached_download(
url=None, path=None, md5=None, quiet=False, postprocess=None,
hash=None, **kwargs
) -> str: ...Recursive downloading of Google Drive folders with directory structure preservation and batch file handling.
def download_folder(
url=None, id=None, output=None, quiet=False, proxy=None, speed=None,
use_cookies=True, remaining_ok=False, verify=True, user_agent=None,
skip_download=False, resume=False
) -> Union[List[str], List[GoogleDriveFileToDownload], None]: ...Extract compressed archives with support for multiple formats.
def extractall(path, to=None) -> List[str]: ...__version__: strThe current version of the gdown package, dynamically loaded from package metadata.
import gdown
print(f"gdown version: {gdown.__version__}")class FileURLRetrievalError(Exception):
"""Raised when unable to retrieve file URL from Google Drive."""
pass
class FolderContentsMaximumLimitError(Exception):
"""Raised when folder contains more than 50 files."""
passgdown provides a command-line interface with the same functionality:
# Basic file download
gdown "https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ"
# Download folder
gdown "https://drive.google.com/drive/folders/15uNXeRBIhVvZJIhL4yTw4IsStMhUaaxl" --folder
# Fuzzy URL matching
gdown --fuzzy "https://drive.google.com/file/d/1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ/view?usp=sharing"
# Resume interrupted download
gdown --continue "URL" -O output.zip
# Speed limiting and proxy
gdown --speed 1MB --proxy http://proxy:8080 "URL"