extract_structured_data
Extract structured JSON fields and page metadata from a URL using custom CSS selectors, ideal for product listings, news metadata, and schema-driven web scraping.
Instructions
Extract structured JSON — page metadata (Open Graph, canonical URL, author, dates) and/or a custom CSS-selector schema — from a website.
What it does Fetches a URL and returns a structured object. With include_metadata=true it reads Open Graph tags (og:title, og:description, og:image), the canonical URL, author, and publication/modified dates. You can also pass a schema (property name -> CSS selector) to pull specific fields (e.g. {"title": "h1", "price": ".price", "rating": "span.rating"}) into a typed object.
How to use
Use for product listings, news/metadata, schema-driven extraction, and any time you need fields instead of prose.
schema keys become the JSON keys; values are CSS selectors. Leave schema empty to get metadata only.
include_metadata (default true) adds the Open Graph / author / date block. Set false for a lean result.
mode/css_selector/headers/cookies/proxy behave exactly as in extract_web_content.
Returns JSON object with the requested fields (and/or metadata). Missing selectors are omitted rather than failing the whole call. Non-http or private URLs fail with isError: true.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | Target website URL to extract content and metadata from. | |
| mode | No | Crawl mode: 'fast' (native fetch) or 'deep' (Playwright Chromium). | fast |
| proxy | No | Optional HTTP/SOCKS5 proxy URL. | |
| schema | No | Optional key-value map of property names to CSS selectors (e.g. { title: 'h1', price: '.price' }). | |
| cookies | No | Optional custom HTTP cookies key-value dictionary. | |
| headers | No | Optional custom HTTP request headers key-value dictionary. | |
| max_retries | No | Maximum retry attempts (default: 3). | |
| css_selector | No | Optional CSS selector to scope content before processing. | |
| include_metadata | No | Whether to extract Open Graph tags, canonical URL, author, and date metadata (default: true). |