Skip to content
SpiffyChatterbox edited this page Aug 10, 2024 · 4 revisions

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"

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/