# LLM-Ready Web Extractor: URL to Clean Markdown & JSON (`f0rty7even/llm-web-extractor`) Actor

Turn any web page or site into clean, LLM-ready Markdown and structured JSON for RAG, agents, and fine-tuning. Strips nav/ads/boilerplate; returns main content + metadata.

- **URL**: https://apify.com/f0rty7even/llm-web-extractor.md
- **Developed by:** [Michael Yousrie](https://apify.com/f0rty7even) (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 $3.00 / 1,000 page-extracteds

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/platform/actors/running/actors-in-store#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

## LLM-Ready Web Extractor — URL to Clean Markdown & JSON

**Turn any web page or whole site into clean, LLM-ready Markdown and structured JSON.** This web scraper extracts the *main content* of a page — stripping navigation, ads, cookie banners, and boilerplate — and returns tidy Markdown (or plain text / cleaned HTML) plus metadata. It's built for feeding **LLMs, RAG pipelines, AI agents, and fine-tuning datasets** clean web content instead of raw, noisy HTML.

Point it at one URL or hundreds, optionally crawl a site, and get back one structured record per page.

### What it does

- **Website to Markdown** — converts article/doc/blog pages into clean Markdown that's ready to drop into an LLM prompt or vector database.
- **Main-content extraction** — removes menus, sidebars, footers, ads, and cookie notices, keeping the text that matters.
- **Metadata** — title, author, publish date, description, site name, and language where available.
- **Optional crawling** — follow same-domain links up to your page/depth limits to turn a whole docs site or blog into a corpus.
- **Structured output** — one JSON record per page (`url`, `title`, `content`, `wordCount`, `metadata`), exportable to JSON, CSV, or Excel.

### Use cases

- Build a **RAG knowledge base** from documentation, help centers, or blogs.
- Feed **LLM agents** clean page content instead of raw HTML.
- Assemble **fine-tuning / training datasets** from public web pages.
- Give a chatbot up-to-date context from a set of URLs.

### Input

| Field | Description |
|---|---|
| `startUrls` | One or more pages to extract (entry points when crawling). |
| `crawl` | Follow same-domain links from the start URLs. |
| `maxPages` | Hard cap on pages extracted. |
| `maxDepth` | How many link-hops to follow when crawling. |
| `onlySameDomain` | Keep the crawl on the start URL's domain. |
| `outputFormat` | `markdown` (LLM-ready), `text`, or `html`. |
| `includeLinks` | Keep hyperlinks in the Markdown. |

### Output

Each page becomes one dataset item:

```json
{
  "url": "https://example.com/docs/intro",
  "title": "Introduction",
  "content": "# Introduction\n\nClean markdown of the main content...",
  "format": "markdown",
  "wordCount": 812,
  "metadata": { "author": null, "date": "2025-04-01", "sitename": "Example Docs", "language": "en" }
}
```

### Pricing

Pay-per-result: you're charged per page successfully extracted — no monthly fee, no charge for pages that fail or have no main content.

### Notes

- Works best on server-rendered content (docs, articles, blogs, news). Heavily
  JavaScript-rendered pages are on the roadmap (browser-rendering toggle).
- Respects public, logged-out pages only — it does not log in or bypass paywalls.

### FAQ

**Does it handle a whole website?** Yes — enable `crawl` and set `maxPages` / `maxDepth`.

**What formats can I export?** The dataset exports to JSON, JSONL, CSV, or Excel, or via the Apify API.

**Is the Markdown clean enough for an LLM?** Yes — that's the point: main content only, no nav/ads, links preserved.

# Actor input Schema

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

Pages to extract. With crawling on, these are the entry points.

## `crawl` (type: `boolean`):

Follow same-domain links from the start URLs (up to the limits below).

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

Hard cap on pages extracted (also the main cost lever).

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

How many link-hops from a start URL to follow when crawling.

## `onlySameDomain` (type: `boolean`):

Only follow links on the same registered domain as the start URL.

## `outputFormat` (type: `string`):

Main-content format returned per page.

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

Preserve hyperlinks in the extracted Markdown.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://docs.apify.com/platform"
    }
  ],
  "crawl": false,
  "maxPages": 10,
  "maxDepth": 2,
  "onlySameDomain": true,
  "outputFormat": "markdown",
  "includeLinks": true
}
```

# Actor output Schema

## `extractedPages` (type: `string`):

Clean content and metadata for every successfully extracted page, one item each. Export as JSON, JSONL, CSV, or Excel.

# 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"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("f0rty7even/llm-web-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 = { "startUrls": [{ "url": "https://docs.apify.com/platform" }] }

# Run the Actor and wait for it to finish
run = client.actor("f0rty7even/llm-web-extractor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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"
    }
  ]
}' |
apify call f0rty7even/llm-web-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=f0rty7even/llm-web-extractor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/9q1dUJelPvw7E2gc2/builds/HdUcwaVKbLgdOWMOZ/openapi.json
