What Is a Web Crawler and How Do You Use One to Collect Web Content?
A web crawler is a program that starts from one or more seed URLs, fetches those pages, finds the links inside them, and repeats the process across the site or the web. You use one when you need broad coverage of a site's content rather than a fixed set of fields. If your goal is to feed an AI model, a RAG pipeline, or a vector database, a crawler that outputs clean text or Markdown is usually the right starting point — for example, Apify's Website Content Crawler is described as crawling websites and extracting text content to feed AI models, LLM applications, vector databases, or RAG pipelines, with Markdown formatting, HTML cleaning, and file downloads.
Crawling vs. scraping: the distinction that decides your tool
The two terms overlap, but they answer different questions.
| Web crawler | Web scraper | |
|---|---|---|
| Primary job | Discovery and traversal — find pages by following links | Extraction — pull specific fields from known pages |
| Input | Seed URLs, often a domain or sitemap | Specific URLs or search queries |
| Output | Page content, usually cleaned text or Markdown | Structured records (names, prices, emails, metrics) |
| Typical question | "What is on this site?" | "What are the prices for these 500 products?" |
In practice they chain together. A crawler discovers the URLs; a scraper turns each URL into rows. Apify's marketplace reflects both patterns: Website Content Crawler handles traversal and text extraction, while tools like Google Maps Scraper (crawler-google-places) extract defined fields such as reviews, contact info, opening hours, and prices, and E-commerce Scraping Tool extracts e-commerce data for price monitoring and site comparison.
Choose crawling when you don't yet know which pages matter. Choose scraping when you know the target pages and the exact fields you need.
How a crawler actually works
The loop is simple, and every configuration option maps to one step in it:
- Seed — you provide starting URLs.
- Fetch — the crawler requests each page over HTTP.
- Parse — it reads the HTML and extracts links.
- Filter — it decides which links are in scope (same domain, path prefix, depth limit).
- Queue — new URLs are added to a frontier, and the loop repeats until the queue empties or a limit is hit.
Every failure mode and every setting below is a control on one of these five steps.
Configuration choices that determine your results
Crawl depth and URL scope
Depth limits how many link-hops from the seed the crawler will follow. Depth 0 is just the seed page; depth 1 adds everything linked from it; depth 2 adds everything linked from those, and so on. Scope rules (same hostname, path prefix, include/exclude patterns) keep the crawler from wandering into pagination loops, tag archives, or unrelated subdomains. Set both before you run — an unbounded crawl on a large site can queue millions of URLs.
robots.txt and rate limiting
robots.txt tells crawlers which paths are disallowed and sometimes sets a crawl delay. Respect it, and add your own rate limit (requests per second or concurrent requests) so you don't overload the target server or trigger blocking. Slower crawls finish more reliably than fast ones that get cut off.
JavaScript-rendered content
If the site builds its content client-side, a plain HTTP fetch returns an empty shell. You need a crawler that executes JavaScript (a headless browser) or an API the site exposes. This is one of the most common reasons a crawl "succeeds" but returns almost no text.
Output format
For AI and RAG use, you want clean text or Markdown with navigation, ads, and boilerplate stripped. Website Content Crawler explicitly supports Markdown formatting, HTML cleaning, and file downloads, and integrates with LangChain, LlamaIndex, and the wider LLM ecosystem — which matters because chunking and embedding quality depend directly on how clean the extracted text is.
Running a crawler to get clean text or Markdown
The exact steps depend on the tool, but the shape is consistent. Using a content crawler as the example:
- Provide input — one or more start URLs, plus scope and depth limits.
- Set extraction options — choose text or Markdown output, and whether to download linked files.
- Run — the crawler fetches, parses, and follows links within your limits.
- Verify — check the page count against your expectation and spot-read a few outputs for boilerplate or missing content.
- Export or integrate — download the dataset, or push it into your pipeline. Apify Actors support export, API runs, scheduling and monitoring, and integration with other tools or AI workflows.
If you're feeding a RAG pipeline, the verification step is where most quality problems surface: duplicated pages, near-empty JavaScript shells, and navigation text mixed into content all degrade retrieval later.
Common failure modes and how to spot them
- Blocked requests — the crawler gets 403s or CAPTCHAs. Symptom: many failed fetches, few pages. Fix: slow down, respect robots.txt, or use a tool built to handle the target site.
- Duplicate pages — the same content reachable via multiple URLs (trailing slashes, query parameters, print versions). Symptom: your dataset is larger than the site's real page count. Fix: canonicalize URLs and add exclude patterns.
- JavaScript-rendered content — pages fetch successfully but contain no body text. Symptom: high page count, near-zero content per page. Fix: use a browser-rendering crawler.
- Crawl traps — calendars or infinite pagination that generate unbounded URLs. Symptom: the queue never drains. Fix: depth limits and path exclusions.
- Scope creep — the crawler leaves the target domain. Symptom: unrelated pages in your dataset. Fix: restrict to the hostname or path prefix.
Where crawling fits in an AI workflow
Crawling is the collection stage. Downstream, the text is chunked, embedded, and stored in a vector database, then retrieved at query time by an LLM application. Because every later stage inherits the crawler's output quality, the configuration choices above — scope, rendering, cleaning, deduplication — are the ones worth getting right first. Apify's marketplace lists over 73,000 tools, including ready-to-run scrapers for specific platforms and the Website Content Crawler for general site-to-text collection, so you can either use a prebuilt Actor or build and deploy your own.