Blocks
Extract HTML
The extract HTML step: scrape values out of an HTML document with CSS selectors — text, markup, or attributes, single or every match.
Parse an HTML string and pull values out with CSS selectors — the scraping companion to web request.
Config
The HTML source expression plus one row per value to extract.
-
HTML source — an expression returning the HTML string — usually the upstream web request's body:
payload["body"]. -
Extractions — one row per value: a field name, a CSS selector, and a return mode:
text— the element's visible texthtml— its markupattribute— an attribute value (also set which one, e.g.href)
Add
return_array: trueon a row to collect every match as a list instead of the first.
Output
One key per extraction:
{ "title": "Acme quarterly report",
"links": ["https://…", "https://…"] }
Missing matches are null (single) or [] (with return_array).
Patterns
- Page scrape — web request → extract HTML (title, price, availability) → branch on the value.
- Link harvest — extract every
awithattribute: href+return_array→ loop over the URLs → fetch each.
Gotchas
- Selectors run against the HTML the server sent — JavaScript-rendered content isn't there. If the value only appears after scripts run, look for the site's JSON API (often visible in the page source) and use web request directly.
- Sites change their markup without notice — prefer stable anchors
(ids,
data-*attributes) over brittle positional selectors, and expectnullwhen the page shifts.