# Website Content Crawler: Markdown & llms.txt for RAG, GPTs (`pikoulas/website-content-crawler`) Actor

Crawl a website or docs to clean Markdown for AI, LLMs, RAG and vector databases, plus the whole site as one knowledge file for custom GPTs, Claude Projects and NotebookLM, and an llms.txt. Skips tag, archive and link-list pages. Chunks, metadata, only changed pages on reruns. $0.10 per 1,000 pages.

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

## Pricing

from $0.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.

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: Markdown & llms.txt for RAG, GPTs

Crawl a website, a documentation site, a blog or a news section, and get each page's main content
as clean Markdown or plain text, and the whole site as **one knowledge file** to upload to a custom
GPT, a Claude Project, NotebookLM or Gemini, with an **llms.txt** indexing it. For RAG pipelines,
vector databases, chatbots and AI agents, at $0.10 per 1,000 pages:

- **The page's own content, not its chrome.** Menus, headers, footers, sidebars, cookie banners,
  share buttons, "related articles" and ads are left out; the article, docs or product text stays.
- **Content pages, not the lists that lead to them.** Tag, category, author, archive, search and
  numbered pages (`/page/2`), and pages that are mostly links to others, are crawled through for
  their links but not saved or charged. Of 150 pages of WordPress's news blog, 37 were such lists.
- **The whole site as one file:** `knowledge.md`, every page under its title and URL, and
  `llms.txt`, the pages listed with their descriptions in the [llmstxt.org](https://llmstxt.org)
  format. Both free, in the run's key-value store.
- **Markdown that keeps the structure:** headings, paragraphs, nested lists, tables, code blocks
  with their language, links (absolute), images, quotes and definition lists.
- **Metadata:** title, description, canonical URL, language, author, published and modified
  dates, site name and preview image, and the page's headings.
- **Chunks for embedding:** each page cut by its headings into chunks of the size you give, each
  with the headings it sits under and its token count.
- **Only what changed:** with a memory, a scheduled crawl gives, and charges for, just the pages
  that are new or whose content changed since the last one.
- **Crawling like Apify's Website Content Crawler:** start URLs and the pages under them, crawl
  depth and page limits, include and exclude URL globs, sitemaps, robots.txt, and a list of single
  pages fetched without following links.

It is fast: plain HTTP with a real browser's TLS fingerprint and no headless browser, so it goes as
fast as the site answers: 150 pages of WordPress's news blog took 10 seconds. It costs **$0.10 per
1,000 pages**.

### What people use it for

- **RAG and chatbots:** a product's docs, help center or blog as Markdown for a vector database,
  refreshed on a schedule.
- **Custom GPTs, Claude Projects and NotebookLM:** a site as one file to upload, not page by page.
- **llms.txt:** an index of a site's pages for AI agents, to publish on your own site.
- **LLM context and fine-tuning datasets:** clean text from whole sites, without the boilerplate
  that wastes tokens.
- **Content audits and SEO:** every page's title, description, canonical URL, headings and word
  count.
- **Monitoring:** a news section or a changelog, crawled daily.
- **Archiving:** a site's text in a format that diffs and searches well.

### How to crawl a website to Markdown

1. Click **Try for free**; Apify's free plan covers a first run.
2. Enter **Start URLs** (the crawl follows links to the pages under them) or **Single pages**
   (fetched as they are), and how many pages you want.
3. Click **Start**, then download the results as JSON, CSV, Excel or HTML, or read them through
   the API.

An input with more options:

```json
{
  "startUrls": [{"url": "https://fastapi.tiangolo.com/tutorial/"}],
  "urls": ["https://en.wikipedia.org/wiki/Large_language_model"],
  "maxCrawlDepth": 3,
  "maxCrawlPages": 500,
  "includeUrlGlobs": [{"glob": "https://fastapi.tiangolo.com/{tutorial,advanced}/**"}],
  "excludeUrlGlobs": [{"glob": "https://fastapi.tiangolo.com/**/security/**"}],
  "useSitemaps": true,
  "respectRobotsTxtFile": true,
  "outputFormats": ["markdown", "text"],
  "mainContentOnly": true,
  "includeImages": false,
  "removeElementsCssSelector": ".admonition.tip",
  "skipListingPages": true,
  "knowledgeFile": true,
  "chunkSize": 800,
  "trackChanges": true,
  "memory": "fastapi-docs",
  "maxConcurrency": 10
}
```

**Which pages:** a start URL crawls the pages under it, on the same site (with or without www.)
and in the same folder: `https://docs.python.org/3/tutorial/` crawls the tutorial, and a URL
ending in a file (`.../library/asyncio.html`) crawls its folder (`.../library/`). Include globs
replace that scope: `**` matches anything, `*` anything but `/`, `{a,b}` either. Exclude globs
always apply. `maxCrawlDepth` 0 fetches the start URLs (and sitemap pages) only. Listing pages are
followed but not saved; turn off **Skip listing pages** (`skipListingPages`) to have them too. The URLs
you give are saved either way.

**Keeping a knowledge base fresh:** turn on **New and changed pages only** (`trackChanges`) and
schedule the crawl. The first run gives every page and remembers a hash of each one's content
under the **Memory name** (`memory`). Each later run gives, and charges for, only the pages it
hasn't seen (`"change": "new"`) and those whose content changed (`"changed"`), so only they need
embedding again. Unchanged pages are still fetched, which a crawl must do to know, but cost
nothing. The memory is kept in your own account's key-value store `website-content-memory`; a
page not seen for 60 days is forgotten.

### The knowledge file and llms.txt

Each run puts the pages it saved into its key-value store, opened from the **Output** tab:

- **`knowledge.md`:** the site's name, then each page's Markdown under its URL and title, in URL
  order, ready to upload as one source. A site over 400,000 words or 5 MB is cut into parts,
  `knowledge-2.md` and on, each within what NotebookLM takes as one source.
- **`llms.txt`:** the site's name, its description, and each page as a link with its description,
  grouped by section:

```markdown
## Python documentation

> This library reference manual describes the standard library distributed with Python. ...

### Pages

- [argparse — Parser for command-line options, arguments and subcommands](https://docs.python.org/3/library/argparse.html): Source code: Lib/argparse.py ...
- [array — Efficient arrays of numeric values](https://docs.python.org/3/library/array.html): This module defines an object type ...
```

The site's name that ends every title ("— Python 3.14.7 documentation") is taken off. With **New and
changed pages only**, the files hold the pages that run gave. Through the API they are at
`https://api.apify.com/v2/key-value-stores/STORE_ID/records/knowledge.md`, `STORE_ID` being the
run's `defaultKeyValueStoreId`. **Knowledge file and llms.txt** (`knowledgeFile`) off leaves them out.

### Output

One item per page (Markdown and text shortened here):

````json
{
  "url": "https://docs.python.org/3/tutorial/controlflow.html",
  "crawl": {
    "loadedUrl": "https://docs.python.org/3/tutorial/controlflow.html",
    "loadedTime": "2026-09-28T19:35:16Z",
    "referrerUrl": "https://docs.python.org/3/tutorial/",
    "depth": 1,
    "httpStatusCode": 200
  },
  "metadata": {
    "canonicalUrl": "https://docs.python.org/3/tutorial/controlflow.html",
    "title": "4. More Control Flow Tools — Python 3.14.7 documentation",
    "description": "As well as the while statement just introduced, Python uses a few more that we will encounter in this chapter. ...",
    "author": null,
    "keywords": null,
    "languageCode": "en",
    "publishedAt": null,
    "modifiedAt": null,
    "siteName": "Python documentation",
    "image": "https://docs.python.org/3.14/_images/social_previews/summary_tutorial_controlflow_....png"
  },
  "markdown": "# 4. More Control Flow Tools\n\nAs well as the [`while`](https://docs.python.org/3/reference/compound_stmts.html#while) statement just introduced, Python uses a few more that we will encounter in this chapter.\n\n## 4.1. `if` Statements\n\nPerhaps the most well-known statement type is the [`if`](https://docs.python.org/3/reference/compound_stmts.html#if) statement. For example:\n\n```python3\n>>> x = int(input(\"Please enter an integer: \"))\nPlease enter an integer: 42\n>>> if x < 0:\n...     x = 0\n...     print('Negative changed to zero')\n...",
  "text": "4. More Control Flow Tools\n\nAs well as the while statement just introduced, Python uses a few more that we will encounter in this chapter. ...",
  "headings": [
    {"level": 1, "text": "4. More Control Flow Tools"},
    {"level": 2, "text": "4.1. if Statements"},
    {"level": 2, "text": "4.2. for Statements"}
  ],
  "wordCount": 5723,
  "tokens": 9871,
  "needsJavaScript": false,
  "warning": null
}
````

`html` (the content's cleaned HTML), `rawHtml` (the whole page as fetched) and `links` (every
link on the page with its text) are added when asked for, and with `chunkSize` the page's
`chunks`: \`{"index": 2, "headings": \["4. More Control Flow Tools", "4.2. for Statements"], "text":
"## 4.2. for Statements

The for statement in Python differs...", "tokens": 412}`. `tokens`counts about four characters a token. A single page that can't be loaded
comes with an`error\` ("Couldn't load the page: HTTP 404.", "Not a web page (application/pdf)")
and isn't charged.

### Use it as an API

One call runs it and returns the results as JSON (for runs under 5 minutes; longer ones start a
run and read its dataset). Apify's Python and JavaScript clients, LangChain and LlamaIndex
loaders, and its Make, Zapier and n8n integrations work the same way.

```bash
curl -X POST "https://api.apify.com/v2/acts/pikoulas~website-content-crawler/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"startUrls": [{"url": "https://docs.python.org/3/tutorial/"}], "maxCrawlPages": 5}'
```

AI agents can call it as a tool through Apify's MCP server: `https://mcp.apify.com?tools=pikoulas/website-content-crawler`.

### How much does it cost to crawl a website?

You pay **$0.0001 per page**, which is $0.10 per 1,000 pages. Pages with next to no text (apps
that need JavaScript, empty pages) are saved with a warning and not charged, and neither are
listing pages or pages that fail. The knowledge file and llms.txt are free. Runs that go through Apify's residential proxy also pay its traffic, $0.0012
per 100 KB; a docs page is 12–17 KB on the wire and a news article about 60 KB. There are no
monthly fees.

### Good to know

- **No JavaScript.** It reads the HTML a site sends, which for most sites (docs built with
  Sphinx, MkDocs, Docusaurus, Next.js or Nuxt, blogs, news, Wikipedia, shops) is the whole
  content. Apps that build their page in the browser (React, Vue or Angular without server
  rendering) come with `needsJavaScript: true`, next to no text and a warning, and aren't charged.
- **Bot checks.** Sites behind Cloudflare's or DataDome's challenge pages refuse plain HTTP
  clients; the log counts them. A proxy doesn't get past a challenge, but it helps with sites that
  block datacenter IPs.
- **robots.txt** is respected by default for the pages the crawl finds (the URLs you give are
  fetched either way), and a Crawl-delay is honoured up to 5 seconds a page.
- **Duplicates:** a URL is fetched once (tracking parameters and fragments aside), and a page
  whose content is the same as one already saved (the same page under another URL) is skipped.
- **Files:** PDFs, images, archives and other files are not crawled; plain-text and Markdown
  files (llms.txt, README.md) are saved as they are.
- `maxCrawlPages` counts the pages fetched, failed ones included; `maxResults` the pages saved.

### FAQ

#### Is it legal to crawl a website?

It fetches only public pages, without logging in, and respects robots.txt by default. Crawling
public data is generally legal, but personal data is protected by laws such as the GDPR and the
CCPA, and a site's terms may limit how you use its content. If you're unsure, ask a lawyer;
Apify's [Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/) is a good start.

#### Something missing or not working?

Open an issue on the **Issues** tab with the input you used, or ask there for a field you need.

If it does what you need, a review on the **Reviews** tab helps others find it.

#### Articles from other sites?

[Medium](https://apify.com/pikoulas/medium-articles-scraper) and [Substack](https://apify.com/pikoulas/substack) each have an Actor of their own.

# Actor input Schema

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

Where the crawl starts. It follows links to the pages under each start URL: same site (with or without www.) and the same folder, so https://docs.python.org/3/tutorial/ crawls the tutorial and nothing else. A URL ending in a file (.../library/asyncio.html) crawls its folder (.../library/).

## `urls` (type: `array`):

Pages fetched as they are, without following their links: each gives one result, or one saying why it couldn't be loaded.

## `maxCrawlDepth` (type: `integer`):

How many links away from a start URL the crawl goes. 0 for the start URLs (and sitemap pages) only.

## `maxCrawlPages` (type: `integer`):

Pages fetched in all, the ones that fail included. The run stops there.

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

Pages saved (and charged) in all. Leave empty for no limit other than max pages.

## `includeUrlGlobs` (type: `array`):

Follow only links matching one of these, in place of the start URLs' folders: https://example.com/blog/\*\* follows the blog, https://example.com/{docs,api}/\*\* two sections. \* is any characters but /, \*\* any characters. The start URLs are fetched either way.

## `excludeUrlGlobs` (type: `array`):

Never follow links matching one of these, e.g. https://example.com/**/tag/** or \*\*/*?page=*.

## `skipListingPages` (type: `boolean`):

Follow tag, category, author, archive, search, login and numbered pages (/page/2), and pages that are mostly links to others, without saving or charging for them, so you get the content and not the lists leading to it. The URLs you give are saved either way.

## `useSitemaps` (type: `boolean`):

Also crawl the pages the site's sitemaps list (from robots.txt, or /sitemap.xml), within the start URLs' folders or the include globs. Finds pages no link leads to.

## `respectRobotsTxtFile` (type: `boolean`):

Skip the pages the site's robots.txt disallows, and wait between pages as long as its Crawl-delay says (up to 5 seconds). The URLs you give are fetched either way.

## `keepUrlFragments` (type: `boolean`):

Treat URLs that differ after # as different pages. Only for sites whose pages are told apart by the fragment.

## `outputFormats` (type: `array`):

The page's content as Markdown (headings, lists, tables, code blocks and links kept), plain text, the cleaned HTML of its content, and the page's whole raw HTML.

## `mainContentOnly` (type: `boolean`):

Keep the page's main content: its article, docs or product text, without the menus, header, footer, sidebars, cookie banners and share buttons. Off keeps the whole page's text, the page's scripts and hidden parts still left out.

## `includeImages` (type: `boolean`):

Keep the content's images in the Markdown, as ![alt](url).

## `saveLinks` (type: `boolean`):

Add every link on the page, with its text.

## `knowledgeFile` (type: `boolean`):

Also put the pages saved into the run's key-value store as one Markdown file, knowledge.md, each page under its title and URL, to upload to ChatGPT (a custom GPT), Claude Projects, NotebookLM or Gemini, and an llms.txt indexing them. A site over 400,000 words is cut into parts (knowledge-2.md, ...), each one NotebookLM source. Free.

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

Also cut each page's content into chunks of up to this many tokens for embedding: by its headings, long sections between paragraphs, each chunk with the headings it sits under. 0 for none; 500 to 1,000 suits most embedding models.

## `removeElementsCssSelector` (type: `string`):

Elements to leave out of the content besides the page's chrome, e.g. .newsletter, #comments, figure.

## `keepElementsCssSelector` (type: `string`):

Take the content from these elements only, e.g. article .body or #main-text, in place of finding the main content.

## `trackChanges` (type: `boolean`):

Give, and charge for, only the pages no earlier run with the same memory gave, and those whose content changed since, so a scheduled crawl re-embeds only what moved. Unchanged pages are still fetched, but cost nothing.

## `memory` (type: `string`):

One per site or schedule, so two crawls don't share a memory. Kept in your account's key-value store website-content-memory; a page not seen for 60 days is forgotten.

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

Pages fetched from a site at the same time. Lower it for small or slow sites.

## `requestTimeoutSecs` (type: `integer`):

How long a page may take to load.

## `maxRequestRetries` (type: `integer`):

Times a page is asked again after a network error, a server error (5xx) or a 429.

## `proxyConfiguration` (type: `object`):

Not needed for most sites. Sites that refuse the run's IP can be crawled through Apify Proxy: datacenter IPs cost nothing extra, residential ones are charged per 100 KB fetched.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://docs.python.org/3/tutorial/"
    }
  ],
  "maxCrawlDepth": 20,
  "maxCrawlPages": 20,
  "skipListingPages": true,
  "useSitemaps": false,
  "respectRobotsTxtFile": true,
  "keepUrlFragments": false,
  "outputFormats": [
    "markdown",
    "text"
  ],
  "mainContentOnly": true,
  "includeImages": true,
  "saveLinks": false,
  "knowledgeFile": true,
  "chunkSize": 0,
  "trackChanges": false,
  "memory": "default",
  "maxConcurrency": 10,
  "requestTimeoutSecs": 30,
  "maxRequestRetries": 2,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

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

No description

## `knowledge` (type: `string`):

No description

## `llms` (type: `string`):

No description

# 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": [
        {
            "url": "https://docs.python.org/3/tutorial/"
        }
    ],
    "maxCrawlPages": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("pikoulas/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": [{ "url": "https://docs.python.org/3/tutorial/" }],
    "maxCrawlPages": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("pikoulas/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": [
    {
      "url": "https://docs.python.org/3/tutorial/"
    }
  ],
  "maxCrawlPages": 20
}' |
apify call pikoulas/website-content-crawler --silent --output-dataset

```

## MCP server setup

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