A selector is the rule that extracts one field. The same object is used by scrape_unblocker and, with slightly different field names, by the template selector tools.
{
"property_name": "price",
"selector": "span.product-price",
"attribute_type": "TEXT"
}property_name(string, required) — the key in the result. Append[]to collect a list instead of a single value.selector(string) — what to select. Its syntax depends onattribute_type. Optional only forURLandBODY, which select nothing.attribute_type(enum, required) — how to read the value.attribute(string) — withATTRIBUTE, the HTML attribute to read (href,src,data-id).children(Selector array) — withOBJECT, the nested selectors.
attribute_type values
Ordered by how much production actually uses them; reach for the first that fits. The list is exactly what the engine's API validator accepts; types implemented deeper in the engine but refused at the boundary are deliberately absent.
JSON— the body is parsed as JSON andselectoris a dotted path into it, e.g.data.items.price. Use it for any API response, including one found withdiscover_api_endpoints. A path that crosses an array fans out over it.TEXT— inner text of the matched element (CSS).ATTRIBUTE— an HTML attribute value, named inattribute(CSS).SCHEMA— JSON-LD and Schema.org blocks; often the cleanest product data on a page.OBJECT— group several selectors into one nested object viachildren(CSS). Children may not themselves beOBJECT.INNER_HTML— raw HTML inside the element (CSS). Works only on a[]property; on a scalar it silently returns"".NEXT_DATA— the__NEXT_DATA__payload of a Next.js page.RAW_JSON— the raw JSON string, unparsed.HEADER— a response header.URL— the page's own URL, query string included.selectornot needed.BODY— the whole response body.selectornot needed.TEXT_PLAIN— plain-text body. Same[]-only limitation asINNER_HTML.GOJA— evaluate a JavaScript expression instead of selecting.GJSON— legacy JSON path syntax; preferJSON.
What selector means, by type
This is the single most common mistake:
JSON— a dotted path such asproducts.nameordata.searchInfo.storeProductInfos.shownPrice. Not CSS.TEXT,ATTRIBUTE,INNER_HTML,OBJECT— a CSS selector.GOJA— a JavaScript expression.URL,BODY— ignored. The MCP server fills a placeholder so the engine's "non-empty selector" validation passes.
Writing CSS against a JSON response returns nothing, silently: no error, just empty fields.
Pattern 1 — single fields
"selectors": [
{ "property_name": "title", "selector": "h1", "attribute_type": "TEXT" },
{ "property_name": "price", "selector": ".price", "attribute_type": "TEXT" }
]Pattern 2 — lists with []
{
"property_name": "links[]",
"selector": "a.product-link",
"attribute_type": "ATTRIBUTE",
"attribute": "href"
}Pattern 3 — nested objects
{
"property_name": "products[]",
"selector": ".product-card",
"attribute_type": "OBJECT",
"children": [
{ "property_name": "name", "selector": ".name", "attribute_type": "TEXT" },
{ "property_name": "price", "selector": ".price", "attribute_type": "TEXT" },
{ "property_name": "url", "selector": "a", "attribute_type": "ATTRIBUTE", "attribute": "href" }
]
}Pattern 4 — a JSON endpoint
"selectors": [
{ "property_name": "name[]", "selector": "data.products.name", "attribute_type": "JSON" },
{ "property_name": "price[]", "selector": "data.products.price.value", "attribute_type": "JSON" },
{ "property_name": "total", "selector": "data.totalCount", "attribute_type": "JSON" }
]Pattern 5 — tagging rows with their URL
"selectors": [
{ "property_name": "page_url", "attribute_type": "URL" },
{ "property_name": "title", "selector": "h1", "attribute_type": "TEXT" }
]In a multi-URL scrape the result rows carry no URL of their own and their order does not reliably follow urls. One URL field is the way to know which row came from where.
Alignment of [] fields
When several [] fields select through the same array, their lists usually line up positionally, which is what lets one flat set of selectors reconstruct a list of objects. The engine does not guarantee it. A path that crosses an array appends one value per element that has the key and nothing for elements that do not; there is no placeholder, so a field missing on some records shifts every later index.
The only way to know is to compare lengths. Equal lengths mean you may zip them; unequal lengths mean the rows are already wrong. The diagnostics block reports those lengths and flags a mismatch.
If the JSON document's root is an array, the scalar form always returns "". You must use [] there.
Prefer data-* attributes and structural selectors over auto-generated class names such as css-1x2y3z, which change on every deploy. When a target is a Next.js site, NEXT_DATA and SCHEMA often give cleaner data than the rendered DOM.