Downloading webcomics with Dosage

20 May 2024 in Odds and Ends

I’ve been reading some webcomics for a few years, but never went back to the beginning to learn how each character was introduced. I liked the idea, but with 5000+ posts in some feeds, I constantly lost my position and/or had better things to do.

I recently spent some time on holiday and decided to try and copy the whole series on to my iPad to read. I intended to write a small app to download a series and convert to a .cbz file, but it turns out it already exists.

Dosage

Dosage is a Python CLI designed to download webcomics in to a folder. I always have issues installing Python apps, so I looked to see if Dosage was available as a Docker image. It wasn’t, but it wasn’t too difficult to package up.

If you want to do the same, create a Dockerfile with the following contents:

docker
FROM python:bullseye
# Install pipx
RUN python3 -m pip install --user pipx \
&& python3 -m pipx ensurepath
# Install dosage
RUN /root/.local/bin/pipx install "dosage[css,bash] @ git+https://github.com/webcomics/dosage.git"
ENTRYPOINT ["/root/.local/bin/dosage"]

Build the image (you don’t need to clone the Dosage repo - the Dockerfile will do it for you):

bash
docker build -t dosage .

Then finally, add an alias for the a dosage command. This is optional, but encouraged:

bash
alias dosage='docker run --rm -v $(pwd):/Comics dosage:latest'

Finally, run dosage to download the comic of your choice:

bash
dosage --list
dosage -a TheOrderOfTheStick

Create a CBZ

A .cbz file is a renamed zip file. To create one:

bash
zip -r oots.cbz TheOrderOfTheStick/*

Now you can copy the .cbz in to the comic app of your choice.