Do you never miss a new strip from xkcd? Read webcomics regularly? Or would you like to back up all the strips of your favorite website? Hopefully, the open source community has the solution: a command line program to download all your favorite webcomics from your terminal.
Before we begin, remember that you should keep these downloaded strips for your personal use, and not broadcast them without permission. If you really like an author's work, support the comic by donating or buying some of the merchandise.
Install Dosage on Linux
The open source program to download webcomics is called dosage. There are a couple of ways to install this webcomic downloader on your machine since it is written in Python. Today we will go with an easy way.
First, you will need to install pip. Also, make sure that you have at least Python 2.7.0 or Python 3.3 installed. Then use pip to install dosage as follows.
If pip cannot somehow find the package (like on Ubuntu 14.04), use the following command instead.
dosage will automatically create a new folder called "Comics" in your home directory.
Basic Usage of Dosage
dosage's basic usage can be described as follows. Using dosage, you can find webcomics in the database that you are interested in reading, download the strips, and easily fetch the latest strips as they come out. In a sense, you more or less subscribe to a webcomic, and dosage will take care of making sure that you never miss any unread strips.
To start downloading and reading offline your webcomics, begin by listing them with the command:
Right now, dosage has over 2000 comics in its database. My personal tip is if you are looking for a particular webcomic, use the syntax:
It will then return all the comics with title containing [keyword].
Once you decided which comic you wanted to subscribe to from the list, use this command to subsribe to the comic:
Subscribing to a comic will automatically create a folder in the "Comics" directory, and download the latest strip of that webcomic.
If instead of downloading just the latest strip, you are interested in all the issues, use this command:
Finally, once you subscribed to a couple of webcomics, you can easily download the latest strip of all of them in one shot with the simple command below:
If you never want to miss your daily comics for example, you should run this command every day.
Advanced Usage of Dosage
Past the first day playing around with dosage, you might want to get the most out of it. It entails knowing a bit more about the command's syntax and shortcuts.
If you tried to download some xkcd strips, you might have noticed that dosage refuses with the message:
use the --adult option to confirm your age
Because by default dosage will ignore any webcomic flagged for people over 18 (and for some reason xkcd is one of them). To bypass that, just do as it says:
From a previous example, you may have noticed that the argument '@' is used to refer to all downloaded comics. A continuation is '@@' for all comics in dosage database.
The above command will download the latest strip of every comic that dosage knows about.
If you want to fetch the strips from the beginning of the series up to a particular day, you can do:
For example, to see all of Calvin and Hobbes' strips from 2014 until its creation, run:
Finally for all the developers out there who would like to do something of these strips for your personal use, dosage integrates the possibility of generating rss, json, and html log files while downloading strips:
In the above command, [type] is either rss, json, or html, and [name of the comic] can also be just '@'. For example, the "html" argument will create a nice HTML code to see all the strips downloaded:
The command below will download all the strips for Calvin and Hobbes, and then spit out an HTML code to view in your web browser all the strips in a nice webpage format.
To conclude, I invite you to read the manual page for more information. dosage is a really neat tool, and I know that it will be of great use to any fans of webcomics out there. I'm very curious to know what can come out of the fancier options like creating a json file out of downloaded strips.
Do you have an alternative to dosage? Or are you actually a fan of the latter and use it regularly? Let us know in the comments.
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Adrien Brochard (see all)
- What are the best plugins to increase productivity on Emacs - December 24, 2015
- What is a good IDE for R on Linux - October 11, 2015
- How to automatically dim your screen on Linux - September 1, 2015