Glossary

Web scraping

Web scraping is the automated extraction of content and data from web pages into a structured format such as JSON, CSV or Markdown.

Web scraping is the automated extraction of content and data from web pages. A scraper requests a page, renders it if the content depends on JavaScript, parses the resulting HTML, and pulls out the parts it needs (prices, article text, product specifications, contact details, tables) into a structured format such as JSON, CSV or Markdown. For AI systems, scraping is one of the main ways to bring public web content into a knowledge base, a RAG pipeline or an agent’s working context, which is why the output increasingly needs to be clean, chunked text rather than raw markup.

How web scraping works

Most scrapers follow the same sequence, whether they are a fifty-line script or a managed API.

Step

What happens

Common problems

Fetch

Send an HTTP request for the URL with a chosen user agent and headers

Rate limits, blocks, redirects, regional variations

Render

Execute JavaScript in a headless browser when content is loaded client-side

Slow, memory-hungry, flaky timing

Parse

Turn HTML into a DOM tree that can be queried

Malformed markup, inconsistent templates

Select

Pick out elements with CSS selectors or XPath, or let a model identify them

Selectors break when the site redesigns

Clean

Strip navigation, ads and footers with boilerplate removal

Losing real content along with the clutter

Output

Convert to JSON, Markdown or chunks with metadata

Tables, code blocks and lists mangled in conversion

The fetch step is simple for static sites, where the server returns complete HTML. Many modern sites send a near-empty page and assemble the content with JavaScript, so a plain HTTP request returns a shell with no text in it. Handling that dynamic content requires JavaScript rendering: running the page in a real browser engine, waiting for network requests to settle, and only then reading the DOM. Rendering is the most expensive part of scraping, often by an order of magnitude, which is why scrapers try a plain request first and fall back to a browser only when needed.

Parsing and selection are where most maintenance goes. A scraper written against one site’s markup works until that site changes a class name. HTML parsing libraries make the DOM easy to query, but the selectors themselves are brittle. A growing alternative is to skip site-specific selectors entirely and extract the main content generically, either with reader mode style heuristics or with a model that reads the page and returns the fields you asked for. That trades some precision on a known site for much better coverage across unknown ones.

Scraping versus crawling and APIs

Scraping and crawling are often mentioned together but solve different problems. A web crawler discovers pages by following links or reading a sitemap.xml, building a list of URLs to visit. A scraper extracts content from a given page. Most large projects use both: the crawler decides where to go, and the scraper decides what to keep. Web scraping vs web crawling covers the distinction in more depth.

When a site offers an official API, it is usually the better route. APIs return structured data, carry explicit terms of use and do not break when the visual design changes. Scraping fills the gap where no API exists, where the API omits data visible on the page, or where you need content from thousands of different sites that will never share an API format. Web scraping vs API sets out the trade-offs.

Scraping for AI and LLMs

Scraping for language models has different priorities from scraping for analytics. A price tracker wants three fields from a product page and can discard everything else. A RAG pipeline wants the full readable text of an article, in reading order, with headings intact and nothing else mixed in. That has pushed scraping tools toward HTML to Markdown conversion, because Markdown keeps structure (headings, lists, tables, links) while using far fewer tokens than HTML, and models read it well.

The phrase LLM-ready data describes the target: clean text without navigation or cookie banners, split into chunks with source URLs and titles attached, so each passage can be retrieved and cited. Getting there means doing boilerplate removal well, preserving tables, keeping metadata such as the page title and publication date, and chunking the result along sensible boundaries. Some site owners now publish an llms.txt file pointing models to clean versions of their content, a practice discussed in should every website ship an llms.txt.

Agents add another use. A research agent or browser agent may need to read pages on demand in the middle of a task. Here latency matters as much as quality: the agent is waiting for the page, so a fast fetch with good main-content extraction usually beats a perfect but slow one. Metadata-only lookups are even cheaper. When the agent only needs a title, description and image to decide whether a link is relevant, a link preview built from Open Graph tags is enough.

A worked example: documentation for a support agent

Suppose a support agent needs to answer questions from a software vendor’s public documentation, around 400 pages built with a JavaScript framework. A crawler reads the sitemap and produces the list of URLs. Each page is rendered, because the content loads client-side, and the main article is extracted without the sidebar, version picker and footer that repeat on every page. The text is converted to Markdown so code samples and parameter tables survive, then split into chunks at heading boundaries, each tagged with the page URL, title and section name.

Those chunks go into a search index the agent queries before answering. When a customer asks how to rotate an API key, the agent retrieves the two relevant sections, answers from them and cites the page. The difficult part comes later. The vendor ships a release every fortnight and rewrites a dozen pages each time. Unless the scrape runs again, the agent keeps quoting the old instructions. A useful scraping setup for AI therefore includes the re-fetch schedule from day one, along with a way to replace changed pages in the index rather than adding duplicates beside them.

Blocking, politeness and scale

Sites defend against scraping for reasons ranging from server load to commercial protection. Anti-bot detection looks at request rates, browser fingerprints, IP reputation and behaviour, and may respond with blocks or a CAPTCHA. Large scraping operations counter with proxy rotation and residential IP pools, which adds cost and raises questions about whether the scraping is welcome at all.

Polite scraping avoids most of this. Respect robots.txt, identify your client clearly in the user agent, keep request rates low, back off on errors with exponential backoff, and cache pages instead of refetching them. Scraping that behaves like a considerate reader is cheaper to run and less likely to cause problems for the site or for you.

Legal and ethical considerations

Whether scraping is lawful depends on the jurisdiction, what is collected, how it is accessed and what is done with it. Public, non-personal data is generally lower risk than content behind a login, and a site’s terms of service may restrict automated access. Scraping personal data brings data protection law into play: in the EU and UK, GDPR applies to personal data whether or not it was publicly visible. Copyright governs what you can republish or train on. Is web scraping legal? covers the main questions, and any project that touches personal data or copyrighted content at scale deserves its own legal review.

Keeping scraped knowledge current

Scraped content goes stale. Prices change, documentation is rewritten, articles are corrected. A knowledge base built from a one-off scrape quietly drifts from the web it was taken from, and an agent answering from it will repeat outdated facts with full confidence. Treat scraping as a recurring job: re-fetch sources on a schedule matched to how often they change, compare the new content with what is stored, and update or retire entries. Document freshness and knowledge base maintenance describe the practice, and automating competitive intelligence with a scheduled agent shows one example.

Where Exabase fits

Exabase handles the extraction end of scraping for AI use: give it a URL and it returns clean, structured content. It is not a crawler and does not provide proxies or anti-bot tooling, so it suits teams that know which pages they want. Extract accepts a URL through the same endpoint used for files (submitting jobs). Pages are rendered with JavaScript before extraction, so content that loads dynamically is captured, and the result includes the title, site name and page text split into chunks. Adding ?format=markdown returns the same result as Markdown ready for a prompt. The free web scraper, website to Markdown and website to JSON tools run on the same pipeline.

For pages you want to keep, saving a URL as a bookmark through the Resources API fetches the page, stores a reader-mode version and a screenshot, and indexes the content so it can be found with Deep Search. A Worker can then re-check saved sources on a schedule and refresh what has changed, which is the pattern on the knowledge base solution page. For metadata only, the link preview tool returns titles, descriptions and images for public pages, with 20,000 free previews a month.

Frequently asked questions

What is web scraping used for?

Common uses include price and product monitoring, research and market analysis, lead and company data, news aggregation, and feeding public content into AI knowledge bases and RAG pipelines.

What is the difference between web scraping and web crawling?

Crawling discovers URLs by following links or sitemaps; scraping extracts content from a page. Large projects usually crawl to find pages and scrape to extract them.

Why does my scraper return empty pages?

The site probably builds its content with JavaScript. A plain HTTP request gets the empty shell; you need to render the page in a headless browser before reading the DOM.

What output format is best for LLMs?

Markdown is usually the best balance: it keeps headings, lists, tables and links while using far fewer tokens than HTML. JSON suits specific fields such as prices or product attributes.

Is web scraping legal?

It depends on jurisdiction, the data collected, how it is accessed and how it is used. Public non-personal data is generally lower risk; personal data, logged-in content and copyrighted material need closer review.

How do I avoid getting blocked when scraping?

Scrape politely: respect robots.txt, keep request rates low, identify your client, cache results and back off on errors. Heavy use of rotating proxies to evade blocks is a sign the scraping may not be welcome.

Can Exabase scrape websites?

Exabase extracts content from URLs you provide, rendering JavaScript and returning text chunks, metadata or Markdown. It does not crawl sites or supply proxies.

Related pages: Web crawler, Headless browser, HTML to Markdown, Web scraping vs web crawling, Web scraping vs API, File extraction solution, Best web scraping API, Firecrawl alternatives, Exabase vs Firecrawl, Research agents, Screen scraping, Apify alternatives, ScrapingBee alternatives, Firecrawl pricing

Cut your token spend and give your agent precise context.

Get started in minutes.

Cut your token spend and give your agent precise context.

Get started in minutes.