# Webpage to Markdown Converter for LLMs (`andok/markdown-extractor`) Actor

Convert any URL into clean Markdown text. Remove ads and navbars to perfectly format web content for AI and RAG ingestion.

- **URL**: https://apify.com/andok/markdown-extractor.md
- **Developed by:** [Andok](https://apify.com/andok) (community)
- **Categories:** AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.47 / 1,000 page converteds

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Web Page to Markdown Converter for LLMs

Convert any webpage into clean, structured Markdown optimized for LLMs and RAG pipelines. Stop wasting tokens on HTML boilerplate — get only the core content with metadata, ready for AI ingestion. Process hundreds of URLs in a single run with configurable concurrency.

### Features

- **Readability cleaning** — strips ads, navigation, sidebars, and footers using Mozilla Readability
- **Markdown formatting** — converts article HTML to well-structured Markdown with ATX headings and fenced code blocks
- **Bulk processing** — convert hundreds of URLs in a single run
- **Metadata extraction** — captures page title, author byline, and excerpt alongside the Markdown content
- **Redirect handling** — follows HTTP redirects and reports the final URL
- **Configurable concurrency** — control parallel processing from 1 to 50 simultaneous requests
- **Pay-per-event pricing** — pay only for pages successfully converted

### Input

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `urls` | `array` | Yes | — | List of webpage URLs to convert to Markdown |
| `timeoutSeconds` | `integer` | No | `15` | Maximum seconds to wait for each URL response |
| `concurrency` | `integer` | No | `10` | Number of URLs to process in parallel (1-50) |

#### Input Example

```json
{
  "urls": [
    "https://crawlee.dev/",
    "https://docs.apify.com/academy/web-scraping-for-beginners"
  ],
  "timeoutSeconds": 15,
  "concurrency": 10
}
```

### Output

Each URL produces one dataset item containing the converted Markdown and extracted metadata.

Key output fields:

- `inputUrl` (`string`) — the original URL provided
- `finalUrl` (`string`) — the URL after following redirects
- `status` (`number`) — HTTP status code
- `pageTitle` (`string`) — extracted article title
- `markdown` (`string`) — the full article content converted to Markdown
- `excerpt` (`string`) — short summary or description of the article
- `byline` (`string`) — author name if available
- `error` (`string`) — error message if conversion failed, otherwise `null`

#### Output Example

```json
{
  "inputUrl": "https://crawlee.dev/",
  "finalUrl": "https://crawlee.dev/",
  "status": 200,
  "pageTitle": "Crawlee - Build reliable crawlers. Fast.",
  "markdown": "# Crawlee\n\nBuild reliable crawlers. Fast.\n\nCrawlee is a web scraping and browser automation library...",
  "excerpt": "Crawlee is a web scraping and browser automation library for Node.js.",
  "byline": null,
  "error": null
}
```

### Pricing

| Event | Cost |
|-------|------|
| Page Converted | Pay-per-event (see actor pricing page) |

The actor respects the per-run max charge limit. Processing stops automatically when the spending cap is reached.

### Use Cases

- **RAG pipeline ingestion** — convert documentation sites and knowledge bases into Markdown for vector database indexing
- **LLM context preparation** — clean web content for ChatGPT, Claude, or other LLM context windows without HTML noise
- **Documentation migration** — bulk-convert web pages to Markdown files for static site generators
- **Content archiving** — save readable article snapshots in a portable, version-control-friendly format
- **AI training data** — prepare clean text corpora from web sources for fine-tuning or evaluation

### Related Actors

| Actor | What it adds |
|-------|-------------|
| [Article Text Extractor for TTS & AI](https://apify.com/andok/tts-reader) | Plain text output optimized for text-to-speech and summarization |
| [PDF to Text Converter for AI & RAG](https://apify.com/andok/pdf-text-converter) | Extend your pipeline to extract text from PDF documents |
| [YouTube Transcript Scraper for AI & RAG](https://apify.com/andok/youtube-transcript-scraper) | Add video transcript extraction to your content pipeline |

# Actor input Schema

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

List of webpage URLs to convert to Markdown. Each URL will be fetched, cleaned with Readability, and converted to structured Markdown.

## `timeoutSeconds` (type: `integer`):

Maximum seconds to wait for each URL response before timing out. Increase for slow-loading pages.

## `concurrency` (type: `integer`):

Number of URLs to process in parallel. Lower this if you experience rate limiting from target sites.

## Actor input object example

```json
{
  "urls": [
    "https://crawlee.dev/"
  ],
  "timeoutSeconds": 15,
  "concurrency": 10
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `resultsCsv` (type: `string`):

No description

## `run` (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 = {
    "urls": [
        "https://crawlee.dev/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("andok/markdown-extractor").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 = { "urls": ["https://crawlee.dev/"] }

# Run the Actor and wait for it to finish
run = client.actor("andok/markdown-extractor").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 '{
  "urls": [
    "https://crawlee.dev/"
  ]
}' |
apify call andok/markdown-extractor --silent --output-dataset

```

## MCP server setup

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

```

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/F2cOAEkJqZBqGyfbB/builds/1RQFsVSudsC7pbdG1/openapi.json
