# Website Crawler to Markdown – sitemap, RAG chunks – $1/1k (`henrycrawl/website-crawler-markdown`) Actor

Crawl a whole website to clean, LLM-ready Markdown over fast HTTP (no browser): sitemap.xml, same-site links, robots.txt, depth and glob filters, optional RAG chunks. Works with AI agents via Apify MCP. Pay per page; blocked rows are free.

- **URL**: https://apify.com/henrycrawl/website-crawler-markdown.md
- **Developed by:** [Henry Crawl](https://apify.com/henrycrawl) (community)
- **Categories:** AI, Developer tools, MCP servers
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 crawled pages

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Website Crawler to Markdown for LLM & RAG

Turn a whole website (docs, blog, help center, knowledge base) into clean, LLM-ready Markdown in seconds – without paying for a headless browser.

### What it does

- Starts from your **start URLs**, reads **sitemap.xml** (from robots.txt or `/sitemap.xml`, sitemap indexes and `.gz` supported) and follows **same-site links** breadth-first.
- **Crawl scope**: only URLs under the start folder (default), the whole domain, or the domain plus subdomains. Fine-tune with **include / exclude globs** (`https://example.com/blog/**`, `**/tag/**`).
- Respects **robots.txt** and `rel="nofollow"` / `<meta name="robots" content="nofollow">`.
- **maxDepth** and **Max pages** keep runs small and predictable.
- Every page becomes clean **Markdown** (main content extracted with trafilatura, nav/ads/footers removed; full-body fallback) plus title, description, language, depth, referrer, canonical URL and word count.
- Optional **RAG chunks** (paragraph-aware, with overlap) ready for embeddings.
- Fast plain HTTP (HTTP/2, concurrent). Pages that need JavaScript, a login, or show a captcha / bot wall are **not bypassed** – they return a free `BLOCKED` / `EMPTY_CONTENT` row.

### Output fields

| Field | Description |
|---|---|
| `url` / `finalUrl` | Requested URL and URL after redirects |
| `statusCode` | HTTP status |
| `depth` | Link hops from the start URL (sitemap URLs = 1) |
| `referrerUrl` | Page that linked here (or `sitemap`) |
| `title`, `description`, `lang`, `author`, `publishedDate` | Page metadata |
| `canonicalUrl` | `<link rel="canonical">` if present |
| `wordCount`, `charCount` | Size of the Markdown |
| `markdown` | Clean Markdown of the page |
| `chunks`, `chunkCount` | Only when `chunkSize` > 0 |
| `links` | Only when `includeLinks` = true |
| `truncated` | Page was larger than `maxPageSizeMb` |
| `type`, `status`, `error` | `result` / `OK`, or a free `error` row (`BLOCKED`, `HTTP_ERROR`, `ROBOTS_DISALLOWED`, `INVALID_URL`, `FETCH_FAILED`, `EMPTY_CONTENT`, `UNSUPPORTED_CONTENT`) |

### Example output (real run, Markdown shortened)

```json
{
  "url": "https://docs.python.org/3/tutorial/inputoutput.html",
  "finalUrl": "https://docs.python.org/3/tutorial/inputoutput.html",
  "statusCode": 200,
  "depth": 1,
  "referrerUrl": "https://docs.python.org/3/tutorial/index.html",
  "title": "7. Input and output",
  "description": "There are several ways to present the output of a program; data can be printed in a human-readable form, or written to a file for future use. ...",
  "lang": "en",
  "canonicalUrl": "https://docs.python.org/3/tutorial/inputoutput.html",
  "wordCount": 3080,
  "charCount": 18810,
  "truncated": false,
  "markdown": "# 7. Input and output\n\nThere are several ways to present the output of a program; ...",
  "type": "result",
  "status": "OK"
}
```

```json
{
  "url": "https://www.python-httpx.org/api/",
  "statusCode": 200,
  "depth": 1,
  "referrerUrl": "sitemap",
  "title": "Developer Interface",
  "wordCount": 2606,
  "markdown": "# Developer Interface\n\n## Helper Functions\n\nNote\n\nOnly use these functions if you're testing HTTPX in a console ...",
  "chunks": ["# Developer Interface\n\n## Helper Functions ...", "..."],
  "chunkCount": 18
}
```

### Pricing

**$1 per 1,000 pages** ($0.001 per delivered page), no start fee. Error, blocked and robots-disallowed rows are free. Set **Max pages** to cap your cost.

### Input example

```json
{
  "startUrls": ["https://docs.python.org/3/tutorial/index.html"],
  "crawlScope": "prefix",
  "maxDepth": 2,
  "useSitemap": true,
  "respectRobotsTxt": true,
  "excludeGlobs": ["**/genindex*"],
  "chunkSize": 1500,
  "chunkOverlap": 150,
  "maxResults": 100
}
```

### Use with AI agents (MCP)

Give Claude, Cursor or any MCP client a "crawl this site" tool:

```
https://mcp.apify.com/?tools=henrycrawl/website-crawler-markdown
```

Typical prompts: "Crawl the docs at https://example.com/docs/ (max 50 pages) and summarize the authentication section", "Build a RAG index of this help center".

### Tips

- Single pages only? Set `maxDepth` = 0.
- JavaScript-only sites (empty HTML) return `EMPTY_CONTENT` – this actor does not run a browser.
- Lower `maxConcurrency` for small sites to be polite.

# Actor input Schema

## `startUrls` (type: `array`):

Website(s) to crawl. The crawler follows links that stay under each start URL (see Crawl scope). Pages behind login, captcha or bot walls are NOT bypassed: they return a free BLOCKED row.

## `crawlScope` (type: `string`):

Which discovered links to follow. prefix = only URLs whose path starts with the start URL's folder (e.g. /docs/); domain = any page on the same host; subdomains = also blog.example.com, docs.example.com. Ignored when Include globs are set.

## `maxDepth` (type: `integer`):

How many link hops from the start URL to follow. 0 = only the start URLs, 1 = start URLs + pages they link to (and sitemap URLs), etc.

## `useSitemap` (type: `boolean`):

Also read the site's sitemap (from robots.txt or /sitemap.xml, including sitemap indexes and .gz) to discover pages. Sitemap URLs count as depth 1 and still obey scope and globs.

## `respectRobotsTxt` (type: `boolean`):

Skip URLs that the site's robots.txt disallows. Start URLs that are disallowed return a free ROBOTS_DISALLOWED row.

## `includeGlobs` (type: `array`):

Optional. Only follow URLs matching at least one glob, e.g. https://example.com/blog/\*\* (\*\* = anything, \* = anything except /). When set, it replaces Crawl scope. Start URLs are always fetched.

## `excludeGlobs` (type: `array`):

Optional. Never follow URLs matching any of these globs, e.g. **/tag/** or \*\*?page=\*.

## `extractMode` (type: `string`):

article = main content only (best for LLM/RAG); recall = keep more borderline text; full = whole <body> minus scripts/nav/footer.

## `chunkSize` (type: `integer`):

If > 0, also return `chunks`: the Markdown split on paragraph boundaries into pieces of about this many characters (ready for embeddings). 0 = off.

## `chunkOverlap` (type: `integer`):

Characters repeated between consecutive chunks (max half of chunk size).

## `includeLinks` (type: `boolean`):

Keep hyperlinks inside the Markdown and return a `links` list of absolute URLs found on each page (max 1000).

## `maxConcurrency` (type: `integer`):

Pages fetched in parallel. Lower it for small or slow sites.

## `timeoutSecs` (type: `integer`):

HTTP timeout per attempt. 5xx/429/network errors are retried twice with backoff.

## `maxPageSizeMb` (type: `integer`):

Stop downloading a page after this many MB (the rest is cut, row gets truncated = true).

## `acceptLanguage` (type: `string`):

Preferred page language sent to the server, e.g. en-US,en;q=0.9 or de-DE.

## `maxResults` (type: `integer`):

Maximum number of pages converted to Markdown for the whole run. You are only charged for delivered pages; error / blocked rows are free.

## Actor input object example

```json
{
  "startUrls": [
    "https://docs.python.org/3/tutorial/index.html"
  ],
  "crawlScope": "prefix",
  "maxDepth": 3,
  "useSitemap": true,
  "respectRobotsTxt": true,
  "includeGlobs": [],
  "excludeGlobs": [],
  "extractMode": "article",
  "chunkSize": 0,
  "chunkOverlap": 0,
  "includeLinks": false,
  "maxConcurrency": 10,
  "timeoutSecs": 30,
  "maxPageSizeMb": 5,
  "acceptLanguage": "en-US,en;q=0.9",
  "maxResults": 15
}
```

# Actor output Schema

## `results` (type: `string`):

One row per result, plus free error rows (type = error).

## `summary` (type: `string`):

Counts for this run (SUMMARY record).

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "startUrls": [
        "https://docs.python.org/3/tutorial/index.html"
    ],
    "maxResults": 15
};

// Run the Actor and wait for it to finish
const run = await client.actor("henrycrawl/website-crawler-markdown").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "startUrls": ["https://docs.python.org/3/tutorial/index.html"],
    "maxResults": 15,
}

# Run the Actor and wait for it to finish
run = client.actor("henrycrawl/website-crawler-markdown").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    "https://docs.python.org/3/tutorial/index.html"
  ],
  "maxResults": 15
}' |
apify call henrycrawl/website-crawler-markdown --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,henrycrawl/website-crawler-markdown"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/PMnllrAeMaAW44kCP/builds/Rlwrv3nDOWNDSz1hh/openapi.json
