{
 "schema_version": 1,
 "generated": "2026-10-31",
 "id": "browserbase-stagehand--extract-structured-data-from-any-website",
 "repo": "browserbase/stagehand",
 "repo_url": "https://github.com/browserbase/stagehand",
 "repo_slug": "browserbase-stagehand",
 "title": "Pull structured data from a site with a schema",
 "page_title": "How to pull structured data from a site with a schema with Stagehand",
 "summary": "Use extract with a Zod or Pydantic schema to get typed data out of any page.",
 "who": "A developer who needs a table of prices, invoices or listings from a site with no API.",
 "problem": "Hand-written scrapers break whenever the page layout changes and return messy text.",
 "outcome": "Schema-validated JSON from the page, ready to save or feed into another system.",
 "steps": [
  "Install with `pnpm add @browserbasehq/stagehand 'zod@~4.4.3'` or `pip install stagehand`",
  "Launch a local browser and create a Stagehand instance with your model and API key",
  "Navigate with page.goto to the page you want",
  "Call Stagehand.extract with an instruction such as extract every invoice in the table and a schema describing the fields",
  "Use the returned data, which is validated against your schema"
 ],
 "agent_prompt": "Using browserbase/stagehand in <TypeScript or Python>, write a script that opens <url>, extracts every <item> on the page into a schema with fields <fields>, and saves the result as JSON. Read the API key from the environment.",
 "agents": [
  "claude-code",
  "codex",
  "cursor"
 ],
 "difficulty": "Beginner",
 "time": "30 minutes",
 "basis": "readme",
 "caveat": "Respect each site's terms of service and robots rules when you extract data.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "typescript",
 "requirements": [
  "Node with pnpm, Python, or Go",
  "Chrome installed for local runs",
  "A model API key such as OPENAI_API_KEY, or a Browserbase API key to use the Model Gateway"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [
  {
   "tag": "credentials",
   "notice": "You supply a model API key and every extract call costs tokens; keep keys in environment variables, not in code."
  }
 ],
 "best": true,
 "score": 1.0,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/browserbase-stagehand/extract-structured-data-from-any-website/",
 "md": "https://dedupedai.com/use-cases/browserbase-stagehand/extract-structured-data-from-any-website/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/browserbase-stagehand--extract-structured-data-from-any-website.json",
 "api_version": "v1"
}
