# AI Web to Clean Markdown & Metadata Extractor (`vieiracorpori/ai-web-to-markdown`) Actor

Convert any public web page into clean, boilerplate-free Markdown optimized for LLMs, RAG pipelines, n8n, Make, and AI Agents. Extracts OpenGraph, JSON-LD/Schema.org, headings outline, token counts, and optional llms.txt & robots.txt probes.

- **URL**: https://apify.com/vieiracorpori/ai-web-to-markdown.md
- **Developed by:** [Danilo BRUNO Vieira VIANA](https://apify.com/vieiracorpori) (community)
- **Categories:** AI, Developer tools, Automation
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 webpage converted to llm markdowns

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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 Web to Clean Markdown & Structured Metadata Extractor

Turn any web page into **clean, token-efficient, boilerplate-free Markdown** plus structured metadata (**OpenGraph, Twitter Cards, JSON-LD/Schema.org, headings outline, reading time, estimated LLM tokens, and `/llms.txt` checks**) — built for **RAG pipelines, AI Agents, n8n, Make, LangChain, and Apify MCP**.

### Why Use This Actor?

- **Zero Headless Browser Overhead:** Ultra-fast HTTP + lxml DOM cleaning delivers sub-second results at a fraction of the compute cost of Playwright crawlers.
- **LLM & RAG Ready:** Automatically strips navigation bars, cookie banners, ads, scripts, and footers while preserving headings, Markdown tables, fenced code blocks, lists, and resolved links.
- **Built-in Token Accounting:** Returns `word_count`, `char_count`, and `estimated_llm_tokens` so your RAG chunker knows exact context budget before hitting OpenAI/Claude/Gemini.
- **Standby Server Mode Included:** Run synchronously as a low-latency REST endpoint (`POST /extract`) or invoke natively from AI Agents via Apify MCP.

### Example Input

```json
{
  "urls": ["https://docs.python.org/3/whatsnew/3.12.html"],
  "includeLinks": true,
  "includeMetadata": true,
  "checkAiFiles": true
}
```

### Suggested Pay-Per-Event (PPE) Pricing

| Event Name | Description | Suggested Price (USD) |
| :--- | :--- | :--- |
| `page-extracted` | 1 web page converted to clean LLM Markdown + metadata | `$0.002` ($2 per 1,000 pages) |

# Actor input Schema

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

List of public HTTP/HTTPS URLs to convert into clean LLM-ready Markdown and structured metadata.

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

Keep resolved absolute hyperlinks in the generated Markdown output.

## `includeMetadata` (type: `boolean`):

Include title, description, canonical URL, OpenGraph, Twitter Card, JSON-LD, headings, and internal/external links.

## `checkAiFiles` (type: `boolean`):

Probe each origin for /llms.txt and /robots.txt.

## `maxChars` (type: `integer`):

Maximum character length of the extracted Markdown output per page.

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

Number of URLs processed concurrently (1 to 10).

## Actor input object example

```json
{
  "urls": [
    "https://example.com"
  ],
  "includeLinks": true,
  "includeMetadata": true,
  "checkAiFiles": false,
  "maxChars": 120000,
  "concurrency": 5
}
```

# Actor output Schema

## `markdownDataset` (type: `string`):

Default dataset containing clean LLM-ready Markdown, token counts, OpenGraph, JSON-LD, headings, and /llms.txt checks for each URL.

## `csvExport` (type: `string`):

Downloadable CSV export of extracted URLs, titles, word counts, and Markdown.

# 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://example.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("vieiracorpori/ai-web-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 = { "urls": ["https://example.com"] }

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,vieiracorpori/ai-web-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/Lv9dtuDdXuqghRDaR/builds/Ta8QeVmdHhTmTH90W/openapi.json
