Call a scraper from a flow or a script
A published scraper is a callable, like a script. Drop it into a flow as a step and set its inputs, or call it from code with one line — scraper.run("shop_products", {"category": "2"}) — and get its rows back. Both always run the published version, and the run appears under its caller on the Runs page.
- Add a scraper step to a flow and set its inputs
- Call a scraper from code in Python, TypeScript, JavaScript, C and C++
- Read the result: rows, count, doubts and notFound
- Handle a scraper’s errors and timeouts
A scraper as a step
In a flow, + → AI Scraper lists only published scrapers. The step’s sheet lists the scraper’s declared inputs under Inputs, filled like any other step’s, with Step timeout and Open scraper in the middle and Test step in the header. Its output is the rows, ready for a loop or a SQL step after it.
What the step returns
The step’s output is { rows, count, runId, downloadPath, doubts, validation }, plus notFound: true when the input matched nothing: read nodes.<name>.output.rows in a loop, or nodes.<name>.output.count in a condition. validation carries the test outcome when the scraper has tests (a run that only warned still succeeds). When the result is larger than 5 MB it is stored outside the run, rows is empty and downloadPath says where to get it. A Step timeout bounds the step alone: past it, the scraper run is cancelled and the step fails with timeout, which an On error step can catch.
In the flow file, the step references the scraper by id; its name is only a readable hint.
collect:
kind: aiScraper
label: Collect products
scraper: 0f1c2d3e-4a5b-6c7d-8e9f-0a1b2c3d4e5f
scraperName: shop_products
timeoutMs: 120000
inputs:
category: nodes.flow_inputs.category
next: each_productCall it from code
The path is the scraper’s folders and name ("dir/sub/name"), each written exactly as shown or in its URL form — lowercase, accents dropped, spaces become - — or the scraper’s id. Inputs are checked against what the published version declares — text, number or date.
from waiso import scraper
def main(category: str = "2"):
res = scraper.run("shop_products", {"category": category}, timeout=120)
if res.not_found:
return []
print(f"{res.count} rows, doubts: {res.doubts}")
return res.rowsStart now, collect later
runwaits for the rows. It never outlives the calling script: past its timeout (or the script’s own remaining time) the scraper run is cancelled and atimeouterror is raised.run_async/runAsyncreturns a run id at once;statusreads its state without blocking;waitcollects the rows, obeying only its own timeout and never cancelling the run.
The result and errors
rows— the rows; when a large result was stored outside the run, only its first rows (at most 100), withtruncatedtrue anddownloadPathto download the whole result;count— how many in total.doubts— fields or steps the build was unsure of,[]when clean. Check it before trusting the rows.notFound— the input matched nothing;rowsis empty and this is an answer, not a failure.
Errors carry a stable code: scraper_not_found, scraper_not_published, scraper_failed, validation_failed (a blocking test failed on the rows), credit_exhausted, timeout and cancelled, plus the run id when a run exists. In a flow, publish and run refuse a step pointing at a scraper that is gone or unpublished.