# AI Web Crawler (`darknezz/ai-web-crawler`) Actor

Extract clean, chunked content from any website for LLMs and AI agents. Gets title, headings, main content, links, tables, and JSON-LD. Outputs token-estimated chunks ready for RAG pipelines.

- **URL**: https://apify.com/darknezz/ai-web-crawler.md
- **Developed by:** [Oaida Adrian](https://apify.com/darknezz) (community)
- **Categories:** AI
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 page crawleds

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

## AI Web Content Crawler — LLM-Ready Text from Any Website

Crawl a website and get back **clean, boilerplate-free content already chunked for LLMs** — token-estimated segments, heading structure, tables, links, and JSON-LD — one dataset item per page. No API keys, no browser fleet, no post-processing script.

Perfect for:

- 🤖 **RAG pipelines** — feed `contentChunks` (~2,000-char segments with token estimates) straight into your embedder
- 📚 **Knowledge-base ingestion** — docs sites, blogs, wikis → vector store, without writing a scraper
- 🧠 **LLM fine-tuning / evaluation corpora** — clean `mainContent` with nav/footer/script noise removed
- 🕸️ **Site mapping** — internal/external link graphs and heading outlines per page
- 🔎 **SEO & metadata audits** — OpenGraph, Twitter Card, canonical URL, language, JSON-LD

### How it works

Give it one or more start URLs. The crawler fetches each page, strips boilerplate (navigation, footers, scripts, ads), extracts the main content, and follows same-site links up to `maxPages`. Every page becomes one dataset item — ready to consume, no HTML parsing on your side.

### Input

```json
{
  "startUrls": [{ "url": "https://docs.example.com" }],
  "maxPages": 25
}
```

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `startUrls` | array | *required* | Pages/sites to crawl |
| `maxPages` | integer | `5` | Max pages per start URL (`1` = just that page, up to 100) |

### Output

One item per crawled page:

```json
{
  "url": "https://docs.example.com/getting-started",
  "metadata": {
    "title": "Getting Started — Example Docs",
    "description": "Install and configure Example in five minutes.",
    "canonicalUrl": "https://docs.example.com/getting-started",
    "language": "en",
    "ogTitle": "Getting Started",
    "ogType": "article"
  },
  "mainContent": "Getting started with Example. Install the CLI ...",
  "contentChunks": [
    { "id": "9f8e2c11ab04d7e3", "text": "Getting started with Example...", "estimatedTokens": 486 }
  ],
  "estimatedTokens": 1874,
  "headings": [
    { "level": 1, "text": "Getting Started" },
    { "level": 2, "text": "Installation" }
  ],
  "tables": [],
  "internalLinks": ["https://docs.example.com/configuration"],
  "externalLinks": ["https://github.com/example/cli"],
  "jsonld": [{ "@type": "TechArticle", "headline": "Getting Started" }]
}
```

`contentChunks` are split on paragraph boundaries at roughly 2,000 characters with a per-chunk token estimate — sized for embedding models, so most users index them with zero further processing.

### Use it from the API

```bash
curl -s "https://api.apify.com/v2/acts/darknezz~ai-web-crawler/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"startUrls": [{"url": "https://docs.example.com"}], "maxPages": 10}'
```

Also available through the Apify SDK (Python/JS), scheduled tasks for recurring re-indexing, Zapier/Make, and MCP-enabled AI agents.

### Pricing

Pay per event: **$0.002 per page crawled**, plus Apify's standard compute. Crawling a 500-page docs site costs about $1 in event fees — no subscription.

### FAQ

**Does it render JavaScript?** No — it fetches server-rendered HTML, which keeps it fast and cheap. Docs sites, blogs, wikis, news, and marketing sites work great; pure client-side SPAs may return thin content.

**How does it decide what's "main content"?** Nav, header, footer, aside, script, style, and form elements are stripped, then the `<main>` or `<article>` element is preferred (falling back to `<body>`) and its paragraphs, list items, quotes, and code blocks are collected. Headings and tables are extracted separately so structure isn't lost.

**Can I crawl just one page?** Yes — set `maxPages` to `1`.

**Does it stay on the site?** Yes — only same-host links are followed. External links are still reported in `externalLinks` for graph building.

**What are token estimates based on?** A ~4 characters/token heuristic — close enough for chunk budgeting with OpenAI/Anthropic-class tokenizers.

# Actor input Schema

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

URLs to crawl.

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

Maximum pages to crawl per URL (1 = single page only).

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://en.wikipedia.org/wiki/Large_language_model"
    }
  ],
  "maxPages": 5
}
```

# Actor output Schema

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

No description

## `id` (type: `string`):

No description

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

No description

## `title` (type: `string`):

No description

## `description` (type: `string`):

No description

## `language` (type: `string`):

No description

## `mainContent` (type: `string`):

No description

## `chunkCount` (type: `string`):

No description

## `estimatedTokens` (type: `string`):

No description

## `tableCount` (type: `string`):

No description

## `scrapedAt` (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 = {
    "startUrls": [
        {
            "url": "https://en.wikipedia.org/wiki/Large_language_model"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("darknezz/ai-web-crawler").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://en.wikipedia.org/wiki/Large_language_model" }] }

# Run the Actor and wait for it to finish
run = client.actor("darknezz/ai-web-crawler").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://en.wikipedia.org/wiki/Large_language_model"
    }
  ]
}' |
apify call darknezz/ai-web-crawler --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Db69AmvOlfYPfm7Mf/builds/QmQrGh7g108h5AAfU/openapi.json
