Element Paths - ZornTaov/ZC-ComicUpdater GitHub Wiki
The XPaths that find a page's comic image, next link and first-page link, and how to add your own (for exit code 3, a redesign, or several pages on one address).
Each list is tried in order until one matches; the winner is remembered per comic and tried first next
time. The first list is only used by a walk to get back to page 1. The scripts ship a short generic set in
comiclib/elements.py, mainly as examples; most libraries add a few of their own.
| List | Shipped paths |
|---|---|
image |
inside id="comic" (most WordPress comic themes); img#cc-comic (ComicControl); an image whose id is comic-image, comicimage or comic_image; inside an element with class comic; an image with alt Comic
|
next |
a[rel="next"]; class cc-next (ComicControl); comic-nav-next (Comic Easel); navi-next (ComicPress); a link whose text starts "next"; a picture button with alt starting "next" |
first |
rel="first"; ComicPress and Comic Easel first-link classes; title or alt First; a link whose text says "first"; a picture button whose image name contains "first" |
-
See what matches. On The Web Page, open Element paths, paste a mid-comic page address (not the newest) and press Check this page. If image and next both match, you are done. (The first-page match only matters for a comic walked from a later page.)

-
Take a suggestion. With no match it suggests paths from the page's images and links, each with add it; the first is usually right, and lands at the top of its list noted with the site's name.

-
Or write one. In your browser, Inspect the comic and look for an
idorclassthat names it. Test in the console with$x('//img[@id="strip"]'). -
Save, then run the comic or check again.
Without the web page, python mirror_base.py --check "https://example.com/comic/some-page" does the same,
saving nothing.
-
Image paths end on the
<img>, whosesrcis saved://*[@id="comic"]//img, not//*[@id="comic"]. -
Use
ids andclasses, not positions://div[@id="strip"]/imgsurvives a redesign; Copy XPath's/html/body/div[3]/div[1]/imgdoes not. -
Keep next paths to
<a>: a<link rel="next">matches too but goes nowhere. Next links to another site are never followed. - Order matters: the first match wins, so put comic-specific paths above general ones (drag the handle or use the arrows).
- Note what it is for, usually the comic's name; it is the only record of why it is there.
--check runs JavaScript; a scrape does not (pages load faster). So --check compares what the browser
found with what the server sent, and says when JavaScript is the difference:
image: 1 of the known paths match; a scrape would use //*[@id="content"]/img
that image is not in the page the server sends, only in the one javascript builds, so this comic
needs javascript as well as the path: -ej, or "javascript": true in its settings.
A run that finds no image says the same from its side.
The web page writes config/element_paths.json; editing by hand works too:
{
"image": [{ "xpath": "//img[@class=\"strip-art\"]", "note": "Odd Comic", "enabled": true }],
"next": [{ "xpath": "//*[@class=\"onwards\"]", "note": "Odd Comic", "enabled": true }],
"first": [{ "xpath": "//a[@class=\"to-start\"]", "note": "Odd Comic", "enabled": true }]
}- The file sets order and what is off. Shipped paths it omits are tried after it, so new shipped paths still arrive; they can be turned off but not deleted, so an update cannot quietly bring one back.
- An unreadable file is reported and ignored.
- It is looked for in the config folder, then the starting folder, then beside the script;
MIRROR_ELEMENTSnames it outright. - Site-specific paths belong here, not in the code.
Some comics switch to serving a scroll of pages, or six, per address; saving only the image would silently lose most of them. So every image the path matches is saved in order, numbered on from the last:
Unnumbered matches (back/next buttons, an RSS icon) are dropped, and the run says so; if none are numbered,
all are kept. --check reports it up front (that path finds 14 images here, 14 of them pages), and a run
logs the first time it happens:
https://example.com/comic/270 holds 6 pages of the comic where every address so far held one, so this
comic has started putting several pages on one address. Each is saved in turn, numbered on from the last.
state records pages_per_url and multi_page_from, and the index gets a line per page, so chapters still
align. --no-multi-page takes one page per address and is remembered in the comic's settings. Use a path
scoped to the container (//*[@id="pages"]/img); --check suggests one for images with no id, class or alt.