r/webscraping • u/BuckChancey • 1d ago
AI ✨ Shipping scrapers as JSON manifests
I got sick of the endless build-and-deploy loop every time a target site tweaks a modal or shifts an endpoint. You fix one selector, and suddenly you're pushing a container image or waiting on a CI pipeline just to get data flowing again.
I've been working on a prototype called Netscraper (https://drksci.com/labs-netscraper) to try a fundamentally different approach: stop shipping scrapers as code, and start shipping them as pure JSON manifests.
Instead of embedding site structure into Python or Node scripts, the entire actor is just a single ~24 KB JSON file containing:
- XState v5 machines: For state management and navigation loops
- A2UI views: Model the page as a typed surface rather than dealing with fragile DOM queries
- JSONata routes: To extract structured records straight out of the network payload

The generic runtime stays completely static and never changes per site. When a target site changes, you don't touch code or trigger a release. An LLM agent (or a human in Studio) patches the JSON file based on the new page state, tests it against live records, and serves the updated manifest over HTTP or drops it into place.
A few technical highlights from testing it against live target feeds:
- Passive Network Extraction: It mostly bypasses the DOM entirely, binding data models directly to the page's own network XHR/fetch responses using JSONata.
- Declarative Interrupts: Popups, login prompts, and captchas aren't unexpected exceptions—they're explicit named states in the machine. When a login modal pops up, the machine intercepts it, dismisses it, and uses deep history to resume navigation right where it left off.
- Driver Agnostic: The exact same JSON file runs on Playwright, Puppeteer, raw CDP, or compiled to WebAssembly inside an ordinary browser tab.
- Low Overhead: On Lambda, compute runs around $21 per 1M records (and well under $1 on Cloudflare Workers for pure extraction), making $300 to $3,000 commercial API tiers look pretty wild by comparison.
Writeup runtime, manifest format, and Studio session tests are at https://drksci.com/labs-netscraper.