If you've got some manner of tool that wants to automatically pick out DoM comics and any associated metadata, you can use this handy-dandy JSON interface which may or may not be shamelessly inspired by Randall Munroe's JSON metadata interface for XKCD!
If you want data from the most recent comic, you can find it at:
https://dementiaofmagic.net/comic.0.json
For a specific comic (by date), you can use the YYYYMMDD format in the /d/ directory, such as:
https://dementiaofmagic.net/d/20200108.0.json
That is, /d/YYYYMMDD.0.json. The most recent comic (that is, the one pointed to by comic.0.json) will also have an identical dated entry in the archives.
Note very carefully, "inspired by" is not the same as "compatible with"! The DoM's structure is rather embarrassingly still based on a literally decades-old format that KeenSpace/ComicGenesis used, while Randall Munroe's is likely cleaner. As such, you will need the nextday
and prevday
fields to navigate, and remember that imgs
is an array of potentially multiple image links.
Most of the fields should be self-explanatory, but just to be sure:
currentday
: The current comic's date. For the purposes of this documentation, the "current" comic is the one whose data is currently being viewed, not necessarily the most recent comic (see lastday
, below). This, as well as all of the *day
fields, are in YYYYMMDD format.url
: The canonical URL of the current comic in the archives.firstday
: The date of the first comic in the archive. In the DoM, this should always be 20020710, unless I've done something like inserted a before-the-start intro message or whatnot.lastday
: The date of the most recently-posted comic on the site.prevday
: The date of the comic posted before the current comic, if one exists. This will be an empty string if this is the first comic in the archive.nextday
: The date of the comic posted after the current comic, if one exists. This will be an empty string if this is the most recent comic in the archive.year
, month
, and day
: The four-digit year, two-digit month, and two-digit day of the current comic. These and currentday
are more useful when viewing comic.0.json, as you can likely derive all of those from the URL you used to get to any other data in the first place.imgs
: URLs of all the images associated with the current comic. This will be an array! The way the archive is structured, a single "comic" can consist of multiple images. If there are multiple images, they are intended to be presented vertically and centered horizontally.imgsmetadata
: URLs of all the images associated with the current comic, with additional metadata for each, if available. This will be an array! And what's more, this will be an array of object-value pairs! The image URLs in this array will be in the same order as in imgs
; this does mean imgs
may be deprecated at some point. Current fields in each array object here will be:
url
: The image URL. Will be identical to entries in imgs
.caption
(optional): A caption for this image, if there is any. Well, okay, it's more of mouseover text (for the title attribute in the <img>) than a caption, per se. Internally it's called a "caption", is all.alt
(optional): An alt-text for this image, if there is any. This is for the alt attribute in the <img>, because we all know that alt and title are different attributes with different uses.footnotes
: The contents of any footnotes associated with the current comic (that is, any text that appears after the comics, usually my face with some comment). This will also be an array! The way the archive is structured, footnotes are just arbitrary HTML (there are a lot of weird quirks to how this archiver works, as I'm sure you've gathered by now). Any <img> or <a> elements will have their src and href attributes (respectively) changed to be absolute URLs. CSS classes will be preserved on the elements, which will likely not be useful to you. Due to how I apply images in CSS on the footnotes, my face probably won't show up on your end. Footnotes are, in general, intended to be placed after the last entry in imgs
.news
: A string of data that gets pasted into the RSS feed, if needed. That is, this data doesn't appear on the website and is intended to be used to inform RSS-only readers of something that might be of interest on the website. Will be an empty string otherwise.sha256
: An SHA-256 hash of the images pointed to by imgs
, any caption and alt text for each image, and the text in all of the footnotes
. This is a single string; as such, the hash is of all the image data concatenated (with caption and alt texts added afterward, if any such text exists) plus all the footnote text concatenated. Though you could use this to... um... confirm the data matches the hash (I guess?), this is more for cache purposes; if the hash for a given date has changed, it means some part of the image data, caption, alt, or footnote text has changed and should be re-fetched. If both of imgs
and footnotes
are empty, this will indeed be a hash of no data, but that shouldn't happen.More data may occur in later revisions.