generate_parser
Generates CSS selectors to extract specified fields from a webpage, then reuses them for deterministic, free scraping on pages with the same layout.
Instructions
Look at a page ONCE with an LLM and get back CSS selectors that extract the fields you asked for. Pass the returned parser as the extract argument on every later scrape of that same layout and no AI runs again — it becomes a plain, free, deterministic extraction. Use this instead of ai_prompt whenever you will scrape more than a couple of pages of the same shape. Every selector is run against the page before being returned, so report/coverage tell you which fields are actually reliable.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | The page to learn the layout from | |
| html | No | Markup you already have, instead of fetching a URL (no proxy bandwidth used) | |
| fields | No | What to extract, as { field_name: "plain-English description" } — e.g. { "price": "the product price", "specs": "every spec bullet, as a list" }. Max 25. | |
| prompt | No | Free-text alternative to `fields` — the model picks and names the fields itself | |
| render | No | Learn from the browser-rendered DOM instead of the raw HTML (needed for SPA pages) | |
| country | No | ISO country code for the proxy exit |