>_ dev.tapun.site

shotbot

Python · latest v0.4.1 · updated

Scheduled screenshots of web dashboards with headless Chromium.

shotbot opens a set of pages in headless Chromium on a schedule, takes screenshots of selected elements and posts them somewhere only when they actually changed. I use it for a couple of game stats dashboards and for watching a few status pages.

How it works

  1. One long-lived browser, one context per job, pages are reused between runs.
  2. Each job waits for a CSS selector, optionally hides elements (cookie banners, clocks) and crops to the target element.
  3. A perceptual hash is compared with the previous run; below the threshold nothing is posted.

Job file

[[job]]
name     = "weekly-stats"
url      = "https://example.org/dashboard"
selector = "#stats"
hide     = [".cookie-banner", "#clock"]
every    = "30m"
post_to  = "discord:stats"
threshold = 6

Running on a small VPS

Chromium is the heavy part. On a 2 GB machine the following keeps it stable:

--disable-dev-shm-usage --no-zygote --renderer-process-limit=2

and a systemd unit with MemoryMax=900M plus Restart=on-failure, so a runaway renderer takes down only the bot and not the box.

Changes