AI web scraping in 2026 is three generations of technique on one pipeline: CSS selectors on raw HTML, DOM-aware extraction from a rendered page, and LLM extraction that fills a schema. Use the oldest generation that works for your site: each step up costs more per page and less in upkeep. Sites now block automated traffic by default more often, so check the terms and robots.txt before the first request and stop when a site says no.
AI web scraping in 2026 comes in three generations that share one pipeline: CSS selectors on raw HTML, DOM-aware extraction from a rendered page, and LLM extraction, where a model reads the page and returns the fields you ask for. Use the oldest generation that works for your site, because each step up costs more per page and less in upkeep, and collect only what the site's terms and robots.txt allow.
Checked October 2026 against Playwright's locator docs, Google's structured data introduction, RFC 9309 (the robots.txt standard), Firecrawl's pricing page, Apify's pricing page and its Website Content Crawler listing, Anthropic's API pricing, and Cloudflare's AI Crawl Control docs and July 2026 announcement. Every cost on this page is arithmetic from those published rates, not a measured run.
This is the hub for our scraping guides. It explains the three generations, when each is the cheaper choice, how to run a scraper on a schedule, how to get from raw pages to data a model can use, and what sites do about bots now. Each section links to the guide that goes deeper, and there is a reading path near the end if you want to be told where to start.
What is AI web scraping?
AI web scraping is ordinary web scraping with a language model doing one of two jobs. Either the model does the extracting, reading a page and returning structured fields, or the model is the customer, and the scraper's job is to hand it clean text. Everything else is the same pipeline scrapers have always had.
- 01Permission
Terms, robots.txt, an official API if one exists
- 02Fetch
An HTTP request, or a browser when the page needs one
- 03Extract
Selectors, the rendered DOM, or a model with a schema
- 04Validate
Types, required fields, a spot check by eye
- 05Store
Rows for a database, markdown for retrieval
- 06Monitor
Schedules, status codes, empty-field alerts
The generations differ only at the extract step, and in whether the fetch step needs a browser. That is why the choice between them is mostly a cost decision.
| Generation | How it finds the data | Breaks when | What you pay for | Use it for |
|---|---|---|---|---|
| 1. Selectors | A CSS or XPath path into the raw HTML | The site changes its markup, or renders with JavaScript | Your time writing and fixing selectors | A few stable sites you scrape often |
| 2. DOM-aware | A rendered page: roles, visible text, or the structured data the page publishes | The page hides the data until you interact, or publishes no structured data | Browser compute per page | JavaScript-heavy sites and product or article pages |
| 3. LLM extraction | A model reads the cleaned page and fills a schema | The data is not in the fetched content at all | Model tokens or extraction credits per page | Many different sites, or layouts that keep changing |
Generation 1: CSS selectors on raw HTML
The first generation fetches the HTML and pulls values out by position: this class, inside that table, third cell. It needs an HTTP client and an HTML parser, runs in milliseconds and costs almost nothing per page. For a handful of sites with stable markup, it is still the right answer in 2026.
Its weakness is that a selector describes where the data was, not what it is. Playwright's own documentation, written for testers but true for scrapers, warns that CSS and XPath locators are "not recommended as the DOM can often change". Each redesign on the target site is a repair job on your side, and a selector that silently matches nothing produces a clean-looking file full of blanks. If you run this generation, the validate step is not optional.
Generation 2: DOM-aware extraction from a rendered page
The second generation loads the page in a real browser and works from what rendered. Playwright drives Chromium, Firefox and WebKit, headless by default, so pages built with JavaScript frameworks arrive with their content in place. Two habits make this generation sturdier than the first.
- Locate by meaning. Ask for the level-one heading, the button labelled "Next", or the text beside "Price", using role and text locators. Those survive a CSS refactor, because they follow what a visitor sees.
- Read what the page already publishes. Many product, article and event pages embed structured data for search engines. Google recommends the JSON-LD format, which sits in a script tag as plain JSON. When it is there, you can skip parsing the layout entirely.
// Generation 1: a selector tied to today's markup
const price = await page.locator('.product-price').first().textContent()
// Generation 2: ask for what a person would see...
const title = await page.getByRole('heading', { level: 1 }).textContent()
// ...or read the structured data the page already publishes
const blocks = await page.locator('script[type="application/ld+json"]').allTextContents()
const product = blocks.map(b => JSON.parse(b)).find(d => d['@type'] === 'Product')The price is compute. A browser uses far more memory and time per page than an HTTP request, which is why hosted crawlers quote a wide range for browser crawling and a low flat figure for raw HTTP. Use a browser only for the pages that need one.
Generation 3: LLM extraction
The third generation stops describing where the data is. You fetch the page, strip it to its main content, and give a model a schema: name, price, currency, in stock. The model reads the text and fills the fields. One schema works across a thousand differently built sites, and a redesign usually changes nothing.
You can assemble this yourself, with a fetch, a markdown conversion and a model call, or buy it as one request. Firecrawl's JSON mode does the whole chain per page; our Firecrawl tutorial runs a product-catalogue job through it step by step, including the credit budget. Two cautions apply to every version of this generation. A model can only extract what the fetch captured, so check the markdown before you blame the schema. And a model can return a plausible value that is not on the page, so keep the validate step and spot-check against the source.
When is each generation cheaper?
Per page, the older generation always wins. Per project, it depends on how many different sites you cover and how often they change, because selector upkeep is paid in your hours. The table prices 1,000 pages on each route from published rates, checked October 2026.
| Route | Published rate | Per 1,000 pages |
|---|---|---|
| Raw HTTP crawl on Apify | Apify's own estimate for its Website Content Crawler | About $0.20 |
| Headless-browser crawl on the same Actor | Apify's own estimate, "depending on the website" | $0.50 to $5 |
| Firecrawl page to markdown, Standard plan | 1 credit a page; $99 a month buys 100,000 credits | $0.99 |
| Firecrawl page to markdown, Hobby plan | 1 credit a page; $19 a month buys 5,000 credits | $3.80 |
| Your own model call on fetched markdown | Claude Haiku 5.5 at $0.10 in and $0.50 out per million tokens; illustrative 3,000 tokens in, 300 out | $0.45, plus the fetch |
| Firecrawl JSON mode, Standard plan | 5 credits a page (1 base plus 4 for the LLM format) | $4.95 |
| Firecrawl JSON mode, Hobby plan | 5 credits a page | $19.00 |
Plan figures are the share of the monthly fee the job uses; you still pay for the whole plan. The model-call bar uses illustrative token counts and excludes the fetch. Source: Calculated from the Firecrawl, Apify and Anthropic pricing pages, checked October 2026. Not measured.
Three things stand out. Raw HTTP costs a fraction of any route that renders pages or bundles a model, so do not render pages that do not need it. Fetching markdown and calling a small model yourself is far cheaper per page than a bundled LLM format, at the cost of writing and running that step. And plan size moves the unit price more than the technique does: the same Firecrawl page costs about a quarter as much on Standard as on Hobby.
For the full comparison of the two hosted options, with three jobs priced on each, read Apify vs Firecrawl. For the model side of the bill, our LLM API pricing comparison lists per-token rates across vendors.
Automated web scraping: schedules, retries and monitoring
A scraper becomes automated web scraping when it runs without you and tells you when it breaks. The scheduling is the easy part: a cron entry, a hosted scheduler, or a workflow tool. Our n8n cron expression guide covers the schedule syntax, and the n8n webhook guide covers the other pattern, where a crawl job calls you back when it finishes.
The monitoring is what people skip. A scheduled scraper fails quietly: the request succeeds, the page has changed, and the output is empty strings. Track three numbers per run and alert on any of them moving.
- Status codes. A rise in 403 or 429 responses means the site is refusing or throttling you. Slow down or stop; do not retry harder.
- Fill rate. The share of records with every required field present. A drop means the layout changed.
- Record count. Far fewer pages than last run usually means pagination or discovery broke.
Keep the request rate polite as well. A small site's server does not need dozens of parallel browsers, and a crawl that slows a site down is the fastest way to get blocked.
Web scraping for AI: getting to LLM-ready data
When the reader is a model, the target format changes. A database wants typed rows. A model wants the main content as clean markdown, without navigation, cookie banners and script tags, because every stray token costs money and dilutes retrieval. Hosted crawlers return markdown directly, and Apify's content crawler can save text, markdown or HTML.
From there the pipeline is the retrieval one: split the markdown into chunks, embed them, store them, and fetch the relevant chunks at question time. Keep the source URL and fetch date on every chunk so answers can cite and so stale pages can be refreshed.
- The pgvector and Supabase RAG guide covers the schema, indexes and search for storing scraped pages.
- RAG vs fine-tuning helps you decide whether scraped data belongs in retrieval or in training data at all.
- AI agent memory options compared covers when a vector store is worth adding.
- The Model Context Protocol guide explains how an agent calls a scraper as a tool, and our list of useful MCP servers includes the scraping ones.
Collecting pages for a training dataset raises the stakes on permission. Site owners now get a separate switch for training crawlers, covered in the next section, and many have turned it off.
Anti-bot realities in 2026
The honest summary is that blocking moved from a specialist product to a default. Cloudflare publishes its defaults and the dates they change, which makes it a useful example of the direction.
- July 2025New domains are asked whether to allow AI crawlers
Cloudflare announces blocking AI crawlers without permission by default, and opens a Pay Per Crawl beta.
- July 2026AI traffic is split into Search, Agent and Training
Site owners can allow or block each category. A crawler with several purposes is judged on all of them.
- 15 Sept 2026New domains block Training and Agent on pages with ads
Search stays allowed by default. Owners can change the setting at any time.
Source: Cloudflare press release, July 1, 2025, and blog post, July 1, 2026. Checked October 2026.
Read the Agent category closely. Cloudflare defines it as acting "in real time, on a person's behalf", which covers chat assistants fetching a page and browser-driving agents. A scraper that runs because a user asked is not exempt from a site's rules, and site owners now have a named switch for it. Cloudflare's AI Crawl Control, available on all its plans, also lets owners set rules per crawler and track which crawlers follow robots.txt.
The rules: terms, robots.txt and personal data
Scraping guidance that skips this section is how projects get shut down. None of it is legal advice; all of it is the baseline a careful operator follows before the first request.
- Read the site's terms of service. If they forbid automated collection, use the official API or ask.
- Fetch /robots.txt and obey it. Re-read it at least every 24 hours on long crawls.
- If robots.txt returns a server error, treat the whole site as disallowed, as RFC 9309 requires.
- Never go behind a login, paywall or access control you were not given.
- Leave personal data out unless you have a lawful reason to hold it and a plan to delete it.
- Identify your crawler honestly and keep the request rate low enough that the site never notices.
- Record what you collected, from where and when, so you can remove a source on request.
One point about robots.txt is widely misread. RFC 9309 says its rules "are not a form of access authorization". An allowed path means the owner does not object to a crawler visiting it. It does not grant the right to republish what is there, feed it to a model or resell it. The terms and the law decide that.
Start here: a path through this hub
If you are new to this, read in this order. Each step is one guide and ends with something working.
- Pick a generation with the table and matrix above. Most first projects are one site, so generation 1 or 2.
- Run your first LLM-ready scrape with the Firecrawl tutorial: one page to markdown, then a schema.
- Price the job before you scale it with Apify vs Firecrawl.
- Store the output with the pgvector and Supabase RAG guide.
- Let an agent call it with the Model Context Protocol guide.
- 1Choose one site and five fields
Write the fields down with their types. Run the permission checklist before anything else.
- 2Fetch one page three ways
Raw HTML, a rendered page and markdown. See which one actually contains your five fields.
- 3Extract with the oldest generation that works
Selectors if the HTML has the data, structured data if the page publishes it, a schema and a model if neither.
- 4Validate ten pages by eye
Compare every field with the live page. Fix the extraction now, while the sample is small.
- 5Schedule it and alert on three numbers
Status codes, fill rate and record count. A scraper nobody watches is a scraper that is already broken.
- 6Work out the monthly cost
Pages per run, runs per month, rate per page. Decide whether the next generation up is worth it.
A scraper is a component, not a product. Turning scraped data into something people pay for means an app, a database, auth and billing around it, which is what our AI SaaS Builder program covers, including lessons on MCP servers such as Firecrawl and on building a research agent.
AI web scraping: FAQ
What is AI web scraping?
AI web scraping is collecting data from web pages with a language model doing part of the work. In practice it means one of two things: a model reads a fetched page and returns the fields you describe, replacing hand-written selectors, or a scraper turns pages into clean markdown so a model can use them later for retrieval or analysis. The fetching, scheduling and storage around the model are the same as in any scraper.
Is web scraping legal?
It depends on what you collect, how you collect it and where you and the site are based, so there is no single answer and this is not legal advice. The practical floor is the same everywhere: read the site's terms, follow its robots.txt, stay off anything behind a login you were not given, avoid personal data unless you have a lawful reason to hold it, and stop when a site blocks you.
Do I have to follow robots.txt?
Treat it as the minimum. The standard behind robots.txt, RFC 9309, says crawlers are requested to honor the rules, and also says the rules are not a form of access authorization. So a path robots.txt allows is not permission to reuse what is there: the site's terms and the law still apply. Fetch the file before each crawl, obey it, and re-read it at least daily on long jobs.
Which is cheaper, CSS selectors or LLM extraction?
Selectors are cheaper per page, because a selector costs nothing to run once it is written. On published rates checked October 2026, Apify estimates about $0.20 per 1,000 static pages for a raw HTTP crawl, while Firecrawl's LLM-based JSON mode works out at $4.95 per 1,000 pages on its Standard plan. LLM extraction wins when writing and repairing selectors for many different sites would cost more than that difference.
What is LLM-ready data?
LLM-ready data is page content a language model can use without further cleaning: the main text as markdown with navigation, ads and scripts removed, or typed JSON that matches a schema. Each record should also carry its source URL and the date it was fetched, so answers built on it can cite where a fact came from and you can tell when it has gone stale.
Why does my scraper get blocked in 2026?
Because blocking automated traffic is now a default instead of a specialist setting. Cloudflare, for example, lets every customer allow or block AI traffic by category, and from September 15, 2026 new domains block the Training and Agent categories by default on pages that display ads. A block is the site answering the permission question. Use an official API or ask for access; do not disguise the scraper.
Can an AI agent scrape websites for me?
Yes. Coding agents and chat assistants can call scraping tools through the Model Context Protocol, and Firecrawl and Apify both publish MCP servers. The agent decides which pages to fetch and the tool returns markdown or JSON. The same rules apply as for any scraper, and site owners can now block agent traffic as its own category, so expect some pages to refuse.
Every guide in this hub
Free · no card needed
Start with the free Starter Kit.
A unit economics calculator from AI SaaS Builder, plus four more working files.
The data is collected. Now build what reads it.
All Access includes AI SaaS Builder, with lessons on MCP servers such as Firecrawl, building an AI research agent and retrieval with embeddings, on top of Supabase, the Claude API and Stripe billing. The other three programs, live coaching and the private community are in the same subscription.
Planning a scraping project?
Ask in the free Discord. Share the site, the fields and the volume, and other builders will tell you which generation they would use and what it cost them.