Gallery-dl tutorial
Welcome fellow passengers of The Ride™ to our very first tutorial! Sick of clicking through every image of a comic on DeviantArt, Twitter, or Tumblr just to save them? Then this tutorial’s for you! The images here might be a bit small so click on them to zoom in. For additional info, check out gallery-dl’s website.
Installing Gallery-dl
Linux
Ubuntu users can use the snap package:
snap install gallery-dl
Alternatively, install it through pip:
sudo apt update
sudo apt install python3-pip
pip install gallery-dl
Make sure to set your path variables so you can see it. Something like:
export PATH=$PATH:${HOME}/.local/bin
Mac
If you don’t already have brew installed, paste this into the Terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then install gallery-dl:
brew install gallery-dl
Windows
First, you’ll need to install the Microsoft Visual C++ Redistributable Package if you don’t already have it. Then go to this link and download the latest prebuilt file. Place that file in your user directory (i.e., C:\Users\your_username) as shown below. Test it works by opening the command line (Windows key, then “cmd” should find it) and typing/pasting:
gallery-dl.exe --version
You should get the version shown below (although with a far less Sonknux-centric background no doubt):
Configuration
Want to have your files saved in a neat, date-first format? Want to download NSFW content from sites that require you to be logged in to view it? These things are all set in the configuration file. You can download my (censored) copy here. You’ll need to add your own credentials to make it work, but for now you can replace "xxxxxx"
with null
(the quotes are necessary for the xxxxxx, but not the null).
Windows users:
Place it in your home directory as shown in the image above, renaming it to: gallery-dl.conf
Linux and Mac users:
Place it here: ~/.config/gallery-dl/
CMD+SHIFT+G in Finder will allow you to type this in.
Running gallery-dl
In Windows type/paste the following into the command prompt:
gallery-dl.exe --write-metadata deviantart.com/knockabiller
The --write-metadata
part is only if you’re interested in things like image descriptions. You can just remove it if you don’t want that. The last part is just the URL of the account you want to archive.
It’s the same procedure in Linux and Mac, just don’t include the “.exe”:
gallery-dl deviantart.com/knockabiller
Now you’ll notice it’s having trouble with DeviantArt (see image above). That’s because if you don’t use your own account, it will fallback on the account all gallery-dl users will use.
Getting DeviantArt to work
So you’ve added your Twitter, Newgrounds, etc account details but want to add DeviantArt. It’s a lot more involved, but have no fear, I’ve got instructions with pictures! There’s more detail here, but what you’ll want to do is go to the Your Applications & Keys section of your account and click “Register your Application”:
Scroll to “OAuth2 Redirect URI Whitelist (Required)” and enter "https://mikf.github.io/gallery-dl/oauth-redirect.html" without the quotes:
Scroll to the bottom and agree to the API License Agreement. Submission Policy, and Terms of Service. Then click “Save”.
Finally Copy client_id
and client_secret
of your new application and put them in your configuration file as “client-id” and “client-secret”:
To enable access, you’ll need to get a new refresh-token for the new client-id:
gallery-dl.exe oauth:deviantart
If things mess up, you can clear your cache and try again:
gallery-dl.exe --clear-cache deviantart
gallery-dl.exe oauth:deviantart
Running oauth:deviantart
will open your web browser, where you can authorize access:
Other sites like Tumblr have a simpler procedure, which can be found here.
Metadata files
Downloaded all those metadata files and hate them cluttering up your folders? The following code will put them into metadata subfolders:
find . -not -path "*metadata*" -name "*.json" | while read file; do mkdir -p "${file%\/*}/metadata/" & mv "$file" "${file%\/*}/metadata/";done
Note: this will only work on Mac and Linux, and sometimes has issues with certain filenames. Make sure you’re in your gallery-dl folder before running!
And that’s it, happy archiving fellow Ride™ passengers!