Table of Contents
Username & Password
Some extractors require you to provide valid login credentials in the form of a username & password pair. This is necessary for nijie and optional for aryion, danbooru, e621, exhentai, idolcomplex, imgbb, inkbunny, mangadex, mangoxo, pillowfort, sankaku, subscribestar, tapas, tsumino, twitter, and zerochan.
You can set the necessary information in your configuration file.
{ "extractor": { "twitter": { "username": "<username>", "password": "<password>" } } }
or you can provide them directly via the -u/--username and -p/--password or via the -o/--option command-line options
gallery-dl -u "<username>" -p "<password>" "URL" gallery-dl -o "username=<username>" -o "password=<password>" "URL"
Cookies
For sites where login with username & password is not possible due to CAPTCHA or similar, or has not been implemented yet, you can use the cookies from a browser login session and input them into gallery-dl.
This can be done via the cookies option in your configuration file by specifying
- the path to a Mozilla/Netscape format cookies.txt file exported by a browser addon (e.g. Get cookies.txt LOCALLY for Chrome, Export Cookies for Firefox)
- a list of name-value pairs gathered from your browser's web developer tools (in Chrome, in Firefox)
- the name of a browser to extract cookies from (supported browsers are Chromium-based ones, Firefox, and Safari)
For example:
{ "extractor": { "instagram": { "cookies": "$HOME/path/to/cookies.txt" }, "patreon": { "cookies": { "session_id": "K1T57EKu19TR49C51CDjOJoXNQLF7VbdVOiBrC9ye0a" } }, "twitter": { "cookies": ["firefox"] } } }
You can also specify a cookies.txt file with the --cookies command-line option or a browser to extract cookies from with --cookies-from-browser:
gallery-dl --cookies "$HOME/path/to/cookies.txt" "URL" gallery-dl --cookies-from-browser firefox "URL"
User-Agent Strings
Some sites verify you by ensuring your cookies align with your user-agent string. This means that whatever browser you use to connect and get your cookies must align to your configuration for gallery-dl. This also means you need to keep your user-agent string updated when your browser updates.
Doing this is easy - use whatever browser you use to extract your Cookies and do an internet search for "what is my user agent string". Some search engines will give it to you immediately, others you'll need to go to a site like https://whatmyuseragent.com/ or https://www.whatismybrowser.com/detect/what-is-my-user-agent/
Then copy your entire user-agent string to your gallery-dl.conf file.
"user-agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:145.0) Gecko/20100101 Firefox/145.0",
If you use the sample config, there's already a line in the "extractor" section for this. If you use different browsers for different sites, you can also set a different user agent for each extractor.
"kemonoparty":
{
"cookies":["firefox", "Private"],
"user-agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:145.0) Gecko/20100101 Firefox/145.0"
},
OAuth
gallery-dl supports user authentication via OAuth for some extractors. This is necessary for pixiv and optional for deviantart, flickr, reddit, smugmug, tumblr, and mastodon instances.
Linking your account to gallery-dl grants it the ability to issue requests on your account's behalf and enables it to access resources which would otherwise be unavailable to a public user.
To do so, start by invoking it with 1oauth:1 as an argument. For example:
gallery-dl oauth:flickr
You will be sent to the site's authorization page and asked to grant read access to gallery-dl. Authorize it and you will be shown one or more "tokens", which should be added to your configuration file.
To authenticate with a mastodon instance, run gallery-dl with oauth:mastodon:<instance> as argument. For example:
gallery-dl oauth:mastodon:pawoo.net gallery-dl oauth:mastodon:https://mastodon.social/
gallery-dl: user's wiki