Koryo Kakinoki
← All projectsAutomation

Scheduled Web Automation Pipeline

Python pipeline that drives a legacy web portal with no public API. A Playwright headless browser handles session login, DOM scraping and form submission; runs are triggered either by a Japanese-holiday-aware scheduler or on demand via an HMAC-verified LINE webhook. Every run reports to LINE and email, and captures a screenshot on failure.

Some systems worth automating have no API at all. This one drives a legacy public web portal the only way available — a real browser, driven headlessly by Playwright: session login, DOM scraping to read current state, then filling and submitting the form.

Two things trigger a run. A scheduler that understands the Japanese calendar, so it skips weekends and public holidays instead of firing pointlessly; and a chat command, handled by a small Flask webhook that verifies the LINE signature via HMAC before it will execute anything. An endpoint that runs a browser on request is exactly the kind of thing that must not accept unsigned input.

Every run reports to two channels — LINE push with per-target routing, and an SMTP email — because a silent automation is indistinguishable from a broken one. On failure the browser captures a screenshot before exiting, so the log says not just that the run failed but what the page actually looked like at that moment. That single habit turned most debugging from guesswork into reading.

Roughly 5,700 lines of Python. Nothing about it is clever; it is mostly the unglamorous work of making a brittle integration observable and safe to leave running unattended.

Stack

PythonPlaywrightWeb ScrapingLINE Messaging APIFlaskScheduling
Scheduled Web Automation Pipeline — screenshot 1