# Web To Markdown Llm (`vujofix/web-to-markdown-llm`) Actor

- **URL**: https://apify.com/vujofix/web-to-markdown-llm.md
- **Developed by:** [Oleksii Tereshchenko](https://apify.com/vujofix) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 results

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

## Web to LLM Markdown & RAG Clean Extractor

> 🚀 **Convert any website, documentation hub, or blog into clean, token-optimized Markdown ready for LLMs, Claude, GPT-4, Cursor, and RAG pipelines.**

***

### 💡 Why this Actor?

When scraping the modern web for AI context windows or Vector DBs (Pinecone, Qdrant, Chroma), standard scrapers dump bloated HTML full of:

- Cookie consent banners & popups
- Navbars, footers & sidebar links
- Tracking scripts, styles & SVG icons
- Ads, promotional banners & social share widgets

This boilerplate **wastes up to 70% of your LLM context tokens** and severely degrades model reasoning.

**Web to LLM Markdown Extractor** solves this by:

1. **Intelligently identifying main content** (`<article>`, `<main>`, `#content`, `.docs-content`, etc.).
2. **Aggressively stripping boilerplate** (cookie banners, scripts, navigation, ads).
3. **Converting to clean, semantic Markdown** (ATX headings, fenced code blocks, bullet points).
4. **Calculating token & word metrics** so you know exact context costs upfront.
5. **Lightweight & Blazing Fast**: Pure HTTP crawler powered by Crawlee & Cheerio. No heavy browser overhead, uses minimal RAM (128–256 MB), and crawls hundreds of pages in seconds.

***

### ⚙️ Features

- 📑 **Single URL or Full Domain Crawling**: Scrape a single article or crawl an entire documentation site with `maxDepth` control.
- 🎯 **Domain-Bound Crawling**: Stays on the same hostname so you don't leak into external sites.
- 🧹 **Deep Noise Filtering**: Automatically drops cookies, footers, headers, ads, and inline styles.
- ⚡ **Token Saver Mode (`stripImages`)**: Strip `![alt](url)` image tags to minimize LLM token usage.
- 🔗 **Clean Text Mode (`stripLinks`)**: Convert hyperlinks into plain text for pure text embedding.
- 📊 **Token & Word Metrics**: Provides instant `tokenEstimate` and `wordCount` for every page.

***

### 📥 Input Configuration

| Parameter | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `startUrls` | Array | `["https://docs.github.com/en/get-started"]` | Starting URLs or docs hubs to process. |
| `maxPages` | Integer | `10` | Maximum number of pages to crawl and convert. |
| `maxDepth` | Integer | `1` | Crawl depth: `0` = only given URLs, `1` = follow internal links 1 level deep. |
| `stripImages` | Boolean | `true` | Remove image tags to save prompt context tokens. |
| `stripLinks` | Boolean | `false` | Convert hyperlinks to plain text. |

#### Example Input:

```json
{
  "startUrls": [
    { "url": "https://docs.github.com/en/get-started" }
  ],
  "maxPages": 15,
  "maxDepth": 1,
  "stripImages": true,
  "stripLinks": false
}
```

***

### 📤 Output Dataset Format

Each record in the Apify dataset contains clean metadata and pure Markdown:

```json
{
  "url": "https://docs.github.com/en/get-started",
  "title": "Get started with GitHub documentation",
  "description": "Learn how to use GitHub with step-by-step guides and documentation.",
  "author": null,
  "language": "en",
  "markdown": "# Get started with GitHub documentation\n\nGitHub is a code hosting platform for version control and collaboration...\n\n## Quickstart\n\n1. Sign up for GitHub\n2. Create a repository\n3. Start collaborating\n",
  "wordCount": 384,
  "tokenEstimate": 450,
  "crawledAt": "2026-09-17T15:10:00.000Z"
}
```

***

### 🛠️ Python & LangChain Quickstart

Use the Apify Python client to ingest web docs directly into your RAG pipeline:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

## Run the Actor
run = client.actor("vujofix/web-to-markdown-llm").call(run_input={
    "startUrls": [{"url": "https://docs.stripe.com/api"}],
    "maxPages": 20,
    "maxDepth": 1,
    "stripImages": True
})

## Fetch cleaned Markdown records
dataset = client.dataset(run["defaultDatasetId"]).list_items().items
for page in dataset:
    print(f"Title: {page['title']}")
    print(f"Estimated Tokens: {page['tokenEstimate']}")
    # Pass page['markdown'] to your Vector Store or LLM context
```

***

### 💰 Pricing

- **Pay-Per-Event**: **$2.00 / 1,000 pages**
- Incredibly cost-effective: A full documentation scrape of 100 pages costs just **$0.20**, saving hours of manual cleanup and hundreds of dollars in wasted LLM tokens.

***

### 🛡️ License

Apache-2.0

# Actor input Schema

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

URLs of websites, documentation, or articles to convert into clean LLM-ready Markdown.

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

Maximum number of pages to process.

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

0 = only the specified URLs, 1 = follow internal links 1 level deep.

## `stripImages` (type: `boolean`):

Remove image markdown tags (![alt](url)) to save LLM prompt context tokens.

## `stripLinks` (type: `boolean`):

Convert markdown links [text](url) to plain text to reduce clutter.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://docs.github.com/en/get-started"
    }
  ],
  "maxPages": 10,
  "maxDepth": 1,
  "stripImages": true,
  "stripLinks": false
}
```

# 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.github.com/en/get-started"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("vujofix/web-to-markdown-llm").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.github.com/en/get-started" }] }

# Run the Actor and wait for it to finish
run = client.actor("vujofix/web-to-markdown-llm").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.github.com/en/get-started"
    }
  ]
}' |
apify call vujofix/web-to-markdown-llm --silent --output-dataset

```

## MCP server setup

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

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/fwPD0yAgSXTNZK5KD/builds/JmmaBnfgsUc8yEZxt/openapi.json
