█

AI/TLDR

Buy me a coffee
Buy me a coffee

LLM Scraper

Extract structured data from any webpage using LLMs and Zod schemas

Web Scraping & CrawlingOpen source
Language
TypeScript
$npm i zod playwright llm-scraper
IN SHORT

What is LLM Scraper?

LLM Scraper is a TypeScript library for pulling structured data out of any webpage. You define the shape of the data you want with a Zod or JSON schema, point it at a live page, and an LLM fills in the values. It sits in the Web Scraping & Crawling category of the Data & Labeling tools and is open-source, written in TypeScript.

Overview

LLM Scraper is a TypeScript library for pulling structured data out of any webpage. You define the shape of the data you want with a Zod or JSON schema, point it at a live page, and an LLM fills in the values. The result is fully typed, so you get the same fields you described in your schema.

It is built for developers who already work with Node and TypeScript and want to avoid writing brittle CSS selectors or XPath rules that break when a site changes its markup. Instead of describing how to find each value, you describe what you want, and the model reads the page for you.

Within the web scraping and crawling space, it sits on top of Playwright for loading pages and the Vercel AI SDK for talking to models, so it works with OpenAI, Anthropic, Google, Groq, Ollama, and other supported providers.

What it does

  • Define output with Zod or plain JSON Schema and get full TypeScript type-safety
  • Works with GPT, Sonnet, Gemini, Llama, and Qwen model series through the Vercel AI SDK
  • Built on Playwright, so it drives a real browser to load pages
  • Six input formatting modes: html, raw_html, markdown, text, image, and custom
  • Stream partial objects as the model extracts them via the stream() method
  • Generate a reusable Playwright scraping script from a schema with generate()

Getting started

Install the library with Playwright and Zod, pick an LLM provider, then run a scraper against a page.

Install dependencies

Install the core library together with Zod and Playwright from npm.

bashbash
npm i zod playwright llm-scraper

Initialize an LLM provider

Install a provider package and create a model instance. This example uses OpenAI.

bashbash
npm i @ai-sdk/openai

Create a scraper and extract data

Launch a browser, open a page, define a schema, and run the scraper to get typed data back.

tsts
import { chromium } from 'playwright'
import { z } from 'zod'
import { Output } from 'ai'
import { openai } from '@ai-sdk/openai'
import LLMScraper from 'llm-scraper'

const browser = await chromium.launch()
const llm = openai('gpt-4o')
const scraper = new LLMScraper(llm)

const page = await browser.newPage()
await page.goto('https://news.ycombinator.com')

const schema = z.object({
  top: z
    .array(
      z.object({
        title: z.string(),
        points: z.number(),
        by: z.string(),
        commentsURL: z.string(),
      })
    )
    .length(5)
    .describe('Top 5 stories on Hacker News'),
})

const { data } = await scraper.run(page, Output.object({ schema }), {
  format: 'html',
})

console.log(data.top)

await page.close()
await browser.close()

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Turn a list page, like Hacker News front page or a search results page, into a typed array of records
  • Collect product, listing, or article fields from sites that change their markup often and break selector-based scrapers
  • Stream large extractions and show partial results as the model fills in the schema
  • Generate a reusable Playwright script once, then run it repeatedly without calling the model each time

How LLM Scraper compares

LLM Scraper alongside other open-source web scraping & crawling tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
Firecrawl★ 214kA crawling service and API that converts whole websites into clean Markdown or structured JSON ready for LLMs.
Agent Reach★ 116kA capability layer that installs, health-checks and routes readers so a CLI agent can read and search web pages, YouTube, RSS, GitHub, Reddit, Twitter/X and more without API fees.
Scrapling★ 107kA Python web scraping framework whose parser relocates your elements when pages change, with stealthy fetchers and a Scrapy-like spider engine for full crawls.
Crawl4AI★ 88.2kA local-first Python web crawler that turns pages into clean Markdown for use in RAG and LLM pipelines.
Scrapy★ 65.7kA mature Python framework for writing fast spiders that crawl websites and extract structured data at scale.
changedetection.io★ 36.1kA self-hosted web page change monitor with XPath/CSS/jq filters, browser steps and restock alerts, which can route every diff through an LLM to suppress noise.
ScrapeGraphAI★ 33kA Python library that uses LLMs and a graph pipeline to extract data from pages based on natural-language prompts.
LLM Scraper★ 7kExtract structured data from any webpage using LLMs and Zod schemas