or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

archive-utilities.mdcaching-integrity.mdfile-downloads.mdfolder-operations.mdindex.md
tile.json

tessl/pypi-gdown

Google Drive Public File/Folder Downloader that bypasses security notices and provides recursive folder downloads

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/gdown@5.2.x

To install, run

npx @tessl/cli install tessl/pypi-gdown@5.2.0

index.mddocs/

gdown

A 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.

Package Information

  • Package Name: gdown
  • Language: Python
  • Installation: pip install gdown
  • Requirements: Python 3.8+

Core Imports

import gdown

Common usage patterns:

from gdown import download, cached_download, download_folder, extractall

Basic Usage

import 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...")

Architecture

gdown's design centers around three main functional areas:

  • File Downloads: Core downloading functionality with Google Drive API handling, cookie management, and format conversion
  • Folder Operations: Recursive folder parsing and batch downloading with directory structure preservation
  • Utilities: Archive extraction, caching, and URL parsing helpers

The library automatically handles Google Drive's security redirects, authentication via cookies, and format conversion for Google Workspace documents (Docs/Sheets/Slides).

Capabilities

File Download Operations

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: ...

File Downloads

Cached Downloads and Integrity

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: ...

Caching and Integrity

Folder Operations

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]: ...

Folder Operations

Archive Utilities

Extract compressed archives with support for multiple formats.

def extractall(path, to=None) -> List[str]: ...

Archive Utilities

Package Metadata

__version__: str

The current version of the gdown package, dynamically loaded from package metadata.

import gdown
print(f"gdown version: {gdown.__version__}")

Exception Types

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."""
    pass

Command Line Interface

gdown 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"