# Website to Markdown Crawler for LLM and RAG (`extas_corp/website-to-markdown`) Actor

Crawl any website and get clean Markdown per page for LLMs, RAG and AI agents. Main-content extraction, sitemap support, URL filters, honors robots.txt. No browser, pay per page.

- **URL**: https://apify.com/extas_corp/website-to-markdown.md
- **Developed by:** [Extas Corp](https://apify.com/extas_corp) (community)
- **Categories:** AI, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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 for LLM and RAG

Turn any website into **clean Markdown, one record per page**, ready for LLM context, RAG vector stores, fine-tuning sets and AI agents. It strips navigation, footers, cookie banners and ads, keeps headings, lists, tables, code blocks and (optionally) links, and returns title, author, date and language as metadata.

- **Lightweight**: plain HTTP + main-content extraction (trafilatura). No browser, no proxies, so it is cheap and fast. Works on server-rendered pages (docs, blogs, wikis, news, product docs). It does not run JavaScript, so pure single-page apps may come back empty.
- **Polite by design**: obeys `robots.txt` (including Crawl-delay), identifies itself with a clear User-Agent, throttles per host. Pages blocked by robots.txt are reported as free `skipped` items.
- **Whole-site coverage**: follow links to a chosen depth and/or seed from `sitemap.xml`; include/exclude URL patterns; stay on the same host.
- **$1 per 1,000 pages.** Skipped pages and errors are never charged.

### Input examples

Convert one page:

```json
{ "startUrls": [{ "url": "https://docs.python.org/3/tutorial/index.html" }], "maxDepth": 0 }
```

Crawl a documentation section for a RAG index:

```json
{
  "startUrls": [{ "url": "https://docs.apify.com/academy" }],
  "maxPages": 200, "maxDepth": 3, "useSitemap": true,
  "includeUrlGlobs": ["https://docs.apify.com/academy/*"],
  "excludeUrlGlobs": ["*/changelog*"], "keepLinks": false
}
```

### Output

Each item: `type` (`page`, `skipped` or `error`), `url`, `finalUrl`, `depth`, `title`, `description`, `author`, `date`, `language`, `markdown`, `wordCount`, and `html` if requested.

```json
{ "type": "page", "url": "https://docs.python.org/3/tutorial/index.html", "title": "The Python Tutorial", "language": "en", "wordCount": 361, "markdown": "# The Python Tutorial\n\n..." }
```

### Use with the API

```bash
curl -X POST "https://api.apify.com/v2/acts/extas_corp~website-to-markdown/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"startUrls":[{"url":"https://example.com"}],"maxDepth":0}'
```

Works with LangChain, LlamaIndex, n8n, Make and the Apify MCP server.

### Pricing

| Event | Price |
| --- | --- |
| Page converted | $0.001 |

### Notes

- Only crawl content you are allowed to process. The Actor respects robots.txt, but you remain responsible for the site's terms and for copyright.
- Need PDFs, Word, Excel or PowerPoint instead of web pages? See [PDF to Markdown](https://apify.com/extas_corp/pdf-to-markdown) and [Document to Markdown](https://apify.com/extas_corp/document-to-markdown). Free browser tools: [hackthehydra.com](https://hackthehydra.com).

### Use cases

- **LLM and RAG**: index a whole documentation site or knowledge base as clean Markdown.
- **SEO and content audits**: pull titles, descriptions and body text of every page, filtered by URL pattern.
- **Research**: archive blogs, wikis or news sections in a readable, diffable format.

### Integrations

Python (Apify client):

```python
from apify_client import ApifyClient

client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("extas_corp/website-to-markdown").call(run_input={"startUrls": [{"url": "https://docs.python.org/3/tutorial/index.html"}], "maxPages": 20})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["title"], item["wordCount"])
```

**LangChain / RAG** (turn each result into a `Document`):

```python
from apify_client import ApifyClient
from langchain_core.documents import Document

client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("extas_corp/website-to-markdown").call(run_input={"startUrls": [{"url": "https://docs.python.org/3/tutorial/index.html"}], "maxPages": 20})
docs = [Document(page_content=i["markdown"], metadata={"source": i.get("url")})
        for i in client.dataset(run["defaultDatasetId"]).iterate_items() if i.get("markdown")]
```

**Make, Zapier, n8n**: add the Apify app, choose *Run Actor* (or *Run Actor and get dataset items*), set the Actor to `extas_corp/website-to-markdown` and map the JSON input. The same Actor can be started on a schedule from Apify itself, with a webhook to your own endpoint when the run finishes.

### FAQ

**Does it run JavaScript?** No. It fetches server-rendered HTML, which is why it is cheap. Pure single-page apps may come back empty.

**Does it respect robots.txt?** Yes, including Crawl-delay. Blocked pages are returned as free `skipped` items.

**Are failed pages charged?** No. Only pages converted to Markdown are charged.

**Do I need to pay to try it?** New Apify accounts include free monthly platform credit (about $5 on the free plan at the time of writing), so you can run the example input above and many more items before paying anything. You only pay the per-event price listed under Pricing; runs that return nothing or fail are not charged for the failed items.

# Actor input Schema

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

Pages to convert and start crawling from.

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

Stop after this many pages were converted. You are charged per converted page.

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

0 = only the start URLs, 1 = also pages they link to, and so on.

## `sameHostOnly` (type: `boolean`):

Only follow links on the hosts of the start URLs.

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

Also queue the URLs listed in the site's sitemap (found via robots.txt or /sitemap.xml). Best way to cover a whole docs site.

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

Only crawl URLs matching one of these glob patterns, e.g. https://example.com/docs/\*. Empty = all.

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

Skip URLs matching these glob patterns, e.g. *login* or */tag/*.

## `keepLinks` (type: `boolean`):

Turn off for plainer text, which saves tokens.

## `saveHtml` (type: `boolean`):

Add the original HTML of each page to the output item.

## `delaySecs` (type: `number`):

Politeness delay. A larger Crawl-delay in robots.txt wins.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://docs.python.org/3/tutorial/index.html"
    }
  ],
  "maxPages": 20,
  "maxDepth": 1,
  "sameHostOnly": true,
  "useSitemap": false,
  "excludeUrlGlobs": [
    "*changelog*"
  ],
  "keepLinks": true,
  "saveHtml": false,
  "delaySecs": 0.5
}
```

# Actor output Schema

## `results` (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/index.html"
        }
    ],
    "excludeUrlGlobs": [
        "*changelog*"
    ]
};

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

# Run the Actor and wait for it to finish
run = client.actor("extas_corp/website-to-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": [
    {
      "url": "https://docs.python.org/3/tutorial/index.html"
    }
  ],
  "excludeUrlGlobs": [
    "*changelog*"
  ]
}' |
apify call extas_corp/website-to-markdown --silent --output-dataset

```

## MCP server setup

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