# AI Website-to-Clean-Markdown & Schema Extractor (`majestic_tiger12/website-to-clean-markdown`) Actor

Convert any webpage or batch of URLs into clean, token-efficient Markdown, JSON-LD Schema.org data, OpenGraph metadata, and structured link graphs for LLM agents, RAG pipelines, and n8n workflows.

- **URL**: https://apify.com/majestic_tiger12/website-to-clean-markdown.md
- **Developed by:** [Karnajeet Sawant](https://apify.com/majestic_tiger12) (community)
- **Features:** Limited permissions
- **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 markdown 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-Clean-Markdown & Schema Extractor

Convert any webpage or batch of URLs into **clean, token-efficient Markdown**, **JSON-LD Schema.org structured data**, **OpenGraph/Twitter metadata**, **document heading outlines**, and **deduplicated link graphs**—built specifically for AI agents, RAG pipelines, LLM fine-tuning, and n8n/Make automation workflows.

***

### Why Use This Actor?

- **LLM & RAG Ready:** Automatically removes `<nav>`, `<footer>`, `<aside>`, `<script>`, `<style>`, cookie consent banners, and ad containers so your LLM only ingests high-signal content.
- **Built-In Token Budgeting:** Every page returns `wordCount`, `charCount`, and `estimatedTokens` (`ceil(chars / 4)`) so your pipeline can chunk or route context without hitting model token limits.
- **Full Structured Data Extraction:** Parses all `application/ld+json` Schema.org blocks (`Product`, `Organization`, `Article`, `FAQPage`, `SoftwareApplication`, etc.), OpenGraph tags, canonical URLs, and H1–H3 outlines alongside the Markdown.
- **Sub-Second Batch Speed (Zero Proxy Overhead):** Asynchronous HTTP/2 engine processes batches of URLs concurrently without headless browser bloat.
- **Optional Mini-Crawl Mode:** Scrape an exact list of URLs (`maxPagesPerUrl: 1`) or automatically discover and extract up to 50 same-domain subpages per start URL.

***

### Input Parameters

| Field | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `urls` | `array` | *Required* | List of webpage URLs to extract. |
| `onlyMainContent` | `boolean` | `true` | Strip navigation, headers, footers, sidebars, and cookie banners. |
| `includeLinks` | `boolean` | `true` | Include deduplicated `internalLinks` and `externalLinks` arrays. |
| `includeImages` | `boolean` | `false` | Keep Markdown image tags (`![alt](url)`). Disabled by default to save tokens. |
| `maxPagesPerUrl` | `integer` | `1` | Set to `1` for exact URLs only, or `2–50` to crawl same-domain subpages. |
| `maxMarkdownChars` | `integer` | `100000` | Maximum Markdown characters returned per page. |
| `concurrency` | `integer` | `10` | Maximum concurrent HTTP requests (`1–25`). |
| `timeoutSeconds` | `integer` | `20` | Request timeout per URL in seconds (`5–60`). |

***

### Example Output

```json
{
  "url": "https://stripe.com/pricing",
  "finalUrl": "https://stripe.com/pricing",
  "isSuccess": true,
  "statusCode": 200,
  "title": "Pricing & Fees | Stripe",
  "description": "Find Stripe fees and pricing information...",
  "canonicalUrl": "https://stripe.com/pricing",
  "language": "en",
  "author": "",
  "robots": "index, follow",
  "wordCount": 1142,
  "charCount": 7480,
  "estimatedTokens": 1870,
  "markdown": "# Pricing & Fees\n\nAccess a complete payments platform...",
  "schemaTypes": ["WebPage", "Organization"],
  "schemaOrg": [
    {
      "@context": "https://schema.org",
      "@type": "WebPage",
      "name": "Pricing & Fees"
    }
  ],
  "openGraph": {
    "og:title": "Pricing & Fees | Stripe",
    "og:type": "website"
  },
  "headings": [
    { "level": "h1", "text": "Pricing & Fees" },
    { "level": "h2", "text": "Integrated per-transaction pricing" }
  ],
  "internalLinks": ["https://stripe.com/payments", "https://stripe.com/billing"],
  "externalLinks": ["https://support.stripe.com"],
  "scrapedAt": "2026-11-17T01:15:00.000000+00:00",
  "error": null
}
```

***

### API & n8n Integration

Call this Actor synchronously from **n8n**, **Make**, or any backend service to retrieve clean Markdown and JSON-LD directly in a single HTTP request:

```bash
POST https://api.apify.com/v2/acts/majestic_tiger12~website-to-clean-markdown/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN
Content-Type: application/json

{
  "urls": ["https://docs.apify.com"],
  "onlyMainContent": true,
  "includeImages": false
}
```

# Actor input Schema

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

List of webpage URLs to fetch and convert into clean LLM-ready Markdown and structured metadata.

## `onlyMainContent` (type: `boolean`):

Strip navigation bars, headers, footers, sidebars, cookie banners, and ad containers before converting to Markdown.

## `includeLinks` (type: `boolean`):

Return deduplicated lists of internal and external URLs discovered on each page.

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

Preserve image tags (![alt](url)) in the output Markdown. Disable to save LLM context tokens.

## `maxPagesPerUrl` (type: `integer`):

Set to 1 to scrape only the exact URLs provided. Set higher (up to 50) to crawl same-domain subpages automatically.

## `maxMarkdownChars` (type: `integer`):

Maximum character length of the returned Markdown string per page.

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

Number of simultaneous HTTP requests.

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

Maximum time to wait for a single page response.

## Actor input object example

```json
{
  "urls": [
    "https://docs.apify.com",
    "https://stripe.com/pricing"
  ],
  "onlyMainContent": true,
  "includeLinks": true,
  "includeImages": false,
  "maxPagesPerUrl": 1,
  "maxMarkdownChars": 100000,
  "concurrency": 10,
  "timeoutSeconds": 20
}
```

# 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 = {
    "urls": [
        "https://docs.apify.com",
        "https://stripe.com/pricing"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("majestic_tiger12/website-to-clean-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 = { "urls": [
        "https://docs.apify.com",
        "https://stripe.com/pricing",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("majestic_tiger12/website-to-clean-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 '{
  "urls": [
    "https://docs.apify.com",
    "https://stripe.com/pricing"
  ]
}' |
apify call majestic_tiger12/website-to-clean-markdown --silent --output-dataset

```

## MCP server setup

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