# LLM-Ready Web Scraper & RAG Markdown Chunker | $2/1K (`kiosklabs/llm-web-scraper`) Actor

Convert web pages into clean, LLM-ready Markdown, JSON, or JSONL with overlapping RAG chunks. Strips ads, menus, and boilerplate automatically.

- **URL**: https://apify.com/kiosklabs/llm-web-scraper.md
- **Developed by:** [batuhan senavci](https://apify.com/kiosklabs) (community)
- **Categories:** AI, Agents, Developer tools
- **Features:** Limited permissions
- **Stats:** 5 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.40 / 1,000 scraped llm webpages

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?

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

## LLM-Ready Web Scraper

Converts web pages to clean, LLM-friendly formats. Perfect for building AI applications.

### Use Cases

- **RAG Pipelines**: Get chunked content ready for vector databases
- **Fine-tuning Datasets**: Export as JSONL for LLM training
- **Knowledge Bases**: Build AI chatbot training data
- **Content Extraction**: Clean text without ads, menus, or clutter

### Features

- Automatic content extraction (removes ads, navigation, footers)
- Multiple output formats: Markdown, JSON, JSONL
- Optional chunking with overlap for RAG
- Batch URL processing
- Metadata extraction (title, description, domain)

### Output Formats

#### Markdown

```markdown
---
title: "Page Title"
url: https://example.com/page
domain: example.com
scraped_at: 2024-01-15T10:30:00Z
---

## Page Heading

Clean page content with [links](https://example.com/other) preserved...

### Section Heading

| Column A | Column B |
| --- | --- |
| value | value |
```

Markdown mode keeps headings, links, and tables from the page's main content.

#### JSON

```json
{
  "url": "https://example.com",
  "success": true,
  "content": "Clean text content...",
  "metadata": {
    "title": "Page Title",
    "description": "Meta description"
  },
  "word_count": 1500
}
```

#### JSONL (Fine-tuning)

```json
{
  "prompt": "Content from Page Title:",
  "completion": "Full clean text content of the page (not truncated)..."
}
```

### With Chunks (RAG-ready)

```json
{
  "chunks": [
    {"chunk_id": 0, "text": "First chunk...", "word_count": 500},
    {"chunk_id": 1, "text": "Second chunk...", "word_count": 500}
  ],
  "chunk_count": 5
}
```

### Input Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| url | string | `https://en.wikipedia.org/wiki/Retrieval-augmented_generation` | Single URL to scrape |
| urls | array | - | Multiple URLs for batch processing |
| outputFormat | string | markdown | Output format: markdown, json, jsonl |
| includeChunks | boolean | false | Split into RAG-ready chunks |
| chunkSize | integer | 500 | Words per chunk |
| chunkOverlap | integer | 50 | Overlap between chunks |
| maxConcurrency | integer | 5 | Parallel scraping limit |

### Example Input

```json
{
  "urls": [
    "https://docs.python.org/3/tutorial/",
    "https://docs.python.org/3/library/"
  ],
  "outputFormat": "json",
  "includeChunks": true,
  "chunkSize": 500
}
```

### Pricing

Pay-Per-Event: one `page-scraped` event is charged for each page that is successfully extracted and pushed to the dataset, at **$0.002–$0.005 per page** (the exact rate for your plan is shown on the Actor's Pricing tab). The price does not depend on page size.

- Pages that fail to download or yield no content are returned with `"success": false` and are **not charged**.
- If the run's maximum charge limit is reached, remaining pages are neither pushed nor charged.

# Actor input Schema

## `url` (type: `string`):

A single URL to scrape. When 'Multiple URLs' is filled, the default value of this field is ignored.

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

List of URLs to scrape (for batch processing)

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

Format of the extracted content

## `includeChunks` (type: `boolean`):

Split content into overlapping chunks for RAG/embeddings

## `chunkSize` (type: `integer`):

Number of words per chunk (only if Include Chunks is enabled)

## `chunkOverlap` (type: `integer`):

Overlap between chunks for context continuity

## `maxConcurrency` (type: `integer`):

Maximum number of pages to scrape simultaneously

## Actor input object example

```json
{
  "url": "https://en.wikipedia.org/wiki/Retrieval-augmented_generation",
  "outputFormat": "markdown",
  "includeChunks": false,
  "chunkSize": 500,
  "chunkOverlap": 50,
  "maxConcurrency": 5
}
```

# Actor output Schema

## `dataset` (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 = {
    "url": "https://en.wikipedia.org/wiki/Retrieval-augmented_generation"
};

// Run the Actor and wait for it to finish
const run = await client.actor("kiosklabs/llm-web-scraper").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 = { "url": "https://en.wikipedia.org/wiki/Retrieval-augmented_generation" }

# Run the Actor and wait for it to finish
run = client.actor("kiosklabs/llm-web-scraper").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 '{
  "url": "https://en.wikipedia.org/wiki/Retrieval-augmented_generation"
}' |
apify call kiosklabs/llm-web-scraper --silent --output-dataset

```

## MCP server setup

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

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/hkfkDpMRSNASLf024/builds/8Am9uXrvmbYO8d843/openapi.json
