Skip to main content
Run a Scrapy spider in a disposable microVM and export only its JSON result. This example targets Books to Scrape, a public practice site. Use Playwright instead when content appears only after JavaScript runs.

Crawl a site

1

Create the spider

books_spider.py
2

Prepare Scrapy

Capture the prepared environment:
Verify the snapshot before using it:
The snapshot avoids reinstalling Scrapy for every crawl.
3

Crawl the site

The destination name must be unused. Restore installs the deny-by-default allowlist, connection cap, restricted guest profile, and lifetime bound before boot. Copy the spider into the root-owned /work directory and make it read-only before running it as the unprivileged user; no host directory is exposed.
The crawler and the microVM policy both constrain navigation to the target host. Change the spider, start URL, and network rule together when adapting the example, and respect the site’s terms and robots policy.
4

Copy out the result

Inspect the number of collected records:
Treat scraped values as untrusted data when rendering HTML, building shell commands, or exporting spreadsheets.
5

Clean up

Remove the reusable snapshot:

Reference