### Install gallery-dl using Snap Source: https://github.com/mikf/gallery-dl/blob/master/README.rst Install gallery-dl on Linux distributions that support Snapd. ```bash snap install gallery-dl ``` -------------------------------- ### Install gallery-dl using Nix Source: https://github.com/mikf/gallery-dl/blob/master/README.rst Installs gallery-dl system-wide using Nix package manager. ```nix environment.systemPackages = with pkgs; [ gallery-dl ]; ``` -------------------------------- ### Install gallery-dl using Scoop Source: https://github.com/mikf/gallery-dl/blob/master/README.rst Install gallery-dl on Windows using the Scoop package manager. ```bash scoop install gallery-dl ``` -------------------------------- ### Subconfigurations Loading Example Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Example of specifying additional configuration files to be loaded by gallery-dl. This allows for modular configuration management. ```python ["~/cfg-twitter.json", "~/cfg-reddit.json"] ``` -------------------------------- ### User-Agent Configuration (Custom Examples) Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Provides examples of custom User-Agent strings, including using 'browser' to detect the system's default browser. ```string "curl/8.14.1" ``` ```string "browser" ``` ```string "+chrome" ``` ```string "@/opt/ChromeBrowser/bin/chrome" ``` -------------------------------- ### Postprocessor Options Example Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Example of postprocessor options that can be added to each individual post processor object before initialization. ```json { "archive": null, "keep-files": true } ``` -------------------------------- ### Install gallery-dl using Homebrew Source: https://github.com/mikf/gallery-dl/blob/master/README.rst Install gallery-dl on macOS or Linux using the Homebrew package manager. ```bash brew install gallery-dl ``` -------------------------------- ### Exec Commands List Example Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst An example demonstrating multiple commands to be run in succession by the 'exec' post processor. Supports format strings for dynamic command arguments. ```json [ ["echo", "{user[account]}", "{id}"] ["magick", "convert" "{_path}", "\fF {_path.rpartition('.')[0]}.png"], "rm {}", ] ``` -------------------------------- ### Exec Postprocessor Configuration Example Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst An example of the configuration for an 'exec' post processor, showing the 'name', 'async', 'command', and 'event' fields. ```json { "name" : "exec", "async" : false, "command": "...", "event" : "after" } ``` -------------------------------- ### Install gallery-dl using pip Source: https://github.com/mikf/gallery-dl/blob/master/README.rst Install the latest stable release of gallery-dl. Use --force-reinstall --no-deps for the latest dev version from master. ```bash python -m pip install -U gallery-dl ``` ```bash python -m pip install -U --force-reinstall --no-deps https://codeberg.org/mikf/gallery-dl/archive/master.tar.gz ``` -------------------------------- ### Input Files Configuration Example Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Example of specifying additional input files for gallery-dl. This list can include paths to text files containing URLs or directories. ```python ["~/urls.txt", "$HOME/input"] ``` -------------------------------- ### Postprocessor Configuration Example Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst An object specifying a post-processor by name and its options. This example shows the 'zip' post-processor with compression, extension, filter, and whitelist settings. ```json { "name": "zip", "compression": "store", "extension": "cbz", "filter": "extension not in ('zip', 'rar')", "whitelist": ["mangadex", "pixiv"] } ``` -------------------------------- ### Install gallery-dl using Chocolatey Source: https://github.com/mikf/gallery-dl/blob/master/README.rst Install gallery-dl on Windows using the Chocolatey package manager. ```powershell choco install gallery-dl ``` -------------------------------- ### Action List Example Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst A list of actions to be performed sequentially. This example demonstrates printing a message and then exiting. ```json ["print Exiting", "exit 1"] ``` -------------------------------- ### Install gallery-dl using MacPorts Source: https://github.com/mikf/gallery-dl/blob/master/README.rst Install gallery-dl on macOS using the MacPorts package manager. ```bash sudo port install gallery-dl ``` -------------------------------- ### Install gallery-dl via System Package Managers Source: https://github.com/mikf/gallery-dl/wiki/Installation Commands to install gallery-dl using common system-level package managers on Linux, macOS, and Windows. ```bash snap install gallery-dl brew install gallery-dl sudo port install gallery-dl ``` ```powershell choco install gallery-dl scoop install gallery-dl ``` -------------------------------- ### Single Action Example Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst A single action to be performed. This example shows raising an exception. ```json "raise AbortExtraction an error occured" ``` -------------------------------- ### Directory Format String List Example Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst A list of format strings used to generate the target directory path. This example shows a simple list and an object-based approach with conditions for conditional directory creation. ```json ["{category}", "{manga}", "c{chapter} - {title}"] ``` ```json { "'nature' in content": ["Nature Pictures"], "retweet_id != 0" : ["{category}", "{user[name]}", "Retweets"], "" : ["{category}", "{user[name]}"] } ``` -------------------------------- ### File Download Index Range Examples Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Examples of how to specify index ranges for selecting which files to download. Supports single indices, ranges, and Python-style slices. ```string "10-20" ``` ```string "-5, 10, 30-50, 100-" ``` ```string "10:21, 30:51:2, :5, 100:" ``` ```string ["-5", "10", "30-50", "100-"] ``` -------------------------------- ### File Filter Examples Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Examples of file filters using Python expressions or a list of conditions to select files for download. ```string "re.search(r'foo(bar)+', description)" ``` ```string ["width >= 1200", "width/height > 1.2"] ``` -------------------------------- ### Signal Actions Configuration Example Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Example of configuring actions to be performed when specific signals are received. This allows custom responses to signals like SIGINT or SIGUSR1. ```json { "SIGINT" : "flag download = stop", "SIGUSR1": [ "print Received SIGUSR1", "exec notify.sh", "exit 127" ] } ``` -------------------------------- ### Skip Download Behavior Examples for gallery-dl Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Illustrates various string configurations for the 'skip' option to control behavior when encountering already downloaded files. These examples demonstrate different levels of skipping and termination. ```string "abort:5" ``` ```string "abort:5:2" ``` ```string "abort:5:manga" ``` ```string "terminate:3" ``` ```string "exit" ``` ```string "exit:N" ``` ```string "enumerate" ``` -------------------------------- ### Gallery-Dl Python Extractor Initialization Example Source: https://github.com/mikf/gallery-dl/wiki/Developing-Extractors Example of initializing a basic extractor class for a fictional website 'imagex.com' in Python. This sets up the category, root URL, and includes a docstring for the extractor. ```python # gallery_dl/extractor/imagex.py from .common import Extractor, Message from .. import text class ImagexExtractor(Extractor): """Base class for imagex extractors""" category = "imagex" root = "https://imagex.com" ``` -------------------------------- ### Install gallery-dl via pip Source: https://github.com/mikf/gallery-dl/wiki/Installation Installs the stable version of gallery-dl from PyPI or the latest development version from GitHub. It also provides a command to ensure essential build dependencies are current. ```bash python3 -m pip install -U gallery-dl python3 -m pip install -U -I --no-deps --no-cache-dir https://github.com/mikf/gallery-dl/archive/master.tar.gz python3 -m pip install --upgrade pip setuptools wheel ``` -------------------------------- ### Action with Print Argument Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst An action that prints a string. This example prints 'Hello World'. ```json "print Hello World" ``` -------------------------------- ### Upgrade pip, setuptools, and wheel Source: https://github.com/mikf/gallery-dl/blob/master/README.rst Ensure you are using the latest versions of essential pip packages for a smooth installation. ```bash python -m pip install --upgrade pip setuptools wheel ``` -------------------------------- ### List Extractors Command Example Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Demonstrates how to use the gallery-dl command-line tool with the -K option to list keywords for directory and filename formatting for a specific URL. ```bash $ gallery-dl -K http://seiga.nicovideo.jp/seiga/im5977527 ``` -------------------------------- ### Format String Examples Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Examples of format strings used for creating dynamic text by embedding metadata. These strings use curly braces for replacement fields. ```string "foo" ``` ```string "{username}" ``` ```string "{title} ({id}).{extension}" ``` ```string "\fF {title.title()} ({num:>0{len(str(count))}} / {count}).{extension}" ``` -------------------------------- ### Signals to Ignore Configuration Example Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Example of a list of signal names that gallery-dl should ignore. This prevents the program from reacting to specified signals. ```python ["SIGTTOU", "SIGTTIN", "SIGTERM"] ``` -------------------------------- ### Filename Format String Example Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst A format string for generating filenames. This example shows a simple string and a more complex object-based approach with conditions to select different format strings based on file properties. ```json "{manga}_c{chapter}_{page:>03}.{extension}" ``` ```json { "extension == 'mp4'": "{id}_video.{extension}", "'nature' in title" : "{id}_{title}.{extension}", "" : "{id}_default.{extension}" } ``` -------------------------------- ### Jinja Policies Configuration Example Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Example of configuring Jinja policies, specifically for urlize and i18n filters. This JSON object defines custom behavior for these filters. ```json { "urlize.rel": "nofollow noopener", "ext.i18n.trimmed": true } ``` -------------------------------- ### Configuring gallery-dl via Python API Source: https://github.com/mikf/gallery-dl/wiki/Developer-Instructions Examples of how to set configuration options when using gallery-dl as a Python module. ```APIDOC ## Configuring gallery-dl via Python API ### Description Set various configuration options for gallery-dl programmatically using the `config.set` method. ### Method Python API ### Endpoint N/A ### Parameters N/A ### Request Example ```python config.set(('extractor',), "archive", '~/.gallery-dl/archive.sql') config.set(('extractor',), "base-directory", '~/downloads') config.set(('extractor', 'deviantart'), "image-range", '1-10') config.set(('extractor', 'deviantart'), "flat", False) config.set(('extractor', 'deviantart'), "metadata", True) config.set( ('extractor',), 'postprocessors', [ { "name": "metadata", "mode": "json", } ] ) ``` ### Response N/A ``` -------------------------------- ### Initiating OAuth Authentication Source: https://github.com/mikf/gallery-dl/blob/master/README.rst Use this command to start the OAuth authentication process for supported sites. gallery-dl will redirect you to the site's authorization page. ```bash gallery-dl oauth:flickr ``` -------------------------------- ### Basic String Formatting Examples Source: https://github.com/mikf/gallery-dl/blob/master/docs/formatting.md Demonstrates the basic syntax for replacement fields in gallery-dl's string formatting. It shows how to select a value and optionally apply conversions and format specifiers. ```Python print('{title}') print('{content!W}') print('{date:Olocal/%Y%m%d %H%M}') ``` -------------------------------- ### Postprocessor with Mode Example Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Specifies a post-processor with a mode. 'ugoira/archive' indicates the ugoira post-processor in 'archive' mode. ```json "name": "ugoira/archive" ``` -------------------------------- ### Configure Postprocessor for Zipping Files Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Example of configuring a 'zip' postprocessor with 'store' compression. This snippet is part of a larger postprocessor configuration. ```json { "name": "zip" , "compression": "store" } ``` -------------------------------- ### Example Date String Formats Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Illustrates various string formats accepted for date values, including ISO 8601 and timestamps. ```string "2019-01-01" ``` ```string "2019-01-01 03:00:00" ``` ```string "2019-03-08T12:30:00Z" ``` -------------------------------- ### Configure Postprocessor for Executing Commands Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Example of configuring an 'exec' postprocessor. This snippet is part of a larger postprocessor configuration. ```json { "name": "exec" } ``` -------------------------------- ### Configure username and password for extractors Source: https://github.com/mikf/gallery-dl/blob/master/README.rst Example JSON configuration for setting username and password for specific extractors like 'subscribestar'. ```json { "extractor": { "subscribestar": { "username": "", "password": "" } } } ``` -------------------------------- ### Use gallery-dl with nix-shell Source: https://github.com/mikf/gallery-dl/blob/master/README.rst This command allows you to use gallery-dl within a temporary shell environment provided by nix-shell without a permanent installation. ```bash nix-shell -p gallery-dl ``` -------------------------------- ### Postprocessor Mode and Event Example Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Specifies a post-processor with a mode and event. 'metadata/jsonl@post' indicates the JSON Lines post-processor running at the 'post' event. ```json "name": "metadata/jsonl@post" ``` -------------------------------- ### Example Date Integer Format Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Shows the integer format for date values, interpreted as a UTC timestamp. ```integer 1546297200 ``` -------------------------------- ### Comment Example in Tag List Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Shows how to include comments within tag blacklist or whitelist files by prefixing lines with '# '. ```text # this is a comment ``` -------------------------------- ### Example Duration List Format Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Represents a duration as a list of two floating-point numbers, defining a start and end time in seconds. ```list [1.5, 3.0] ``` -------------------------------- ### Download Images from Remote Resource (Pastebin) Source: https://github.com/mikf/gallery-dl/wiki/Usage This example shows how to download images listed in a remote text file (like a pastebin raw URL). URLs without a corresponding extractor will be ignored. ```bash gallery-dl "r:https://pastebin.com/raw/FLwrCYsT" ``` -------------------------------- ### Postprocessor with Event Example Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Specifies a post-processor with an event. 'exec@error' indicates the exec post-processor running at the 'error' event. ```json "name": "exec@error" ``` -------------------------------- ### Python command to list available hash algorithms Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Run this Python command to get a list of all available hash algorithms supported by the hashlib module. ```python python -c "import hashlib; print('\n'.join(hashlib.algorithms_available))" ``` -------------------------------- ### Configure recursive extraction for aryion extractor Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Controls the post extraction strategy for the aryion extractor. 'true' starts on main gallery pages and descends into subfolders, 'false' gets posts from 'Latest Updates' pages. ```boolean true ``` ```boolean false ``` -------------------------------- ### Follow URLs with Format String Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Follows URLs found in the format string's result and processes them with child extractors. Example uses '{content}'. ```text "{content}" ``` -------------------------------- ### Chaining and Combining Gallery-dl Format Specifiers Source: https://github.com/mikf/gallery-dl/blob/master/docs/formatting.md Demonstrates chaining multiple special format specifiers before standard ones. This example shows testing for value, performing replacements, and padding. ```text {foo:?//RF/B/Ro/e/> 10} ``` -------------------------------- ### Tag Blacklist/Whitelist Examples Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Demonstrates various formats for defining tag blacklists and whitelists, including file paths, comma-separated strings, and lists of strings. Supports Danbooru blacklist rules. ```text "/path/to/file.txt" ``` ```text "1girl,long_hair, highres,commentary_request" ``` ```text "1girl long_hair, highres -commentary_request" ``` ```text ["1girl", "long_hair", "highres", "commentary_request"] ``` ```text ["1girl long_hair", "highres -commentary_request"] ``` -------------------------------- ### Build and Run gallery-dl with Docker Source: https://github.com/mikf/gallery-dl/wiki/Installation Instructions for building the gallery-dl Docker image from source or pulling pre-built images from registries. Includes a command to run the container with volume mounts for persistence. ```bash git clone https://github.com/mikf/gallery-dl.git cd gallery-dl/ docker build -t gallery-dl:latest . docker pull mikf123/gallery-dl docker tag mikf123/gallery-dl gallery-dl docker pull ghcr.io/mikf/gallery-dl docker tag ghcr.io/mikf/gallery-dl gallery-dl docker run --rm -v $HOME/Downloads/:/gallery-dl/ -v $HOME/.config/gallery-dl/gallery-dl.conf:/etc/gallery-dl.conf -it gallery-dl:latest ``` -------------------------------- ### Configure Advanced Extraction Settings Source: https://github.com/mikf/gallery-dl/wiki/Developer-Instructions Provides examples of setting complex configuration options, such as archive paths, image ranges, and post-processor settings, using the gallery-dl configuration API. ```python config.set(('extractor',), "archive", '~/.gallery-dl/archive.sql') config.set(('extractor',), "base-directory", '~/downloads') config.set(('extractor', 'deviantart'), "image-range", '1-10') config.set(('extractor', 'deviantart'), "flat", False) config.set(('extractor', 'deviantart'), "metadata", True) config.set( ('extractor',), 'postprocessors', [ { "name": "metadata", "mode": "json", } ] ) ``` -------------------------------- ### Field Name Examples for String Formatting Source: https://github.com/mikf/gallery-dl/blob/master/docs/formatting.md Illustrates various ways to select values using field names in gallery-dl's string formatting. This includes simple names, element indexing, slicing, attribute access, and element access. ```Python print('{title}') # Simple name print('{title[6]}') # Element index print('{title[3:8]}') # Slicing print('{title_ja[b3:18]}') # Slicing (Bytes) print('{empty|title}') # Alternatives print('{extractor.url}') # Attribute Access print('{user[name]}') # Element Access print('{user["name"]}') # Element Access with quotes print('{title[24]|empty|extractor.url[15:-1]}') # Combined example ``` -------------------------------- ### Specify Extractor Modules to Load Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Define a list of internal modules to load for extractors. This can reduce startup time and memory usage. Example includes 'reddit', 'danbooru', and 'mangadex'. ```json ["reddit", "danbooru", "mangadex"] ``` -------------------------------- ### Custom Output Formatting with ANSI Colors Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Define custom output format strings for different stages of the download process, including ANSI escape codes for color. This example replicates the 'color' mode. ```json { "start" : "{}", "success": "\r\u001b[1;32m{}\n", "skip" : "\u001b[2m{}\n", "progress" : "\r{0:>7}B {1:>7}B/s ", "progress-total": "\r{3:>3}% {0:>7}B {1:>7}B/s " } ``` -------------------------------- ### Initialize Logging for gallery-dl Source: https://github.com/mikf/gallery-dl/wiki/Developer-Instructions Shows how to configure logging handlers and output formats when using gallery-dl as an imported library. This is useful for debugging or capturing download events in custom applications. ```python import logging from gallery_dl import output output.initialize_logging(logging.INFO) output.configure_logging(logging.INFO) output.setup_logging_handler("unsupportedfile", fmt="{message}") ``` -------------------------------- ### Python Condition Examples Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Examples of Python conditions used for evaluating boolean expressions. These can be simple boolean checks or more complex logical combinations. ```python "not is_watching" ``` ```python "locals().get('optional')" ``` ```python "date >= datetime(2025, 7, 1) or abort()" ``` ```python ["width > 800", "0.9 < width/height < 1.1"] ``` -------------------------------- ### Python Expression Examples Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Examples of Python expressions used for dynamic values. These can include arithmetic operations, string concatenations, and conditional logic. ```python "1 + 2 + 3" ``` ```python "str(id) + '_' + title" ``` ```python "' - '.join(tags[:3]) if tags else 'no tags'" ``` -------------------------------- ### Configure gallery-dl with Home Manager Source: https://github.com/mikf/gallery-dl/blob/master/README.rst Declaratively enables and configures gallery-dl using Home Manager, setting a base directory for downloads. ```nix programs.gallery-dl = { enable = true; settings = { extractor.base-directory = "~/Downloads"; }; }; ``` -------------------------------- ### Sleep Retry Duration Examples for gallery-dl Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Provides examples of duration string formats for 'sleep-retries', including linear and exponential growth patterns. These control the delay before retrying HTTP requests. ```string "30-50" ``` ```string "exp=40" ``` ```string "lin:20=30-60" ``` -------------------------------- ### Running gallery-dl from the command line Source: https://github.com/mikf/gallery-dl/wiki/Developer-Instructions How to execute gallery-dl directly from your terminal. ```APIDOC ## Running gallery-dl from the command line ### Description Execute gallery-dl directly from your terminal without building. ### Method Command Line ### Endpoint N/A ### Parameters #### Command Line Arguments - **url** (string) - Required - The URL of the gallery or image to download. ### Request Example ```bash python -m gallery_dl ``` ### Response N/A ``` -------------------------------- ### Sleep 429 Duration Examples for gallery-dl Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Shows example duration strings for 'sleep-429', which specifies the delay after receiving an HTTP 429 'Too Many Requests' error. Supports linear and exponential backoff. ```string "30-50" ``` ```string "e=40" ``` ```string "linear:20=30-60" ``` -------------------------------- ### Basic gallery-dl Command Usage Source: https://github.com/mikf/gallery-dl/wiki/Usage The fundamental command structure for using gallery-dl. It takes options and URLs as arguments. Use --help for a full list of options. ```bash gallery-dl [OPTIONS]... URLS... ``` -------------------------------- ### Build gallery-dl Docker image Source: https://github.com/mikf/gallery-dl/blob/master/README.rst Build a Docker image for gallery-dl from the repository's Dockerfile. ```bash git clone https://codeberg.org/mikf/gallery-dl.git cd gallery-dl/ docker build -t gallery-dl:latest . ``` -------------------------------- ### Configure Credentials in gallery-dl Source: https://github.com/mikf/gallery-dl/wiki/Authentication Sets up site-specific authentication using username and password credentials. This can be done via the JSON configuration file or directly through command-line flags. ```JSON { "extractor": { "twitter": { "username": "", "password": "" } } } ``` ```bash gallery-dl -u "" -p "" "URL" gallery-dl -o "username=" -o "password=" "URL" ``` -------------------------------- ### Action with Flag Argument Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst An action that sets a flag. This example flags the file to terminate. ```json "flag file = terminate" ``` -------------------------------- ### Configure Multiple Custom Sites and Patterns (JSON) Source: https://github.com/mikf/gallery-dl/wiki/Custom-Site-Support-‐-HowTo This JSON configuration illustrates how to define multiple custom sites across different base categories ('gelbooru_v01' and 'shopify'). It includes examples of specifying root URLs and a custom domain pattern for the 'ptfoods' site, allowing gallery-dl to match its domain more precisely. ```json { "extractor": { "gelbooru_v01": { "rozenmaidenbooru": {"root": "http://rm.booru.org"}, "azureblade" : {"root": "https://tab.booru.org"} }, "shopify": { "hiutdenim": {"root": "https://hiutdenim.co.uk"}, "ptfoods" : {"root": "https://partakefoods.com", "pattern": "(?:www\\.)?partakefoods\\.com"} } } } ``` -------------------------------- ### Example Duration Float Format Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Represents a duration as a single floating-point number in seconds. ```float 2.85 ``` -------------------------------- ### Action with Exit Argument Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst An action that exits the program. This example exits with a status code of 0. ```json "exit" ``` -------------------------------- ### Action with Keyword Argument Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst An action that sets a keyword argument. This example sets the 'title' keyword. ```json "keyword title Hello World" ``` -------------------------------- ### yt-dlp Command-Line Arguments Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Specify additional yt-dlp options as command-line arguments. Refer to yt-dlp or youtube-dl documentation for available options. ```string "--quiet --write-sub --merge-output-format mkv" ``` ```list ["--quiet", "--write-sub", "--merge-output-format", "mkv"] ``` -------------------------------- ### Set Base Download Directory (String) Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Specifies the base directory for all download destinations. Use a string for a simple path. ```json "~/Downloads/gallery-dl" ``` -------------------------------- ### Enable Verbose Logging Source: https://github.com/mikf/gallery-dl/wiki/Developing-Extractors Run the gallery-dl command with the verbose flag to output detailed process information for troubleshooting. ```bash $ gallery-dl -v URL ``` -------------------------------- ### Example Duration String Formats Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Represents a duration using string formats, either as a single value or a range. ```string "2.85" ``` ```string "1.5-3.0" ``` -------------------------------- ### Run gallery-dl with arguments using nix-shell Source: https://github.com/mikf/gallery-dl/blob/master/README.rst This command uses nix-shell to run gallery-dl with specific arguments within a temporary environment. ```bash nix-shell -p gallery-dl --run "gallery-dl " ``` -------------------------------- ### Configure Jinja Environment Initialization Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Provide initialization parameters for the Jinja environment, such as custom variable start/end strings or whether to keep trailing newlines. ```json { "variable_start_string": "((( ", "variable_end_string" : ")))", "keep_trailing_newline": true } ``` -------------------------------- ### Embed and Configure gallery-dl in Python Source: https://github.com/mikf/gallery-dl/wiki/Developer-Instructions Demonstrates how to import gallery-dl as a module, configure download settings programmatically, and execute download jobs. This allows for custom integration of gallery-dl features into larger Python applications. ```python from gallery_dl import config, job config.load() config.set(("extractor",), "base-directory", "/tmp/") config.set(("extractor", "imgur"), "filename", "{id}{title:?_//}.{extension}") for url in urls: job.DownloadJob(url).run() ``` -------------------------------- ### Instagram Cursor and File Ordering Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Controls the starting position for Instagram extractions and the order of files within posts. ```APIDOC ## extractor.instagram.cursor ### Description Controls from which position to start the extraction process from. - ``true``: Start from the beginning. Log the most recent ``cursor`` value when interrupted before reaching the end. - ``false``: Start from the beginning. - any ``string``: Start from the position defined by this value. ### Type * ``bool`` * ``string`` ### Default ``true`` ### Example ``"3414259811154179155_25025320"`` --- ## extractor.instagram.order-files ### Description Controls the order in which files of each post are returned. - ``"asc"``: Same order as displayed in a post - ``"desc"`` | ``"reverse"``: Reverse order ### Type ``string`` ### Default ``"asc"`` ``` -------------------------------- ### Gallery-DL Configuration for Gelbooru Instances Source: https://github.com/mikf/gallery-dl/wiki/Custom-Site-Support-Example:-Gelbooru This JSON configuration defines settings for gallery-dl, specifically for interacting with Gelbooru v01 and v02 instances. It includes options for base directories, archive files, keyword management, and site-specific parameters like root URLs, directory structures for tags and posts, and filename formatting. It also shows how to configure username and password for authenticated access. ```JSON { "extractor": { "base-directory": "~/gallery-dl/", "archive": "~/gallery-dl/archive.sqlite3", "keywords": {"bkey": "", "ckey": ""}, "keywords-default": "", "gelbooru_v01": { "allgirlbooru": {"root": "https://allgirl.booru.org"}, "tag": { "directory": { "locals().get('bkey')": ["Booru", "AllGirlBooru", "Tags", "{bkey}", "{ckey}", "{search_tags}"], "" : ["Booru", "AllGirlBooru", "Tags", "_Unsorted", "{search_tags}"] } }, "post": { "directory": ["Booru", "AllGirlBooru", "Posts"] }, "archive": "~/gallery-dl/custom-archive-file-for-gelbooru_v01_instances.db", "filename": "{tags}_{id}_{md5}.{extension}", "sleep-request": [0, 1.2] }, "gelbooru_v02": { "tbib": {"root": "https://tbib.org"}, "tag": { "directory": { "locals().get('bkey')": ["Other Boorus", "TBIB", "Tags", "{bkey}", "{ckey}", "{search_tags}"], "" : ["Other Boorus", "TBIB", "Tags", "_Unsorted", "{search_tags}"] } }, "pool": { "directory": { "locals().get('bkey')": ["Other Boorus", "TBIB", "Pools", "{bkey}", "{ckey}", "{pool}"], "" : ["Other Boorus", "TBIB", "Pools", "_Unsorted", "{pool}"] } }, "favorite": { "directory": { "locals().get('bkey')": ["Other Boorus", "TBIB", "Favorites", "{bkey}", "{ckey}", "{favorite_id}"], "" : ["Other Boorus", "TBIB", "Favorites", "_Unsorted", "{favorite_id}"] } }, "post": { "directory": ["Other Boorus", "TBIB", "Posts"] }, "archive": "~/gallery-dl/custom-archive-file-for-gelbooru_v02_instances.db", "filename": "{id}_{md5}.{extension}", "sleep-request": [0, 1.2], "username": "YourUsernameHere", "password": "YourPasswordHere" } }, "downloader": { "ytdl": { "module": "yt_dlp" } }, "output": { "logfile": { "path": "~/gallery-dl/log.txt", "mode": "w", "level": "debug" } } } ``` -------------------------------- ### User-Agent Configuration (Default) Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Sets the User-Agent header for HTTP requests. This example shows default values for specific extractors. ```string "gallery-dl/VERSION" ``` ```string "gallery-dl/VERSION (by mikf)" ``` ```string "net.umanle.arca.android.playstore/0.9.75" ``` ```string "Patreon/126.9.0.15 (Android; Android 14; Scale/2.10)" ``` ```string "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/LATEST.0.0.0 Safari/537.36" ``` ```string "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:LATEST) Gecko/20100101 Firefox/LATEST" ``` -------------------------------- ### Restrict Path Characters (String) Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Defines characters to be replaced in generated path segments. Example uses a string of characters to replace. ```text "/!? (){}" ``` -------------------------------- ### Execute Command for Each Downloaded File Source: https://github.com/mikf/gallery-dl/blob/master/docs/options.md Use --exec CMD to run a command for every downloaded file. Replacement fields like {} or {_path} can be used to reference file paths. On Windows, use {_path_unc} or {_directory_unc} for UNC paths. ```bash --exec "convert {} {}.png && rm {}" ``` -------------------------------- ### Configure Username and Password for Authentication Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Set the username and password for logging into various sites. For some sites, the password should be an API key. Leave the password empty to be prompted. ```string null ``` -------------------------------- ### yt-dlp Raw Options for Constructor Source: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst Pass additional options directly to the YoutubeDL constructor. Available options are detailed in the yt-dlp documentation. ```json { "quiet": true, "writesubtitles": true, "merge_output_format": "mkv" } ``` -------------------------------- ### Apply Conversions to Gallery-dl Values Source: https://github.com/mikf/gallery-dl/blob/master/docs/formatting.md Applies predefined conversions to the current value. The example shows applying 'CSgc' conversion, likely related to tags or categories. ```text {tags:CSgc/} ```