# Website to Markdown Crawler (`vizellie/website-to-markdown-crawler`) Actor

Crawls a public website and saves clean Markdown for AI tools, docs and content audits. Same-site pages only, with robots.txt checked on every URL, heading-aware chunks, repeated boilerplate removed, and an optional change-only recrawl.

- **URL**: https://apify.com/vizellie/website-to-markdown-crawler.md
- **Developed by:** [Vi Zellie](https://apify.com/vizellie) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 page saveds

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 to Markdown Crawler

Crawl a public website and save clean Markdown for an AI tool, a docs review or a content audit.

Give it one or more start URLs. It stays on those hosts, checks robots.txt before every fetch, and saves the page text with the title, the description, the language, the canonical URL, a word count and the fetch status. Duplicate pages and canonical copies are skipped.

### Who it is for

People who keep a docs site, a handbook or a small public website and want the text in a form a tool can read. Also useful before an audit, when you want one file for the whole site and a short list of what was skipped.

Use it on a site you own, or on a site whose robots.txt allows this crawler. The sample start URL is the Python tutorial on docs.python.org.

### What you get

- One row per saved page, with status `ok` or `removed`.
- The page as Markdown, plus the title, the description, the language, the canonical URL, the word count and the fetch status.
- Chunks split on headings. Each chunk has the heading path, the source URL and an estimated token count.
- Menus, footers, cookie notices and "Skip to main content" lines removed when the same block shows up across the site.
- A site-wide index in the llms.txt style, and one combined Markdown file, both in this run's default key-value store. `OUTPUT` has the download links.
- A skipped-pages report in `OUTPUT`: blocked by robots.txt, out of scope, duplicate, non-HTML, too large, plus failed fetches and PDFs with no text layer.
- With **Changes only** on, a later run returns added, changed and removed pages. Unchanged pages are not saved and are not charged.

Linked PDFs on the same site can be read when you turn **PDF text** on. A PDF is used only when it already has a text layer. There is no image reading. Files over 2 MB are skipped.

### Tutorial

1. Add one or more **Start URLs**. The sample is `https://docs.python.org/3/tutorial/index.html`. Stay with sites you own, or sites that allow this crawler.
2. Set **Max depth** and **Max pages**. Depth 0 reads the start URLs only. The sample depth is 1 and the cap is 10 pages. The hard cap is 50 pages.
3. Optionally add **Include URL patterns** and **Exclude URL patterns**. A pattern uses `*` as a wildcard, for example `*/tutorial/*`.
4. Leave **Chunk size** at 500 and **Chunk overlap** at 40, or set your own. The size is an estimate, about four characters to a token.
5. Leave **Changes only** off for a full crawl. Turn it on, and set **State store name**, when you want the next run to return only what changed. Leave the name empty to use `website-markdown-state`.
6. Leave **PDF text** off unless you want text from linked PDFs on the same site.
7. Run the Actor. Open the Pages view for the rows. The `OUTPUT` record lists skipped URLs, how many rows were saved, how many were charged, and the download links for `LLMS` and `MARKDOWN`.

A page that fails, a duplicate, and an unchanged page are not charged.

### Example input

```json
{
  "startUrls": ["https://docs.python.org/3/tutorial/index.html"],
  "maxDepth": 1,
  "maxPages": 10,
  "includePatterns": ["/3/tutorial/*"],
  "excludePatterns": [],
  "concurrency": 2,
  "chunkSize": 500,
  "chunkOverlap": 40,
  "changesOnly": false,
  "stateStoreName": "",
  "extractPdfs": false
}
```

### Example output

```json
{
  "status": "ok",
  "change": "full",
  "url": "https://docs.python.org/3/tutorial/index.html",
  "canonicalUrl": "https://docs.python.org/3/tutorial/index.html",
  "title": "The Python Tutorial",
  "description": "Python is an easy to learn, powerful programming language.",
  "language": "en",
  "wordCount": 420,
  "fetchStatus": 200,
  "kind": "html",
  "chunkCount": 2,
  "chunks": [
    {
      "text": "# The Python Tutorial\n\nPython is an easy to learn, powerful programming language.",
      "tokenCount": 20,
      "headingPath": ["The Python Tutorial"],
      "sourceUrl": "https://docs.python.org/3/tutorial/index.html"
    }
  ],
  "markdown": "# The Python Tutorial\n\nPython is an easy to learn, powerful programming language.",
  "note": "",
  "retrievedAt": "2026-10-31T12:00:00.000Z"
}
```

The numbers above show the shape of a row. A real run fills them from the pages it fetched. `change` is `full` on a normal crawl. On a changes-only run it is `added`, `changed` or `removed`.

`OUTPUT` also holds the skipped-page counts and the download links. The links look like this:

```json
{
  "saved": 10,
  "charged": 10,
  "llmsKey": "LLMS",
  "llmsUrl": "https://api.apify.com/v2/key-value-stores/STORE/records/LLMS",
  "markdownKey": "MARKDOWN",
  "markdownUrl": "https://api.apify.com/v2/key-value-stores/STORE/records/MARKDOWN",
  "skipped": {
    "blockedByRobots": 0,
    "outOfScope": 2,
    "duplicate": 1,
    "nonHtml": 3,
    "tooLarge": 0,
    "failed": 0,
    "noTextLayer": 0,
    "textUnread": 0,
    "blocked": 0
  }
}
```

### Pricing

You pay a small fee when the run starts, then a fee for each page that is actually saved. The dataset itself is not charged again. Duplicate pages, unchanged pages and failed pages are free. A removed page is listed and is not charged, because no new page text was saved.

| What | Price |
|---|---|
| Run start | $0.00005 |
| Page saved | $0.002 |

**Examples**

- Ten saved pages: 10 x $0.002 = **$0.020**, plus the $0.00005 start fee. The total is **$0.02005**.
- A recrawl that saves 2 changed pages: 2 x $0.002 = **$0.004**, plus the $0.00005 start fee. The total is **$0.00405**. Unchanged pages add nothing.
- A run that saves nothing: **$0.00005**.

Use **Max pages** and the maximum cost per run to cap a single run. If this ever differs from the Pricing tab, the Pricing tab applies.

### Limits

- At most 50 pages in a run, and at most 10 start URLs. The sample uses 10 pages.
- Depth is 0 to 5. The sample uses 1.
- A page is capped at 1.5 MB. A PDF is capped at 2 MB. A sitemap over 1 MB is skipped.
- Only public http and https on ports 80 and 443. Private, loopback, link-local and metadata addresses are blocked, including on a redirect. A chain stops after 3 redirects.
- Each request times out after 15 seconds. Requests to one host are at least 200 ms apart. A crawl-delay in robots.txt is honoured, up to 5 seconds.
- The crawler sends the name `WebsiteToMarkdownCrawler` with each request.
- Scripts are removed from the page before the Markdown is built.
- If the run is close to its time limit, it stops and keeps the pages already saved.

### No personal data

This Actor does not collect personal data beyond the page content you asked it to save.

- It stores the Markdown of the pages it saves, because that text is the result.
- It does not pull emails or phone numbers out into their own fields. Email addresses in the title, the description, and the Markdown are replaced with `[email removed]`. Phone numbers that are part of the page are left as written.
- The run summary, the skipped-page list and the logs do not copy the page text.
- A blocked address is counted. It is not written into the summary.
- The state store, when you turn **Changes only** on, keeps a short record of each page so the next run can compare. It does not keep the page text.

Do not point it at a private URL or a page you are not allowed to read.

### FAQ

**What if robots.txt disallows a path?**
That URL is skipped, listed as blocked by robots.txt, and not charged. Other allowed pages are still saved. `/robots.txt` is read for every host you start from, and the rule is checked again for every URL, including each redirect. Include and exclude patterns do not apply to `robots.txt`, `sitemap.xml` or `llms.txt`.

**What if robots.txt cannot be reached?**
A missing file, including 404 and 410, means the crawl is allowed. Other client errors are treated the same way, except 401 and 403, which skip the host. If the file cannot be reached because of a server error, a timeout, or a network error, that host is not crawled. Those pages are listed as blocked by robots.txt and are not charged.

**What if the same text is published at two URLs?**
The second one is a duplicate and is not charged. A page whose canonical URL points at another page on the same site is treated the same way.

**Why does the first changes-only run mark every page as added?**
The state store is empty until a run has saved a snapshot. The next run with the same store name can flag added, changed and removed pages. Leave **Changes only** off and no named store is opened.

**What if a page did not change?**
On a changes-only run that page is not saved and is not charged. The snapshot is kept so the next run can compare again.

**What about a PDF?**
Turn **PDF text** on. A linked PDF on the same site is saved when its text can be read and the file is under 2 MB. A file with no text layer, or text that could not be read, is skipped and is not charged. There is no image reading.

**Where are the combined files?**
In this run's default key-value store, under `LLMS` and `MARKDOWN`. The download links are in `OUTPUT`.

### Next additions

- More of the same kind.
- Broader coverage.
- Small follow-ups later.

### Feedback

Missing a field? Open an issue on the Actor's Issues tab.

# Actor input Schema

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

Public http or https pages to start from. The crawl stays on those hosts. Use a site you own, or a site whose robots.txt allows WebsiteToMarkdownCrawler. At most 10 start URLs. Private addresses are blocked.

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

How many links away from a start URL to follow. 0 reads the start URLs only. The ceiling is 5.

## `maxPages` (type: `integer`):

Most pages fetched in one run, from 1 to 50. The sample uses 10. URLs past the cap are not fetched and are not charged.

## `includePatterns` (type: `array`):

Optional patterns. When this list is not empty, a URL path must match one of them. Use \* as a wildcard. The sample keeps the Python tutorial. robots.txt, sitemap.xml and llms.txt are still read.

## `excludePatterns` (type: `array`):

Optional patterns. A matching URL is out of scope and is not charged. \* is a wildcard.

## `concurrency` (type: `integer`):

How many fetches to run at once, from 1 to 4. Requests to the same host are still spaced out, and a crawl-delay is honoured up to 5 seconds.

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

Target size of a chunk, in estimated tokens. The ceiling is 2000. A heading starts a new chunk when the current one is already full.

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

Estimated tokens repeated at the start of the next chunk when a long section is split. The overlap is kept at or below half the chunk size.

## `changesOnly` (type: `boolean`):

When on, compare this crawl with the snapshot in the state store and return only added, changed or removed pages. Unchanged pages are not charged. Leave this off for a full crawl. The default run does not open a named store.

## `stateStoreName` (type: `string`):

Named key-value store for the snapshot. Used only when Changes only is on. Letters, digits and hyphens. Leave empty to use website-markdown-state. If this token cannot open that store, the run uses the default store and still finishes.

## `extractPdfs` (type: `boolean`):

Also read linked PDF files on the same site when they contain a text layer. Scanned pages are skipped. Each file is capped at 2 MB.

## Actor input object example

```json
{
  "startUrls": [
    "https://docs.python.org/3/tutorial/index.html"
  ],
  "maxDepth": 1,
  "maxPages": 10,
  "includePatterns": [
    "/3/tutorial/*"
  ],
  "concurrency": 2,
  "chunkSize": 500,
  "chunkOverlap": 40,
  "changesOnly": false,
  "stateStoreName": "",
  "extractPdfs": false
}
```

# Actor output Schema

## `pages` (type: `string`):

One row per saved page, with title, language, word count and fetch status.

## `pageDetails` (type: `string`):

The same rows, including Markdown, the canonical URL and the chunks.

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

The OUTPUT record, including the skipped-page report and the download links.

## `llmsFile` (type: `string`):

A site-wide index in the llms.txt style, with one link per saved page.

## `markdownFile` (type: `string`):

Every saved page in one Markdown file.

# 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"
    ],
    "maxDepth": 1,
    "maxPages": 10,
    "includePatterns": [
        "/3/tutorial/*"
    ],
    "concurrency": 2,
    "chunkSize": 500,
    "chunkOverlap": 40,
    "changesOnly": false,
    "stateStoreName": "",
    "extractPdfs": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("vizellie/website-to-markdown-crawler").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"],
    "maxDepth": 1,
    "maxPages": 10,
    "includePatterns": ["/3/tutorial/*"],
    "concurrency": 2,
    "chunkSize": 500,
    "chunkOverlap": 40,
    "changesOnly": False,
    "stateStoreName": "",
    "extractPdfs": False,
}

# Run the Actor and wait for it to finish
run = client.actor("vizellie/website-to-markdown-crawler").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"
  ],
  "maxDepth": 1,
  "maxPages": 10,
  "includePatterns": [
    "/3/tutorial/*"
  ],
  "concurrency": 2,
  "chunkSize": 500,
  "chunkOverlap": 40,
  "changesOnly": false,
  "stateStoreName": "",
  "extractPdfs": false
}' |
apify call vizellie/website-to-markdown-crawler --silent --output-dataset

```

## MCP server setup

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

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/3iammdfbh8HG5Kht2/builds/KAK84cHBdrhokl3MH/openapi.json
