LLM-Powered Data Extraction From Unstructured Web Pages
Small models beat big ones when you clean the input first.

The AI part of web scraping got solved somewhere in the last couple years. The hard part now is the same hard part it's always been: getting the page to load. A model that writes flawless extraction code is useless if the page it's pointed at never makes it past a Cloudflare challenge or renders as three lines of blank JavaScript scaffolding. Production teams have quietly figured out that the tool which fetches the page and hands back consistent, LLM-ready output wins, full stop, and parsing accuracy is the thing you worry about second. Since over 70% of modern websites use JavaScript frameworks like React, Next.js, or Vue, full JavaScript rendering isn't a nice-to-have anymore, it's table stakes. Every section below picks apart one layer of that pipeline, in the order data actually flows through it.
What raw HTML costs you in tokens, and why clean Markdown is the right input format
A February 2026 paper out of Cairo University, the AXE study, found that pairing a small 0.6-billion-parameter model with smart DOM pruning cut input tokens by 97.9% and didn't hurt extraction quality one bit. Sit with that number for a second. It means the bottleneck everyone assumed was model size was actually input prep the whole time. You don't need a bigger model. You need a cleaner page.
Raw HTML is close to the worst thing you can feed an LLM. Every <div class="wrapper-outer-flex-2"> is a token, and none of those tokens carry meaning the model can use. Feeding a model enough markup soup makes chunking for RAG fall apart too, because the chunk boundaries end up splitting mid-tag instead of mid-idea.
The right format depends on the job:
Markdown keeps headings and lists intact, which gives the model a map of the document's structure, and it does that without the token bloat of HTML. Good for reading and summarizing. JSON is the pick when you need typed, named fields going into a database, an agent's tool call, or anything schema-validated downstream. Plain text is fine when there's barely any structure worth preserving anyway.
Inside Markdown itself there's a further split: raw_markdown, which keeps the entire page, and fit_markdown, which strips the nav bars, cookie banners, and footer link farms and leaves just the content that matters. If you're paying per token (and who isn't), fit_markdown is almost always the smarter buy.
The 2025 NEXT-EVAL benchmark backs this up directly: LLMs cleared F1 scores above 0.95 on structured web extraction, but only once the input was properly formatted first. If the same model is fed garbage, the score collapses. Extraction accuracy isn't the bottleneck anymore. Input formatting is.
The four categories of AI extraction tooling and what each one actually handles
Not every tool that calls itself an "AI scraper" is solving the same problem, and treating them as interchangeable is how teams end up picking the wrong layer for their job. There are really four distinct categories here, and knowing which one you're shopping for saves a lot of wasted integration time.
Prompt and LLM extraction lets a developer describe the fields they want in plain language or a schema, and the model hands back structured JSON with no CSS selectors involved. ScrapeGraphAI works this way.
Agentic scraping goes a step further: you hand a browser agent a goal in natural language, and it executes a multi-step task on its own, logging in, clicking through, navigating menus. Tools like Browser Use and Skyvern live here.
AI-native integration wires scraping into an existing AI assistant or coding agent, usually through something like MCP, an agent skill, or a CLI, so the model gets live web access as one of its available tools rather than a separate step.
LLM-ready fetching is the layer underneath all of it: the part that actually renders JavaScript, strips the junk, and hands back clean Markdown or JSON. This is where open-source crawlers and managed scraping APIs do their work.
AI got rid of the need to write brittle CSS selectors, but it did nothing to remove the need to fetch the page in the first place. Something, somewhere, still has to get past the anti-bot wall before any model reads a single word. A tool that's brilliant at extraction but has zero defense against bot detection is only as strong as whatever fetch layer you bolt onto it.
How each major tool handles the pipeline: fetch, render, clean, extract
Three questions decide whether a tool earns a spot in a production pipeline: can it actually fetch the page, is the output ready for an LLM without extra cleanup, and does it hold up at scale. Running each tool through that filter makes the picture a lot clearer.
ScrapeGraphAI leans into prompt-based extraction, useful for pages where meaning matters more than markup. It takes a URL, raw HTML, or Markdown as input, supports an output schema so results stay consistent run to run, and can return JSON or Markdown. It also supports async execution for running jobs concurrently. Because every extraction is an LLM call, cost and latency both climb as volume goes up. It's built for targeted, precise extraction jobs, not for crawling ten thousand pages overnight.
ScraperAPI takes a different approach entirely, handling proxy-managed fetching at a price that starts around $0.00049 per scrape and drops below $0.000095 at higher volume. It's not trying to do extraction. It's built to get the page reliably and hand the extraction problem to whatever you plug in downstream.
Benchmarks determine which claims here hold up against independent testing, as shown by Firecrawl's public scrape-content-dataset-v1, run against 819 URLs with labeled ground truth. In that specific test, a tool called fastCRW posted 63.74% truth-recall, the highest mark recorded in that particular benchmark. Benchmark performance shifts depending on the sites tested and how "truth" gets defined, so numbers like that should be checked against your own use case rather than taken as gospel.
The bigger decision underneath all of this: managed API or open-source library? A managed scraping API absorbs the browser management, the proxy rotation, and the retry logic, so a team gets data without staffing someone to babysit infrastructure. A library hands over more control, but that control comes with a bill: someone on the team now owns runtime maintenance and has to keep patching anti-bot workarounds as sites change their defenses. Neither choice is wrong. It's a trade of control for maintenance burden, and the right answer depends on how big the team is and how much time it has to spend fighting bot detection instead of shipping product. For most teams that need reliability without building an infrastructure practice from scratch, a unified scraping API that handles search, crawl, and monitoring behind one endpoint tends to be the pragmatic choice.
Schema-constrained extraction versus prompt-based extraction: when each approach fits
Two philosophies compete for the same job here, and picking the wrong one is an easy way to burn money for no reason.
Schema-constrained extraction has the developer define the expected fields and types up front. The model's job shrinks down to mapping page content onto that schema. Costs stay predictable, validation gets simpler, and everything downstream knows what shape to expect. This is the right call for pages that repeat a known structure at scale: product listings, job postings, news articles, anything where a page far down the sequence looks basically like page number one.
Prompt-based extraction flips that around. The developer describes what they want in plain language, and the model figures out how to find it regardless of how the page is laid out. This earns its keep on messy, inconsistent sources, and the textbook case is pulling contact details off thousands of company "About Us" pages, where no two companies structure that page the same way and building a selector for each one would take forever.
For high-volume, predictable sources like an e-commerce product feed, old-fashioned CSS or XPath selectors still beat an LLM call on cost, every single time. There's no reason to burn a model's compute reading a product price when a selector grabs it in milliseconds for free. The smart production setup mixes both: selectors for the stable, high-volume fields, LLM extraction for fields where the model must interpret meaning rather than rely on markup, and both running side by side when a workflow needs predictable cost alongside flexible extraction. That hybrid framing is how ScrapeGraphAI positions its own tool, for what it's worth.
None of this erases the engineering work. Reliable fetching, schema validation, retries, and monitoring against the live source page are still required no matter which extraction method wins out. The LLM doesn't remove that work, it just relocates it, usually from "writing selectors" to "watching for silent failures."
Building the four-step pipeline: URL input, HTML retrieval, Markdown conversion, LLM ingestion
Every extraction pipeline that actually holds up in production runs the same four steps: URL input, fetch and render, clean and convert, then LLM ingestion. Skipping a step or half-building one causes the whole chain to buckle somewhere downstream, usually at 2am, usually right before a demo.
Step one is URL routing, and before anything gets fetched, the pipeline needs to know what kind of page it's dealing with: plain static HTML, something rendered dynamically through client-side scripting, or something sitting behind a login wall or bot detection. Static pages are cheap to grab. JS-heavy pages need a real headless browser. Protected pages need proxy rotation and some attention paid to browser fingerprinting, or the request gets flagged before it even loads.
Step two is fetch and render, and this step just got a lot more consequential. Starting September 15, 2026, Cloudflare's default settings began blocking "mixed-use" crawlers, bots that scrape for training purposes but also serve other functions, from ad-carrying pages unless the site owner manually opts back in. That policy didn't come out of nowhere: by early June 2026, bots made up 57.4% of all traffic to HTML content across Cloudflare's network, and training-related crawlers accounted for 50.6% of total network traffic, dwarfing the 10.7% coming from search-related bots. The practical fallout: a crawler that doesn't clearly declare what it's doing is going to get blocked by default on a growing chunk of the web, whether or not that was ever the intent.
Step three is clean and convert. Strip out the scripts, the nav bars, the ad slots, the footer boilerplate, all of it, and this is exactly where that 97.9% token reduction from stripping boilerplate HTML comes from. Convert what's left to fit_markdown for reading and summarization jobs, or emit structured JSON if the thing consuming the output downstream is a database or a typed API. A long page that isn't chunked deliberately can quietly trigger multiple LLM calls where one would've done, and nobody notices until the bill shows up.
Step four is ingestion and checking content against the schema before the content ever reaches the model, and checking it again on the way out the other side. Build in retries and fallback paths, because a blocked request or a failed fetch should throw an error, not quietly hand back an empty JSON object that looks like a valid result until someone downstream wonders why every field is null. And keep monitoring against the live source page, since layouts drift, sites redesign, and a cached extraction that was accurate last month can go stale without any obvious signal that it happened.
Stitch all four steps together under one roof, one API call handling fetch, render, clean, and structured output together, and the number of moving parts a team has to babysit drops fast. That's the real argument for managed web data infrastructure over a pile of duct-taped-together libraries: not that the libraries are bad, but that every extra moving part is one more thing that breaks quietly at the worst possible time.
Sources
- Best AI Web Scraping Tools for LLM and RAG Pipelines in 2026
- LLM Web Scraping: How AI Models Replace Scrapers
- Stop Sending Raw HTML to LLMs
- Feeding Raw HTML to Your LLM Is a Token Tax. I Measured It on 10 Real Pages — Median 7.4×, and It Hits Every Scheduled Run | by Spinov | Medium
- arxiv.org
- fastcrw.com
- bytetunnels.com


