# Website Content Crawler to Markdown (Whole Site for AI, RAG) (`locaihost/website-content-crawler`) Actor

Crawls a whole site into clean Markdown, text or HTML per page for RAG: main content only, tables kept, PDF and DOCX links converted, heading-path chunks, only-changed mode for daily runs. One free summary row. $2.00 per 1,000 pages.

- **URL**: https://apify.com/locaihost/website-content-crawler.md
- **Developed by:** [locaihost data](https://apify.com/locaihost) (community)
- **Categories:** AI, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.10 / 1,000 pages

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 Content Crawler to Markdown (Whole Site for AI, RAG)

Crawl a whole website into one clean row per page: main content as Markdown (or plain text, or cleaned HTML), title, description, language, publish date, word count, and optional chunks with their heading path, ready for a vector store. PDF and DOCX files linked on the site are converted to Markdown too. Turn on only-changed mode and a daily schedule returns just the pages that changed since the run before.

### How do I start?

Paste this into the input (JSON tab) and press Start:

```json
{
    "startUrls": ["https://docs.apify.com/"],
    "maxPages": 20,
    "outputFormat": "markdown"
}
```

That run reads 20 pages of the site in well under a minute: start page first, then the pages it links to, plus anything the site's sitemap lists. The crawl stays on the same site by default, one page at a time, and respects the site's robots.txt.

### What does each row contain?

| Field | What it is |
|---|---|
| `url` | The page's final address after redirects |
| `depth` | Link hops from a start page; start pages are 0 |
| `referrer` | The page this one was linked from, or the sitemap URL for sitemap-found pages |
| `status` | `ok` for a readable page, or one of the free outcomes: `blocked`, `error`, `empty` |
| `httpStatus` | The HTTP status the page answered with |
| `title`, `description`, `language` | The page's own title, meta description and language |
| `canonicalUrl` | The address the page declares as its canonical one |
| `publishedAt` | Publish date from the page's metadata, ISO format (UTC) |
| `markdown` | The page's main content as clean Markdown: headings, lists, links and tables kept, navigation and footers removed |
| `text` | The same content as plain text |
| `html` | The cleaned main-content HTML the Markdown was made from |
| `wordCount` | Words of main content |
| `truncated` | True when the stored text was cut at the maximum characters per page |
| `chunks` | The Markdown split into chunks of roughly your chunk size, each with its heading path and page numbers, when a chunk size is set |
| `contentHash` | Hash of the page's full content: how change is detected between runs |
| `changed` | True when this run is the first to see the page or its content moved since the last run |
| `crawledAt` | When the page was read, ISO format (UTC) |

Depending on the output format you pick, `markdown`, `text` or both carry the content (`html` holds the cleaned HTML in the html format). The hash and word count are always computed from the same full content, so they never depend on the format.

Example page row (shortened):

```json
{
    "type": "page",
    "url": "https://example.com/docs/getting-started",
    "depth": 1,
    "referrer": "https://example.com/",
    "status": "ok",
    "httpStatus": 200,
    "title": "Getting started",
    "description": "Set up your first crawl in five minutes.",
    "language": "en",
    "publishedAt": "2026-02-10T00:00:00.000Z",
    "markdown": "# Getting started\n\nSet up your first crawl in five minutes...",
    "wordCount": 412,
    "contentHash": "9f86d081884c7d65",
    "changed": true,
    "crawledAt": "2026-11-14T06:00:00.000Z"
}
```

### Which rows are free?

Pages that did not read are still rows, because "the page is gone" is information you asked for by crawling it, but they are never charged: a blocked page (`status: "blocked"`), a broken one (`"error"`, with the reason in `markdown`), and an empty one (`"empty"`). Every run also ends with one summary row (`type: "summary"`, never charged): pages discovered, read and returned, new or changed, skipped as unchanged, skipped by robots.txt, blocked, broken or empty, words total, and a plain note when nothing was found. Use the **Crawl summary** view to see it on its own.

### What makes it different?

- **RAG chunks with heading paths.** Set a chunk size and each page arrives cut into chunks of roughly that many tokens, each carrying its heading path (`["Docs", "Authentication", "API keys"]`) so a vector store keeps the context. Tables are split by rows with the header repeated. No rival chunks for you.
- **Only changed pages, for daily runs.** Every page's content hash is kept in a named key-value store. Turn on **Only changed pages** and a scheduled run returns just the new and moved pages; unchanged pages are skipped and cost nothing. The `changed` flag and the previous hash are on every row either way.
- **PDF and DOCX pages in the same crawl.** A PDF or DOCX linked on the site (or given as a start URL) is converted to Markdown with page markers, and chunked like any other page, not left behind as a file to post-process.
- **Markdown, text, HTML or both, per run.** Same crawl, same hashes, whichever format your pipeline wants.
- **Polite by default.** One page at a time per site, robots.txt respected, sitemap used, links to images and scripts never followed. A site that pushes back ends the run cleanly with the pages it already read.

### How much does it cost?

$2.00 per 1,000 pages, with one paid event, "page", charged once per readable page row. Blocked, broken and empty pages are free, the summary row is free, and a crawl that finds nothing costs nothing. Larger Apify plans pay less per page (shown on the Pricing tab).

The run stops cleanly at your maximum charge and keeps everything read so far.

**Free Apify plan:** up to 100 pages per run. Any paid Apify plan removes the limit.

### Which inputs can I use?

| Input | What it does |
|---|---|
| `startUrls` | Page addresses to start from. Each may be a bare domain; https:// is added. |
| `maxPages` | Stop after this many pages read (default 20, up to 5,000 a run). |
| `maxDepth` | How many link hops to follow. 0 reads only the start pages. |
| `includeGlobs`, `excludeGlobs` | Glob lists the pages must match (or not match): a path such as `/docs/**`, or a full address such as `https://example.com/blog/**`. `{"glob": "..."}` entries and the names `includeUrlGlobs`/`excludeUrlGlobs` are read too. Start pages are always read. |
| `outputFormat` | `markdown`, `text`, `html` or `markdown+text`. |
| `onlyChanged` | Return only pages new or changed since the last run of the same start URLs and format. |
| `useSitemap` | On by default: read the sitemap the site publishes and add its pages. |
| `respectRobots` | On by default: skip pages the site's robots.txt does not allow. |
| `chunkSize` | Split each page into chunks of roughly this many tokens. 0 (the default) turns chunks off. |
| `removeSelectors` | CSS selectors of elements to strip before extraction. Navigation and footers are always removed. |
| `maxCharsPerPage` | Cut each page's stored text at this many characters and mark the row truncated. 0 means no limit. |
| `sameDomainOnly` | On by default: follow only links on the start page's own domain. Turn off to follow external links too. |

Inputs written for another crawler still work: `url` fills `startUrls`, `maxCrawlPages` fills `maxPages`, `maxCrawlDepth` fills `maxDepth` (each only when the field it fills was left at its default), and `crawlerType` is simply not needed here, because pages are read over plain HTTP, which is also why this Actor is fast and cheap.

### How do I get only new or changed pages every day?

1. Save your input as a task, with **Only changed pages** turned on.
2. Add a daily schedule to the task.
3. Each run returns only pages that are new or whose content moved since the run before. The summary row counts the ones it skipped.

Changing the start URLs or the output format starts a separate memory, so two crawls never hide each other's pages.

### What happens when something goes wrong?

- Bad input (empty, a malformed address, an unknown format) ends the run with a clear message and charges nothing.
- A site that refuses requests (403, a bot wall, a login page) ends the run with the pages read so far, each blocked page a free row, and a message saying so. Re-run later for the rest.
- A page that fails to convert becomes a free error row; the crawl carries on.
- The run stops before your maximum charge or its time limit runs out, and saves everything read.

### Can I call it from an agent or my own code?

Yes. It works through the Apify API, the Apify MCP server and the Apify client libraries, with the same input as above. The default 20-page run finishes in well under a minute. Feed the rows straight into a vector store: with a chunk size set, each chunk's `text`, `headingPath` and page URL are all a retrieval index needs.

### Is it legal to crawl a website?

The Actor reads public pages, the same ones anyone's browser can see without signing in. It never logs in and never sends account cookies. Whether you may crawl and reuse a given site's content is yours to decide: check the site's terms and robots.txt before a big crawl, take only what you need, and mind copyright and database rights where they apply. Crawl your own site, or sites you are allowed to read.

### Questions or problems?

Open an issue on the Issues tab and we will answer within a day. If the Actor helped, a rating on the Store helps other people find it.

# Changelog

This Actor's version history is a separate document: https://apify.com/locaihost/website-content-crawler/changelog.md

# Actor input Schema

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

Page addresses to start from, as links or bare domains (https:// is added). The crawl stays on the same site by default.

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

Stop after this many pages read. The free plan returns up to 100 pages a run.

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

How many link hops from a start page to follow. 0 reads only the start pages themselves.

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

When set, only pages matching at least one glob are crawled, for example /docs/\*\* or https://example.com/blog/\*\*. Start pages are always read.

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

Pages matching one of these globs are skipped, for example /search/\*\* or https://example.com/print/\*\*.

## `outputFormat` (type: `string`):

What each row's content field holds. Markdown keeps headings, lists, links and tables.

## `onlyChanged` (type: `boolean`):

Return only pages that are new or whose content changed since the last run of the same start URLs and format. Unchanged pages are skipped for free. Good with a daily schedule.

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

Read the sitemap the site publishes (from robots.txt or /sitemap.xml) and add its pages to the crawl.

## `respectRobots` (type: `boolean`):

Skip pages the site's robots.txt does not allow. Leave on unless you own the site or are allowed to crawl it.

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

Split each page's Markdown into chunks of roughly this many tokens, each with its heading path, ready for a vector store. 0 turns chunks off.

## `removeSelectors` (type: `array`):

CSS selectors of elements to strip before extraction, for example .sidebar or #newsletter-banner. Navigation and footers are always removed.

## `maxCharsPerPage` (type: `integer`):

Cut each page's stored text at this many characters and mark the row truncated. 0 means no limit.

## `sameDomainOnly` (type: `boolean`):

Follow only links on the start page's own domain (www and subdomains count as the same site). Turn off to follow external links too.

## Actor input object example

```json
{
  "startUrls": [
    "https://docs.apify.com/"
  ],
  "maxPages": 20,
  "maxDepth": 3,
  "includeGlobs": [],
  "excludeGlobs": [],
  "outputFormat": "markdown",
  "onlyChanged": false,
  "useSitemap": true,
  "respectRobots": true,
  "chunkSize": 0,
  "removeSelectors": [],
  "maxCharsPerPage": 0,
  "sameDomainOnly": true
}
```

# Actor output Schema

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

Every page: URL, title, word count, change state and links.

## `content` (type: `string`):

The Markdown (or text, or HTML) of each page, with metadata, chunks and hashes.

## `summaries` (type: `string`):

One free row per run: pages found, read, returned and skipped, and the stop reason.

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

Counts, anything that failed, and cost.

# 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.apify.com/"
    ],
    "maxPages": 20,
    "maxDepth": 3,
    "includeGlobs": [],
    "excludeGlobs": [],
    "removeSelectors": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("locaihost/website-content-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.apify.com/"],
    "maxPages": 20,
    "maxDepth": 3,
    "includeGlobs": [],
    "excludeGlobs": [],
    "removeSelectors": [],
}

# Run the Actor and wait for it to finish
run = client.actor("locaihost/website-content-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.apify.com/"
  ],
  "maxPages": 20,
  "maxDepth": 3,
  "includeGlobs": [],
  "excludeGlobs": [],
  "removeSelectors": []
}' |
apify call locaihost/website-content-crawler --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,locaihost/website-content-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/pzY0Qva70S2tbWjXY/builds/JzIajz1bkW3Ddv6XP/openapi.json
