Recipe
This recipe shows how to extract structured data from web pages using AI without writing CSS or XPath selectors. UseextractStructuredData (TypeScript) or extract_structured_data (Python).
TypeScript
How it works
- Define a schema - Use Zod (TypeScript) or Pydantic (Python) to describe the data structure you want to extract
- Call the AI extractor - Pass the page and schema to
extractStructuredData/extract_structured_data - Get structured data - The AI analyzes the page and returns data matching your schema