gallery-dl
Download images/videos from various image hosts
TLDR
Download images from the specified URL
Save images to a specific directory
Retrieve pre-existing cookies from your web browser (useful for sites that require login)
Get the direct URL of an image from a site supporting authentication with username and password
Filter manga chapters by chapter number and language
SYNOPSIS
gallery-dl [OPTIONS] URL [URL...]
PARAMETERS
-h, --help
Displays a help message and exits, listing all available options.
-v, --version
Shows the program's version number and exits.
-d, --directory
Specifies the directory where downloaded files will be saved. Defaults to the current working directory.
-f, --format
Sets the output filename format using a template string, allowing for highly customizable file naming based on item metadata.
-u, --username
Provides the username for site authentication on platforms requiring login.
-p, --password
Provides the password for site authentication. For better security, consider using a config file or cookie file instead.
--cookies
Loads cookies from a Netscape-style cookies file for authentication, often preferred over direct username/password.
--range
Downloads only a specific range of items from a gallery, e.g., '1-5' for the first five, '10-' for from the tenth onwards, or '7' for just the seventh item.
--filter
Filters items to download based on a Python-like expression involving item metadata (e.g., 'width > 1280 and height > 720').
--no-mtime
Prevents setting the file's modification time to the original upload date, using the download time instead.
--write-metadata
Writes a JSON file containing all available metadata for each downloaded item alongside the media file.
--config
Specifies an alternative configuration file to use instead of the default locations.
DESCRIPTION
gallery-dl is a powerful and versatile command-line utility for downloading image galleries, albums, and collections from a wide array of websites.
Written in Python, it supports an extensive list of sites, ranging from popular image hosting services and social media platforms to niche art communities. Its primary purpose is to automate the process of saving large quantities of images, GIFs, and sometimes videos, organized as galleries or collections.
Users can specify URLs pointing to individual galleries, user profiles, or even search results, and gallery-dl intelligently identifies and downloads all associated media. It handles common challenges like pagination, dynamically loaded content, and various site structures. Key features include robust site support, flexible file naming conventions, filtering options (e.g., by date, resolution), authentication support for restricted content, and the ability to resume interrupted downloads. This makes gallery-dl an indispensable tool for archiving personal collections, backing up online content, or simply curating images from the web efficiently.
CAVEATS
gallery-dl relies on specific extractors for each website. Frequent website design changes can sometimes break these extractors, requiring users to update gallery-dl regularly for continued compatibility.
Some sites implement strict rate limiting or sophisticated anti-bot measures, which may lead to slower downloads, temporary IP blocks, or require more complex authentication strategies (e.g., manual CAPTCHA solving, which is not directly supported).
Downloading very large collections can consume significant bandwidth and disk space, and users should be mindful of storage capacity.
CONFIGURATION FILES
gallery-dl supports configuration files (typically ~/.config/gallery-dl/config.json or ~/.gallery-dl.conf) where default options, login credentials, and extractor-specific settings can be persistently stored. This avoids the need to type them repeatedly on the command line, greatly enhancing usability for frequent users and automating routine tasks.
EXTRACTOR SYSTEM
The core of gallery-dl's versatility lies in its extensible extractor system. Each supported website has a dedicated module (an extractor) responsible for parsing that site's specific structure and identifying media files. This modular design allows for rapid addition of support for new sites and quick adaptation to changes on existing ones. Advanced users can even write their own custom extractors for unsupported sites.
HISTORY
gallery-dl emerged as a dedicated solution for image gallery downloads, building upon the success and methodology of general-purpose media downloaders like youtube-dl. Its development was driven by the need for a robust, extensible tool specifically tailored to handle the nuances of image galleries from diverse websites, which often differ significantly from video hosting platforms in their structure and presentation.
It is written in Python, allowing for easy extensibility and cross-platform compatibility. The project is actively maintained, with frequent updates to ensure compatibility with ever-changing website layouts and to add support for new sites. Its design emphasizes modularity through extractors, which are specific scripts for each supported website, making it highly adaptable to new content sources.
SEE ALSO
youtube-dl(1), yt-dlp(1), wget(1), curl(1)