New1 billion tokens free on sign-up — crawl, parse, chunk and embed on the houseSee pricing
SarvCrawlSarvCrawl

Glossary · Web crawlingUpdated

What is a web crawler?

A web crawler is a program that starts from one or more URLs, downloads each page, extracts the links it finds and follows them to discover more pages. Search engines, archives and AI data pipelines all use crawlers to collect pages at scale.

01Web crawlers in more depthof 06

Web crawlers in more depth

A web crawler, also called a spider or bot, automates what a person does when they click through a site: open a page, notice the links on it, open those, and keep going. The difference is scale and discipline. A crawler keeps a record of every URL it has seen so it never fetches the same page twice, and it follows rules about which links it may follow and how fast.

Crawling is about discovery. Deciding what to keep from each page is a separate job, usually called web scraping or extraction. Most real systems do both: the crawler finds the pages and an extractor turns each one into text or structured data.

How a web crawler works

  1. Seed. The crawl starts from one or more seed URLs, often a homepage or a sitemap.xml.
  2. Frontier. URLs waiting to be fetched sit in a queue called the frontier. The order it is drained in, breadth-first or by priority, decides which pages are reached first.
  3. Fetch. The crawler requests each URL over HTTP. Sites that build their content with JavaScript need JavaScript rendering in a headless browser before the content exists.
  4. Parse and extract links. The response is parsed and every <a href> is resolved to an absolute URL. See link extraction.
  5. Filter and deduplicate. Each new link is normalized, checked against the seen set, and kept only if it is in scope: same domain, allowed path, within the crawl depth limit and allowed by robots.txt.
  6. Repeat until the frontier is empty or a page limit is hit.

Scope is the whole game. A crawler with no page limit, no depth limit and no path filters will happily follow calendar links, faceted search and session-tagged URLs forever.

Example: a scoped crawl

A minimal crawler in Python shows the moving parts. It keeps to one host, caps the page count and skips URLs it has already seen.

from collections import deque
from urllib.parse import urljoin, urlparse
import re, requests

def crawl(seed, limit=100):
    host = urlparse(seed).netloc
    seen, frontier = {seed}, deque([seed])
    while frontier and len(seen) <= limit:
        url = frontier.popleft()
        html = requests.get(url, timeout=10).text
        for href in re.findall(r'href="([^"#]+)"', html):
            link = urljoin(url, href)
            if urlparse(link).netloc == host and link not in seen:
                seen.add(link)
                frontier.append(link)
    return seen

A production crawler adds politeness delays, robots.txt checks, retries with backoff on HTTP 429, a real HTML parser and rendering for script-heavy pages.

Common pitfalls

  • Crawler traps. Infinite calendars, sort and filter parameters, and relative links that keep nesting deeper produce unlimited unique URLs. Page limits and path exclusions are the defence.
  • Duplicate URLs. The same page under ?utm_source= variants, trailing slashes or mixed case wastes the crawl budget.
  • Empty pages. A plain HTTP fetch of a single-page app returns a shell with no content.
  • Going too fast. Hammering a server gets you rate limited or blocked and is unfair to the site owner.

How SarvCrawl handles it

The crawl endpoint takes a start URL plus max_depth, limit and exclude_paths to keep the crawl in scope, and crawls run with query parameters ignored so tracking variants collapse into one page. Every page is rendered in a real browser and saved as clean markdown into a knowledge base. With include_docs, linked PDFs and Office files are parsed too.

The console draws each crawl as a link tree, with every page placed under the first page that linked to it, plus counts of redundant and external links. To see what a crawl would reach before you run it, the map endpoint lists URLs from sitemaps and links without fetching content.

Frequently asked questions

Is a web crawler the same as a web scraper?

No. A crawler discovers pages by following links; a scraper extracts data from a page. Most pipelines use both, and the terms are often used loosely to mean the combination.

Are web crawlers legal?

Crawling publicly accessible pages is common practice, but terms of service, copyright, privacy law and robots.txt all apply. Check the rules for the sites and jurisdiction you work in.

How does a crawler avoid fetching the same page twice?

It normalizes every URL and keeps a set of URLs it has already seen or queued, skipping any link that is already in the set.

SarvCrawl

Turn any site into a searchable knowledge base

Crawl pages and parse documents into clean markdown, then chunk, embed and search them from one API.