Scroll to navigation

GALLERY-DL.CONF(5) gallery-dl Manual GALLERY-DL.CONF(5)

NAME

gallery-dl.conf - gallery-dl configuration file

DESCRIPTION

gallery-dl will search for configuration files in the following places every time it is started, unless --ignore-config is specified:

/etc/gallery-dl.conf
$HOME/.config/gallery-dl/config.json
$HOME/.gallery-dl.conf

It is also possible to specify additional configuration files with the -c/--config command-line option or to add further option values with -o/--option as <key>=<value> pairs,

Configuration files are JSON-based and therefore don't allow any ordinary comments, but, since unused keys are simply ignored, it is possible to utilize those as makeshift comments by settings their values to arbitrary strings.

EXAMPLE

{

"base-directory": "/tmp/",
"extractor": {
"pixiv": {
"directory": ["Pixiv", "Works", "{user[id]}"],
"filename": "{id}{num}.{extension}",
"username": "foo",
"password": "bar"
},
"flickr": {
"_comment": "OAuth keys for account 'foobar'",
"access-token": "0123456789-0123456789abcdef",
"access-token-secret": "fedcba9876543210"
}
},
"downloader": {
"retries": 3,
"timeout": 2.5
}
}

EXTRACTOR OPTIONS

extractor.*.filename

string or object


* .. code::

"{manga}_c{chapter}_{page:>03}.{extension}"

* .. code:: json

{ "extension == 'mp4'": "{id}_video.{extension}", "'nature' in title" : "{id}_{title}.{extension}", "" : "{id}_default.{extension}" }

A format string to build filenames for downloaded files with.

If this is an object, it must contain Python expressions mapping to the filename format strings to use. These expressions are evaluated in the order as specified in Python 3.6+ and in an undetermined order in Python 3.4 and 3.5.

The available replacement keys depend on the extractor used. A list of keys for a specific one can be acquired by calling *gallery-dl* with the -K/--list-keywords command-line option. For example:

$ gallery-dl -K http://seiga.nicovideo.jp/seiga/im5977527 Keywords for directory names:

category seiga subcategory image

Keywords for filenames:

category seiga extension None image-id 5977527 subcategory image

Note: Even if the value of the extension key is missing or None, it will be filled in later when the file download is starting. This key is therefore always available to provide a valid filename extension.

extractor.*.directory

list of strings

["{category}", "{manga}", "c{chapter} - {title}"]

A list of format strings for the resulting target directory.

Each individual string in such a list represents a single path segment, which will be joined together and appended to the base-directory to form the complete target directory path.

extractor.*.base-directory

Path

"./gallery-dl/"

Directory path used as base for all download destinations.

extractor.*.parent-directory

bool

false

Use an extractor's current target directory as base-directory for any spawned child extractors.

extractor.*.parent-metadata

bool

false

Overwrite any metadata provided by a child extractor with its parent's.

extractor.*.parent-skip

bool

false

Share number of skipped downloads between parent and child extractors.

extractor.*.path-restrict

string or object

"auto"


* "/!? (){}"
* {" ": "_", "/": "-", "|": "-", ":": "-", "*": "+"}

A string of characters to be replaced with the value of
path-replace or an object mapping invalid/unwanted characters to their replacements
for generated path segment names.

Special values:

* "auto": Use characters from "unix" or "windows" depending on the local operating system
* "unix": "/"
* "windows": "\\\\|/<>:\"?*"
* "ascii": "^0-9A-Za-z_."

Note: In a string with 2 or more characters, []^-\ need to be escaped with backslashes, e.g. "\\[\\]"

extractor.*.path-replace

string

"_"

The replacement character(s) for path-restrict

extractor.*.path-remove

string

"\u0000-\u001f\u007f" (ASCII control characters)

Set of characters to remove from generated path names.

Note: In a string with 2 or more characters, []^-\ need to be escaped with backslashes, e.g. "\\[\\]"

extractor.*.extension-map

object

{ "jpeg": "jpg", "jpe" : "jpg", "jfif": "jpg", "jif" : "jpg", "jfi" : "jpg" }

A JSON object mapping filename extensions to their replacements.

extractor.*.skip

bool or string

true

Controls the behavior when downloading files that have been downloaded before, i.e. a file with the same filename already exists or its ID is in a download archive.

* true: Skip downloads
* false: Overwrite already existing files

* "abort": Stop the current extractor run
* "abort:N": Skip downloads and stop the current extractor run after N consecutive skips

* "terminate": Stop the current extractor run, including parent extractors
* "terminate:N": Skip downloads and stop the current extractor run, including parent extractors, after N consecutive skips

* "exit": Exit the program altogether
* "exit:N": Skip downloads and exit the program after N consecutive skips

* "enumerate": Add an enumeration index to the beginning of the filename extension (file.1.ext, file.2.ext, etc.)

extractor.*.sleep

float

0

Number of seconds to sleep before each download.

extractor.*.sleep-extractor

float

0

Number of seconds to sleep before handling an input URL, i.e. before starting a new extractor.

extractor.*.sleep-request

float

0

Minimal time interval in seconds between each HTTP request during data extraction.

extractor.*.username & .password

string

null

The username and password to use when attempting to log in to another site.

Specifying a username and password is required for

* nijie
* seiga

and optional for

* aryion
* danbooru (*)
* e621 (*)
* exhentai
* idolcomplex
* imgbb
* inkbunny
* instagram
* mangadex
* mangoxo
* pillowfort
* pinterest
* sankaku
* subscribestar
* tapas
* tsumino
* twitter

These values can also be specified via the -u/--username and -p/--password command-line options or by using a .netrc file. (see Authentication_)

(*) The password value for danbooru and e621 should be the API key found in your user profile, not the actual account password.

extractor.*.netrc

bool

false

Enable the use of .netrc authentication data.

extractor.*.cookies

Path or object

null

Source to read additional cookies from. Either as

* the Path to a Mozilla/Netscape format cookies.txt file or
* a JSON object specifying cookies as a name-to-value mapping

Example:

{ "cookie-name": "cookie-value", "sessionid" : "14313336321%3AsabDFvuASDnlpb%3A31", "isAdult" : "1" }

extractor.*.cookies-update

bool

true

If extractor.*.cookies specifies the Path to a cookies.txt file and it can be opened and parsed without errors, update its contents with cookies received during data extraction.

extractor.*.proxy

string or object

null

Proxy (or proxies) to be used for remote connections.

* If this is a string, it is the proxy URL for all outgoing requests.
* If this is an object, it is a scheme-to-proxy mapping to specify different proxy URLs for each scheme. It is also possible to set a proxy for a specific host by using scheme://host as key. See Requests' proxy documentation for more details.

Example:

{ "http" : "http://10.10.1.10:3128", "https": "http://10.10.1.10:1080", "http://10.20.1.128": "http://10.10.1.10:5323" }

Note: All proxy URLs should include a scheme, otherwise http:// is assumed.

extractor.*.user-agent

string

"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0"

User-Agent header value to be used for HTTP requests.

Note: This option has no effect on pixiv extractors, as these need specific values to function correctly.

extractor.*.browser

string

"firefox" for patreon, null everywhere else


* "chrome:macos"

Try to emulate a real browser (firefox or chrome) by using their default HTTP headers and TLS ciphers for HTTP requests.

Optionally, the operating system used in the User-Agent header can be specified after a : (windows, linux, or macos).

Note: requests and urllib3 only support HTTP/1.1, while a real browser would use HTTP/2.

extractor.*.keywords

object

{"type": "Pixel Art", "type_id": 123}

Additional key-value pairs to be added to each metadata dictionary.

extractor.*.keywords-default

any

"None"

Default value used for missing or undefined keyword names in format strings.

extractor.*.category-transfer

bool

Extractor-specific

Transfer an extractor's (sub)category values to all child extractors spawned by it, to let them inherit their parent's config options.

extractor.*.blacklist & .whitelist

list of strings

["oauth", "recursive", "test"] + current extractor category

A list of extractor categories to ignore (or allow) when spawning child extractors for unknown URLs, e.g. from reddit or plurk.

Note: Any blacklist setting will automatically include "oauth", "recursive", and "test".

extractor.*.archive

Path

null

"$HOME/.archives/{category}.sqlite3"

File to store IDs of downloaded files in. Downloads of files already recorded in this archive file will be skipped.

The resulting archive file is not a plain text file but an SQLite3 database, as either lookup operations are significantly faster or memory requirements are significantly lower when the amount of stored IDs gets reasonably large.

Note: archive paths support regular format string replacements, but be aware that using external inputs for building local paths may pose a security risk.

extractor.*.archive-format

string

"{id}_{offset}"

An alternative format string to build archive IDs with.

extractor.*.postprocessors

list of Postprocessor Configuration objects

[ { "name": "zip" , "compression": "store" }, { "name": "exec", "command": ["/home/foobar/script", "{category}", "{image_id}"] } ]

A list of post processors to be applied to each downloaded file in the specified order.

Unlike other options, a postprocessors setting at a deeper level
does not override any postprocessors setting at a lower level. Instead, all post processors from all applicable postprocessors
settings get combined into a single list.

For example

* an mtime post processor at extractor.postprocessors,
* a zip post processor at extractor.pixiv.postprocessors,
* and using --exec

will run all three post processors - mtime, zip, exec - for each downloaded pixiv file.

extractor.*.retries

integer

4

Maximum number of times a failed HTTP request is retried before giving up, or -1 for infinite retries.

extractor.*.timeout

float

30.0

Amount of time (in seconds) to wait for a successful connection and response from a remote server.

This value gets internally used as the timeout parameter for the requests.request() method.

extractor.*.verify

bool or string

true

Controls whether to verify SSL/TLS certificates for HTTPS requests.

If this is a string, it must be the path to a CA bundle to use instead of the default certificates.

This value gets internally used as the verify parameter for the requests.request() method.

extractor.*.download

bool

true

Controls whether to download media files.

Setting this to false won't download any files, but all other functions (postprocessors, download archive, etc.) will be executed as normal.

extractor.*.image-range

string


* "10-20"
* "-5, 10, 30-50, 100-"

Index-range(s) specifying which images to download.

Note: The index of the first image is 1.

extractor.*.chapter-range

string

Like image-range, but applies to delegated URLs like manga-chapters, etc.

extractor.*.image-filter

string


* "width >= 1200 and width/height > 1.2"
* "re.search(r'foo(bar)+', description)"

Python expression controlling which files to download.

Files for which the expression evaluates to False are ignored.
Available keys are the filename-specific ones listed by -K or -j.

extractor.*.chapter-filter

string


* "lang == 'en'"
* "language == 'French' and 10 <= chapter < 20"

Like image-filter, but applies to delegated URLs like manga-chapters, etc.

extractor.*.image-unique

bool

false

Ignore image URLs that have been encountered before during the current extractor run.

extractor.*.chapter-unique

bool

false

Like image-unique, but applies to delegated URLs like manga-chapters, etc.

extractor.*.date-format

string

"%Y-%m-%dT%H:%M:%S"

Format string used to parse string values of date-min and date-max.

See strptime for a list of formatting directives.

EXTRACTOR-SPECIFIC OPTIONS

extractor.artstation.external

bool

false

Try to follow external URLs of embedded players.

extractor.aryion.recursive

bool

true

Controls the post extraction strategy.

* true: Start on users' main gallery pages and recursively descend into subfolders
* false: Get posts from "Latest Updates" pages

extractor.blogger.videos

bool

true

Download embedded videos hosted on https://www.blogger.com/

extractor.derpibooru.api-key

string

null

Your Derpibooru API Key, to use your account's browsing settings and filters.

extractor.derpibooru.filter

integer

56027 (Everything filter)

The content filter ID to use.

Setting an explicit filter ID overrides any default filters and can be used to access 18+ content without API Key.

See Filters for details.

extractor.deviantart.extra

bool

false

Download extra Sta.sh resources from description texts and journals.

Note: Enabling this option also enables deviantart.metadata_.

extractor.deviantart.flat

bool

true

Select the directory structure created by the Gallery- and Favorite-Extractors.

* true: Use a flat directory structure.
* false: Collect a list of all gallery-folders or favorites-collections and transfer any further work to other extractors (folder or collection), which will then create individual subdirectories for each of them.

Note: Going through all gallery folders will not be able to fetch deviations which aren't in any folder.

extractor.deviantart.folders

bool

false

Provide a folders metadata field that contains the names of all folders a deviation is present in.

Note: Gathering this information requires a lot of API calls. Use with caution.

extractor.deviantart.include

string or list of strings

"gallery"

"favorite,journal,scraps" or ["favorite", "journal", "scraps"]

A (comma-separated) list of subcategories to include when processing a user profile.

Possible values are "gallery", "scraps", "journal", "favorite".

You can use "all" instead of listing all values separately.

extractor.deviantart.journals

string

"html"

Selects the output format of journal entries.

* "html": HTML with (roughly) the same layout as on DeviantArt.
* "text": Plain text with image references and HTML tags removed.
* "none": Don't download journals.

extractor.deviantart.mature

bool

true

Enable mature content.

This option simply sets the mature_content parameter for API calls to either "true" or "false" and does not do any other form of content filtering.

extractor.deviantart.metadata

bool

false

Request extended metadata for deviation objects to additionally provide description, tags, license and is_watching fields.

extractor.deviantart.original

bool or string

true

Download original files if available.

Setting this option to "images" only downloads original files if they are images and falls back to preview versions for everything else (archives, etc.).

extractor.deviantart.quality

integer

100

JPEG quality level of newer images for which an original file download is not available.

extractor.deviantart.refresh-token

string

null

The refresh-token value you get from linking your DeviantArt account to gallery-dl.

Using a refresh-token allows you to access private or otherwise not publicly available deviations.

Note: The refresh-token becomes invalid after 3 months or whenever your cache file is deleted or cleared.

extractor.deviantart.wait-min

integer

0

Minimum wait time in seconds before API requests.

extractor.exhentai.limits

integer

null

Sets a custom image download limit and stops extraction when it gets exceeded.

extractor.exhentai.domain

string

"auto"


* "auto": Use e-hentai.org or exhentai.org depending on the input URL
* "e-hentai.org": Use e-hentai.org for all URLs
* "exhentai.org": Use exhentai.org for all URLs

extractor.exhentai.metadata

bool

false

Load extended gallery metadata from the API.

Adds archiver_key, posted, and torrents. Makes date and filesize more precise.

extractor.exhentai.original

bool

true

Download full-sized original images if available.

extractor.fanbox.embeds

bool or string

true

Control behavior on embedded content from external sites.

* true: Extract embed URLs and download them if supported (videos are not downloaded).
* "ytdl": Like true, but let youtube-dl handle video extraction and download for YouTube, Vimeo and SoundCloud embeds.
* false: Ignore embeds.

extractor.flickr.access-token & .access-token-secret

string

null

The access_token and access_token_secret values you get from linking your Flickr account to gallery-dl.

extractor.flickr.videos

bool

true

Extract and download videos.

extractor.flickr.size-max

integer or string

null

Sets the maximum allowed size for downloaded images.

* If this is an integer, it specifies the maximum image dimension (width and height) in pixels.
* If this is a string, it should be one of Flickr's format specifiers ("Original", "Large", ... or "o", "k", "h", "l", ...) to use as an upper limit.

extractor.furaffinity.descriptions

string

"text"

Controls the format of description metadata fields.

* "text": Plain text with HTML tags removed
* "html": Raw HTML content

extractor.furaffinity.include

string or list of strings

"gallery"

"scraps,favorite" or ["scraps", "favorite"]

A (comma-separated) list of subcategories to include when processing a user profile.

Possible values are "gallery", "scraps", "favorite".

You can use "all" instead of listing all values separately.

extractor.gfycat.format

string

"mp4"

The name of the preferred animation format, which can be one of "mp4", "webm", "gif", "webp" or "mjpg".

If the selected format is not available, "mp4", "webm" and "gif" (in that order) will be tried instead, until an available format is found.

extractor.hentaifoundry.include

string or list of strings

"pictures"

"scraps,stories" or ["scraps", "stories"]

A (comma-separated) list of subcategories to include when processing a user profile.

Possible values are "pictures", "scraps", "stories", "favorite".

You can use "all" instead of listing all values separately.

extractor.hentainexus.original

bool

true

Download original files instead of WebP versions.

extractor.hitomi.metadata

bool

true

Try to extract artist, group, parody, and characters metadata.

extractor.imgur.mp4

bool or string

true

Controls whether to choose the GIF or MP4 version of an animation.

* true: Follow Imgur's advice and choose MP4 if the prefer_video flag in an image's metadata is set.
* false: Always choose GIF.
* "always": Always choose MP4.

extractor.inkbunny.orderby

string

"create_datetime"

Value of the orderby parameter for submission searches.

(See API#Search for details)

extractor.instagram.include

string or list of strings

"posts"

"stories,highlights,posts" or ["stories", "highlights", "posts"]

A (comma-separated) list of subcategories to include when processing a user profile.

Possible values are "posts", "reels", "channel", "tagged", "stories", "highlights".

You can use "all" instead of listing all values separately.

extractor.instagram.videos

bool

true

Download video files.

extractor.kemonoparty.metadata

bool

false

Extract username metadata

extractor.khinsider.format

string

"mp3"

The name of the preferred file format to download.

Use "all" to download all available formats, or a (comma-separated) list to select multiple formats.

If the selected format is not available, the first in the list gets chosen (usually mp3).

extractor.mangadex.api-server

string

"https://api.mangadex.org"

The server to use for API requests.

extractor.newgrounds.flash

bool

true

Download original Adobe Flash animations instead of pre-rendered videos.

extractor.newgrounds.include

string or list of strings

"art"

"movies,audio" or ["movies", "audio"]

A (comma-separated) list of subcategories to include when processing a user profile.

Possible values are "art", "audio", "movies".

You can use "all" instead of listing all values separately.

extractor.nijie.include

string or list of strings

"illustration,doujin"

A (comma-separated) list of subcategories to include when processing a user profile.

Possible values are "illustration", "doujin", "favorite".

You can use "all" instead of listing all values separately.

extractor.oauth.browser

bool

true

Controls how a user is directed to an OAuth authorization page.

* true: Use Python's webbrowser.open() method to automatically open the URL in the user's default browser.
* false: Ask the user to copy & paste an URL from the terminal.

extractor.oauth.cache

bool

true

Store tokens received during OAuth authorizations in cache.

extractor.oauth.port

integer

6414

Port number to listen on during OAuth authorization.

Note: All redirects will go to http://localhost:6414/, regardless of the port specified here. You'll have to manually adjust the port number in your browser's address bar when using a different port than the default.

extractor.photobucket.subalbums

bool

true

Download subalbums.

extractor.pillowfort.external

bool

false

Follow links to external sites, e.g. Twitter,

extractor.pillowfort.inline

bool

true

Extract inline images.

extractor.pillowfort.reblogs

bool

false

Extract media from reblogged posts.

extractor.pinterest.sections

bool

true

Include pins from board sections.

extractor.pinterest.videos

bool

true

Download from video pins.

extractor.pixiv.user.avatar

bool

false

Download user avatars.

extractor.pixiv.user.metadata

bool

false

Fetch extended user metadata.

extractor.pixiv.work.related

bool

false

Also download related artworks.

extractor.pixiv.tags

string

"japanese"

Controls the tags metadata field.

* "japanese": List of Japanese tags
* "translated": List of translated tags
* "original": Unmodified list with both Japanese and translated tags

extractor.pixiv.ugoira

bool

true

Download Pixiv's Ugoira animations or ignore them.

These animations come as a .zip file containing all animation frames in JPEG format.

Use an ugoira post processor to convert them to watchable videos. (Example__)

extractor.pixiv.max-posts

integer

0

When downloading galleries, this sets the maximum number of posts to get. A value of 0 means no limit.

extractor.plurk.comments

bool

false

Also search Plurk comments for URLs.

extractor.readcomiconline.captcha

string

"stop"

Controls how to handle redirects to CAPTCHA pages.

* "stop: Stop the current extractor run.
* "wait: Ask the user to solve the CAPTCHA and wait.

extractor.reddit.comments

integer

0

The value of the limit parameter when loading a submission and its comments. This number (roughly) specifies the total amount of comments being retrieved with the first API call.

Reddit's internal default and maximum values for this parameter appear to be 200 and 500 respectively.

The value 0 ignores all comments and significantly reduces the time required when scanning a subreddit.

extractor.reddit.morecomments

bool

false

Retrieve additional comments by resolving the more comment stubs in the base comment tree.

This requires 1 additional API call for every 100 extra comments.

extractor.reddit.date-min & .date-max

Date

0 and 253402210800 (timestamp of datetime.max)

Ignore all submissions posted before/after this date.

extractor.reddit.id-min & .id-max

string

"6kmzv2"

Ignore all submissions posted before/after the submission with this ID.

extractor.reddit.recursion

integer

0

Reddit extractors can recursively visit other submissions linked to in the initial set of submissions. This value sets the maximum recursion depth.

Special values:

* 0: Recursion is disabled
* -1: Infinite recursion (don't do this)

extractor.reddit.refresh-token

string

null

The refresh-token value you get from linking your Reddit account to gallery-dl.

Using a refresh-token allows you to access private or otherwise not publicly available subreddits, given that your account is authorized to do so, but requests to the reddit API are going to be rate limited at 600 requests every 10 minutes/600 seconds.

extractor.reddit.videos

bool or string

true

Control video download behavior.

* true: Download videos and use youtube-dl to handle HLS and DASH manifests
* "ytdl": Download videos and let youtube-dl handle all of video extraction and download
* false: Ignore videos

extractor.redgifs.format

string

"mp4"

The name of the preferred format, which can be one of "mp4", "webm", "gif", "webp", "mobile", or "mini".

If the selected format is not available, "mp4", "webm" and "gif" (in that order) will be tried instead, until an available format is found.

extractor.sankakucomplex.embeds

bool

false

Download video embeds from external sites.

extractor.sankakucomplex.videos

bool

true

Download videos.

extractor.smugmug.videos

bool

true

Download video files.

extractor.tumblr.avatar

bool

false

Download blog avatars.

extractor.tumblr.date-min & .date-max

Date

0 and null

Ignore all posts published before/after this date.

extractor.tumblr.external

bool

false

Follow external URLs (e.g. from "Link" posts) and try to extract images from them.

extractor.tumblr.inline

bool

true

Search posts for inline images and videos.

extractor.tumblr.reblogs

bool or string

true


* true: Extract media from reblogged posts
* false: Skip reblogged posts
* "same-blog": Skip reblogged posts unless the original post is from the same blog

extractor.tumblr.posts

string or list of strings

"all"

"video,audio,link" or ["video", "audio", "link"]

A (comma-separated) list of post types to extract images, etc. from.

Possible types are text, quote, link, answer, video, audio, photo, chat.

You can use "all" instead of listing all types separately.

extractor.twitter.cards

bool

false

Fetch media from Cards.

extractor.twitter.conversations

bool

false

Fetch media from all Tweets and replies in a conversation <https://help.twitter.com/en/using-twitter/twitter-conversations>.

extractor.twitter.quoted

bool

false

Fetch media from quoted Tweets.

extractor.twitter.replies

bool

true

Fetch media from replies to other Tweets.

extractor.twitter.retweets

bool

false

Fetch media from Retweets.

If this value is "original", metadata for these files will be taken from the original Tweets, not the Retweets.

extractor.twitter.text-tweets

bool

false

Also emit metadata for text-only Tweets without media content.

This only has an effect with a metadata (or exec) post processor with "event": "post" and appropriate filename.

extractor.twitter.twitpic

bool

false

Extract TwitPic embeds.

extractor.twitter.users

string

"timeline"

"https://twitter.com/search?q=from:{legacy[screen_name]}"

Format string for user URLs generated from
following and list-members queries, whose replacement field values come from Twitter user objects
(Example)

Special values:

* "timeline": https://twitter.com/i/user/{rest_id}
* "media": https://twitter.com/id:{rest_id}/media

Note: To allow gallery-dl to follow custom URL formats, set the blacklist for twitter to a non-default value, e.g. an empty string "".

extractor.twitter.videos

bool or string

true

Control video download behavior.

* true: Download videos
* "ytdl": Download videos using youtube-dl
* false: Skip video Tweets

extractor.unsplash.format

string

"raw"

Name of the image format to download.

Available formats are "raw", "full", "regular", "small", and "thumb".

extractor.vsco.videos

bool

true

Download video files.

extractor.wallhaven.api-key

string

null

Your Wallhaven API Key, to use your account's browsing settings and default filters when searching.

See https://wallhaven.cc/help/api for more information.

extractor.weasyl.api-key

string

null

Your Weasyl API Key, to use your account's browsing settings and filters.

extractor.weibo.retweets

bool

true

Fetch media from retweeted posts.

If this value is "original", metadata for these files will be taken from the original posts, not the retweeted posts.

extractor.weibo.videos

bool

true

Download video files.

extractor.[manga-extractor].chapter-reverse

bool

false

Reverse the order of chapter URLs extracted from manga pages.

* true: Start with the latest chapter
* false: Start with the first chapter

DOWNLOADER OPTIONS

downloader.*.enabled

bool

true

Enable/Disable this downloader module.

downloader.*.filesize-min & .filesize-max

string

null

"32000", "500k", "2.5M"

Minimum/Maximum allowed file size in bytes. Any file smaller/larger than this limit will not be downloaded.

Possible values are valid integer or floating-point numbers optionally followed by one of k, m. g, t or p. These suffixes are case-insensitive.

downloader.*.mtime

bool

true

Use Last-Modified HTTP response headers to set file modification times.

downloader.*.part

bool

true

Controls the use of .part files during file downloads.

* true: Write downloaded data into .part files and rename them upon download completion. This mode additionally supports resuming incomplete downloads.
* false: Do not use .part files and write data directly into the actual output files.

downloader.*.part-directory

Path

null

Alternate location for .part files.

Missing directories will be created as needed. If this value is null, .part files are going to be stored alongside the actual output files.

downloader.*.rate

string

null

"32000", "500k", "2.5M"

Maximum download rate in bytes per second.

Possible values are valid integer or floating-point numbers optionally followed by one of k, m. g, t or p. These suffixes are case-insensitive.

downloader.*.retries

integer

extractor.*.retries

Maximum number of retries during file downloads, or -1 for infinite retries.

downloader.*.timeout

float or null

extractor.*.timeout

Connection timeout during file downloads.

downloader.*.verify

bool or string

extractor.*.verify

Certificate validation during file downloads.

downloader.http.adjust-extensions

bool

true

Check the file headers of jpg, png, and gif files and adjust their filename extensions if they do not match.

downloader.http.headers

object

{"Accept": "image/webp,*/*", "Referer": "https://example.org/"}

Additional HTTP headers to send when downloading files,

downloader.ytdl.format

string

youtube-dl's default, currently "bestvideo+bestaudio/best"

Video format selection <https://github.com/ytdl-org/youtube-dl#format-selection> directly passed to youtube-dl.

downloader.ytdl.forward-cookies

bool

false

Forward cookies to youtube-dl.

downloader.ytdl.logging

bool

true

Route youtube-dl's output through gallery-dl's logging system. Otherwise youtube-dl will write its output directly to stdout/stderr.

Note: Set quiet and no_warnings in downloader.ytdl.raw-options to true to suppress all output.

downloader.ytdl.module

string

"youtube_dl"

Name of the youtube-dl Python module to import.

downloader.ytdl.outtmpl

string

null

The Output Template used to generate filenames for files downloaded with youtube-dl.

Special values:

* null: generate filenames with extractor.*.filename
* "default": use youtube-dl's default, currently "%(title)s-%(id)s.%(ext)s"

Note: An output template other than null might cause unexpected results in combination with other options (e.g. "skip": "enumerate")

downloader.ytdl.raw-options

object

{ "quiet": true, "writesubtitles": true, "merge_output_format": "mkv" }

Additional options passed directly to the YoutubeDL constructor.

All available options can be found in youtube-dl's docstrings <https://github.com/ytdl-org/youtube-dl/blob/master/youtube_dl/YoutubeDL.py#L138-L318>.

OUTPUT OPTIONS

output.fallback

bool

true

Include fallback URLs in the output of -g/--get-urls.

output.mode

string

"auto"

Controls the output string format and status indicators.

* "null": No output
* "pipe": Suitable for piping to other processes or files
* "terminal": Suitable for the standard Windows console
* "color": Suitable for terminals that understand ANSI escape codes and colors
* "auto": Automatically choose the best suitable output mode

output.shorten

bool

true

Controls whether the output strings should be shortened to fit on one console line.

output.skip

bool

true

Show skipped file downloads.

output.progress

bool or string

true

Controls the progress indicator when *gallery-dl* is run with multiple URLs as arguments.

* true: Show the default progress indicator ("[{current}/{total}] {url}")
* false: Do not show any progress indicator
* Any string: Show the progress indicator using this as a custom format string. Possible replacement keys are current, total and url.

output.log

string or Logging Configuration

"[{name}][{levelname}] {message}"

Configuration for standard logging output to stderr.

If this is a simple string, it specifies the format string for logging messages.

output.logfile

Path or Logging Configuration

null

File to write logging output to.

output.unsupportedfile

Path or Logging Configuration

null

File to write external URLs unsupported by *gallery-dl* to.

The default format string here is "{message}".

output.num-to-str

bool

false

Convert numeric values (integer or float) to string before outputting them as JSON.

POSTPROCESSOR OPTIONS

classify.mapping

object

{ "Pictures": ["jpg", "jpeg", "png", "gif", "bmp", "svg", "webp"], "Video" : ["flv", "ogv", "avi", "mp4", "mpg", "mpeg", "3gp", "mkv", "webm", "vob", "wmv"], "Music" : ["mp3", "aac", "flac", "ogg", "wma", "m4a", "wav"], "Archives": ["zip", "rar", "7z", "tar", "gz", "bz2"] }

A mapping from directory names to filename extensions that should be stored in them.

Files with an extension not listed will be ignored and stored in their default location.

compare.action

string

"replace"

The action to take when files do not compare as equal.

* "replace": Replace/Overwrite the old version with the new one
* "enumerate": Add an enumeration index to the filename of the new version like skip = "enumerate"

compare.shallow

bool

false

Only compare file sizes. Do not read and compare their content.

exec.async

bool

false

Controls whether to wait for a subprocess to finish or to let it run asynchronously.

exec.command

string or list of strings


* "convert {} {}.png && rm {}"
* ["echo", "{user[account]}", "{id}"]

The command to run.

* If this is a string, it will be executed using the system's shell, e.g. /bin/sh. Any {} will be replaced with the full path of a file or target directory, depending on exec.event

* If this is a list, the first element specifies the program name and any further elements its arguments. Each element of this list is treated as a format string using the files' metadata as well as {_path}, {_directory}, and {_filename}.

exec.event

string

"after"

The event for which exec.command is run.

See metadata.event for a list of available events.

metadata.mode

string

"json"

Select how to write metadata.

* "json": all metadata using json.dump() <https://docs.python.org/3/library/json.html#json.dump>
* "tags": tags separated by newlines
* "custom": result of applying metadata.content-format to a file's metadata dictionary

metadata.filename

string

null

"{id}.data.json"

A format string to build the filenames for metadata files with. (see extractor.filename)

If this option is set, metadata.extension and metadata.extension-format will be ignored.

metadata.directory

string

"."

"metadata"

Directory where metadata files are stored in relative to the current target location for file downloads.

metadata.extension

string

"json" or "txt"

Filename extension for metadata files that will be appended to the original file names.

metadata.extension-format

string


* "{extension}.json"
* "json"

Custom format string to build filename extensions for metadata files with, which will replace the original filename extensions.

Note: metadata.extension is ignored if this option is set.

metadata.event

string

"file"

The event for which metadata gets written to a file.

The available events are:

init After post processor initialization and before the first file download finalize On extractor shutdown, e.g. after all files were downloaded prepare Before a file download file When completing a file download, but before it gets moved to its target location after After a file got moved to its target location skip When skipping a file download post When starting to download all files of a post, e.g. a Tweet on Twitter or a post on Patreon.

metadata.content-format

string or list of strings


* "tags:\n\n{tags:J\n}\n"
* ["tags:", "", "{tags:J\n}"]

Custom format string to build the content of metadata files with.

Note: Only applies for "mode": "custom".

mtime.key

string

"date"

Name of the metadata field whose value should be used.

This value must either be a UNIX timestamp or a datetime object.

ugoira.extension

string

"webm"

Filename extension for the resulting video files.

ugoira.ffmpeg-args

list of strings

null

["-c:v", "libvpx-vp9", "-an", "-b:v", "2M"]

Additional FFmpeg command-line arguments.

ugoira.ffmpeg-demuxer

string

image2

FFmpeg demuxer to read input files with. Possible values are "image2" and "concat".

ugoira.ffmpeg-location

Path

"ffmpeg"

Location of the ffmpeg (or avconv) executable to use.

ugoira.ffmpeg-output

bool

true

Show FFmpeg output.

ugoira.ffmpeg-twopass

bool

false

Enable Two-Pass encoding.

ugoira.framerate

string

"auto"

Controls the frame rate argument (-r) for FFmpeg

* "auto": Automatically assign a fitting frame rate based on delays between frames.
* any other string: Use this value as argument for -r.
* null or an empty string: Don't set an explicit frame rate.

ugoira.keep-files

bool

false

Keep ZIP archives after conversion.

ugoira.libx264-prevent-odd

bool

true

Prevent "width/height not divisible by 2" errors when using libx264 or libx265 encoders by applying a simple cropping filter. See this Stack Overflow thread for more information.

This option, when libx264/5 is used, automatically adds ["-vf", "crop=iw-mod(iw\\,2):ih-mod(ih\\,2)"] to the list of FFmpeg command-line arguments to reduce an odd width/height by 1 pixel and make them even.

ugoira.repeat-last-frame

bool

true

Allow repeating the last frame when necessary to prevent it from only being displayed for a very short amount of time.

zip.extension

string

"zip"

Filename extension for the created ZIP archive.

zip.keep-files

bool

false

Keep the actual files after writing them to a ZIP archive.

zip.mode

string

"default"


* "default": Write the central directory file header once after everything is done or an exception is raised.

* "safe": Update the central directory file header each time a file is stored in a ZIP archive.

This greatly reduces the chance a ZIP archive gets corrupted in case the Python interpreter gets shut down unexpectedly (power outage, SIGKILL) but is also a lot slower.

MISCELLANEOUS OPTIONS

extractor.modules

list of strings

The modules list in extractor/__init__.py

["reddit", "danbooru", "mangadex"]

The list of modules to load when searching for a suitable extractor class. Useful to reduce startup time and memory usage.

cache.file

Path


* (%APPDATA% or "~") + "/gallery-dl/cache.sqlite3" on Windows
* ($XDG_CACHE_HOME or "~/.cache") + "/gallery-dl/cache.sqlite3" on all other platforms

Path of the SQLite3 database used to cache login sessions, cookies and API tokens across gallery-dl invocations.

Set this option to null or an invalid path to disable this cache.

pyopenssl

bool

false

Use pyOpenSSL-backed SSL-support.

API TOKENS & IDS

extractor.deviantart.client-id & .client-secret

string


* login and visit DeviantArt's Applications & Keys section
* click "Register Application"
* scroll to "OAuth2 Redirect URI Whitelist (Required)" and enter "https://mikf.github.io/gallery-dl/oauth-redirect.html"
* scroll to the bottom and agree to the API License Agreement. Submission Policy, and Terms of Service.
* click "Save"
* copy client_id and client_secret of your new application and put them in your configuration file as "client-id" and "client-secret"
* clear your cache to delete any remaining access-token entries. (gallery-dl --clear-cache)
* get a new refresh-token for the new client-id (gallery-dl oauth:deviantart)

extractor.flickr.api-key & .api-secret

string


* login and Create an App in Flickr's App Garden
* click "APPLY FOR A NON-COMMERCIAL KEY"
* fill out the form with a random name and description and click "SUBMIT"
* copy Key and Secret and put them in your configuration file

extractor.reddit.client-id & .user-agent

string


* login and visit the apps section of your account's preferences
* click the "are you a developer? create an app..." button
* fill out the form, choose "installed app", preferably set "http://localhost:6414/" as "redirect uri" and finally click "create app"
* copy the client id (third line, under your application's name and "installed app") and put it in your configuration file
* use "Python:<application name>:v1.0 (by /u/<username>)" as user-agent and replace <application name> and <username> accordingly (see Reddit's API access rules)

extractor.smugmug.api-key & .api-secret

string


* login and Apply for an API Key
* use a random name and description, set "Type" to "Application", "Platform" to "All", and "Use" to "Non-Commercial"
* fill out the two checkboxes at the bottom and click "Apply"
* copy API Key and API Secret and put them in your configuration file

extractor.tumblr.api-key & .api-secret

string


* login and visit Tumblr's Applications section
* click "Register application"
* fill out the form: use a random name and description, set https://example.org/ as "Application Website" and "Default callback URL"
* solve Google's "I'm not a robot" challenge and click "Register"
* click "Show secret key" (below "OAuth Consumer Key")
* copy your OAuth Consumer Key and Secret Key and put them in your configuration file

CUSTOM TYPES

Date

string or integer


* "2019-01-01T00:00:00"
* "2019" with "%Y" as date-format
* 1546297200

A Date value represents a specific point in time.

* If given as string, it is parsed according to date-format.
* If given as integer, it is interpreted as UTC timestamp.

Path

string or list of strings


* "file.ext"
* "~/path/to/file.ext"
* "$HOME/path/to/file.ext"
* ["$HOME", "path", "to", "file.ext"]

A Path is a string representing the location of a file or directory.

Simple tilde expansion and environment variable expansion is supported.

In Windows environments, backslashes ("\") can, in addition to forward slashes ("/"), be used as path separators. Because backslashes are JSON's escape character, they themselves have to be escaped. The path C:\path\to\file.ext has therefore to be written as "C:\\path\\to\\file.ext" if you want to use backslashes.

Logging Configuration

object

{ "format" : "{asctime} {name}: {message}", "format-date": "%H:%M:%S", "path" : "~/log.txt", "encoding" : "ascii" }

{ "level" : "debug", "format": { "debug" : "debug: {message}", "info" : "[{name}] {message}", "warning": "Warning: {message}", "error" : "ERROR: {message}" } }

Extended logging output configuration.

* format
* General format string for logging messages or a dictionary with format strings for each loglevel.

In addition to the default LogRecord attributes, it is also possible to access the current extractor, job, path, and keywords objects and their attributes, for example "{extractor.url}", "{path.filename}", "{keywords.title}"
* Default: "[{name}][{levelname}] {message}"
* format-date
* Format string for {asctime} fields in logging messages (see strftime() directives)
* Default: "%Y-%m-%d %H:%M:%S"
* level
* Minimum logging message level (one of "debug", "info", "warning", "error", "exception")
* Default: "info"
* path
* Path to the output file
* mode
* Mode in which the file is opened; use "w" to truncate or "a" to append (see open())
* Default: "w"
* encoding
* File encoding
* Default: "utf-8"

Note: path, mode, and encoding are only applied when configuring logging output to a file.

Postprocessor Configuration

object

{ "name": "mtime" }

{ "name" : "zip", "compression": "store", "extension" : "cbz", "filter" : "extension not in ('zip', 'rar')", "whitelist" : ["mangadex", "exhentai", "nhentai"] }

An object containing a "name" attribute specifying the post-processor type, as well as any of its options.

It is possible to set a "filter" expression similar to image-filter to only run a post-processor conditionally.

It is also possible set a "whitelist" or "blacklist" to only enable or disable a post-processor for the specified extractor categories.

The available post-processor types are

classify Categorize files by filename extension compare Compare versions of the same file and replace/enumerate them on mismatch
(requires downloader.*.part = true and extractor.*.skip = false)
exec Execute external commands metadata Write metadata to separate files mtime Set file modification time according to its metadata ugoira Convert Pixiv Ugoira to WebM using FFmpeg zip Store files in a ZIP archive

BUGS

https://github.com/mikf/gallery-dl/issues

AUTHORS

Mike Fährmann <mike_faehrmann@web.de>
and https://github.com/mikf/gallery-dl/graphs/contributors

SEE ALSO

gallery-dl(1)

2021-06-19 1.18.0