extract_by_selector
Extract custom data from web pages using CSS selectors. Define field mappings to capture text or attributes, and use row selectors to turn lists into structured tables, saving results as needed.
Instructions
Extract arbitrary fields from pages using CSS selectors — the general case the fixed extractors do not cover. fields maps output column names to selectors, e.g. {"name": "h1", "price": ".price"}. Set row_selector when a page holds a list: each match becomes a row and the field selectors resolve inside it, which turns a listing into a table. Suffix a selector with @attr to read an attribute instead of text — "a@href" gives the link, resolved to an absolute URL. Pass save_as to store the rows; add mode='append' when batching.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | replace | |
| urls | Yes | ||
| fields | Yes | ||
| save_as | No | ||
| js_render | No | ||
| row_selector | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |