# Website to Markdown & RAG Crawler: Clean Text for LLM (`laborious_rumor/ai-web-to-markdown-rag-scraper`) Actor

Convert entire websites into clean Markdown and semantic token chunks for LLMs, RAG vector pipelines, Claude, and OpenAI embeddings.

- **URL**: https://apify.com/laborious_rumor/ai-web-to-markdown-rag-scraper.md
- **Developed by:** [Lakshay Papneja](https://apify.com/laborious_rumor) (community)
- **Categories:** AI, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 extracted rag 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

## AI Website to Markdown & RAG Chunk Extractor

Convert any website, documentation portal, blog, or knowledge base into **clean Markdown**, **token-measured semantic RAG chunks**, and **structured JSON-LD metadata** ready for **LangChain, LlamaIndex, Pinecone, Qdrant, Weaviate, and MCP AI Agents**.

### Why Use This Actor?

- **10x Faster & Cheaper**: Uses lightweight HTTP + custom HTML-to-Markdown parsing instead of heavy headless browsers wherever possible.
- **Built-in Semantic Chunking**: Automatically splits pages by heading hierarchy (`#`, `##`, `###`) and configurable token windows (`chunkSizeTokens` + `chunkOverlapTokens`).
- **Complete Metadata**: Extracts OpenGraph tags, author, publish dates, and embedded `application/ld+json` schemas.
- **MCP Ready**: Designed to work seamlessly with `mcp.apify.com` so AI assistants can fetch and read live web documentation in a single tool call.

***

### 📖 How to Use (Step-by-Step)

1. **Set Start URLs**: Enter the root documentation or website URL (e.g. `https://docs.apify.com/platform/actors`).
2. **Configure Chunking**: Set `chunkSizeTokens` (default: 500) and `chunkOverlapTokens` (default: 50) to match your LLM embedding model.
3. **Set Noise Selectors**: Leave `removeSelectors` as default to strip headers, footers, cookie banners, navigation, and ads.
4. **Select Max Pages**: Choose how many pages to crawl (supports up to 1,000 pages).
5. **Run & Embed**: Download clean Markdown and token-measured chunk vectors for Pinecone, Weaviate, Chroma, or LangChain.

***

### 💰 Transparent Pay-Per-Event Pricing

- **Actor Start Fee**: **$0.00005**
- **Per Extracted Page**: **$0.002** ($2.00 per 1,000 clean markdown pages)
- **Free Monthly Tier**: Any Apify user with their $5/month free credit can crawl **up to 2,500 documentation pages completely free**.

***

### 🏆 Why Use This Actor vs Firecrawl or Crawl4AI?

| Feature | AI Web to Markdown RAG | Heavy Browser Crawlers |
| :--- | :--- | :--- |
| **Compute Footprint** | ⚡ **Ultra-light** (128MB–256MB RAM) | 💸 **Heavy** (4GB–8GB RAM) |
| **Semantic Chunking** | ✅ Built-in with token counter | ❌ Raw unchunked markdown |
| **Noise Filtering** | ✅ Strips ads, navs, footers, cookie banners | ⚠️ Boilerplate leaks |
| **JSON-LD Schema Extraction** | ✅ Preserves structured metadata | ❌ Stripped away |
| **MCP AI Server Integration** | ✅ Direct `mcp.apify.com` tool support | ❌ Requires custom API proxy |

***

### ❓ Frequently Asked Questions (FAQ)

#### Which LLM embedding models is this chunking optimized for?

The 500-token chunking with 50-token overlap is optimized for OpenAI `text-embedding-3-small`, `text-embedding-3-large`, Cohere `embed-english-v3.0`, and open-source Hugging Face BGE embeddings.

#### Does it follow internal links?

Yes, when `followInternalLinks` is enabled, it discovers same-origin links and crawls documentation hierarchies up to `maxPages`.

#### How are code blocks handled?

Code blocks (`<pre><code>`) are preserved intact with language identifiers, ensuring code examples remain uncorrupted for coding LLMs (Claude 3.5 Sonnet, GPT-4o, Cursor).

# Actor input Schema

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

List of URLs to extract clean Markdown and RAG chunks from.

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

Maximum number of pages to process.

## `followInternalLinks` (type: `boolean`):

Whether to automatically discover and crawl internal documentation/article links on the same domain.

## `chunkSizeTokens` (type: `integer`):

Target token count per semantic chunk for vector database ingestion (approx. 4 chars = 1 token).

## `chunkOverlapTokens` (type: `integer`):

Token overlap between consecutive chunks to preserve context.

## `removeSelectors` (type: `string`):

Comma-separated tags/selectors to remove before converting to Markdown.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://docs.apify.com/platform/actors"
    }
  ],
  "maxPages": 10,
  "followInternalLinks": false,
  "chunkSizeTokens": 500,
  "chunkOverlapTokens": 50,
  "removeSelectors": "nav, footer, header, script, style, noscript, iframe, .cookie-banner, .ads, #sidebar"
}
```

# 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.apify.com/platform/actors"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("laborious_rumor/ai-web-to-markdown-rag-scraper").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.apify.com/platform/actors" }] }

# Run the Actor and wait for it to finish
run = client.actor("laborious_rumor/ai-web-to-markdown-rag-scraper").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.apify.com/platform/actors"
    }
  ]
}' |
apify call laborious_rumor/ai-web-to-markdown-rag-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,laborious_rumor/ai-web-to-markdown-rag-scraper"
        }
    }
}
```

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/gcN6zAu9vbNtgBzIl/builds/OfY7gpttrhEmnA6sN/openapi.json
