# Web Page & PDF to Markdown, Site Crawler (`domondi1/web-page-to-markdown`) Actor

Read public web pages, or crawl a whole site, into clean Markdown with each page's title, author, published and modified dates, language, canonical URL and a content hash. Pay only for pages delivered with readable text; blocked, missing, bot-check and JavaScript-only pages are free.

- **URL**: https://apify.com/domondi1/web-page-to-markdown.md
- **Developed by:** [Daniel Omondi](https://apify.com/domondi1) (community)
- **Categories:** AI, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 page reads

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/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

## Web Page & PDF to Markdown, Site Crawler

Turn any public web page or PDF into clean Markdown for your LLM, RAG pipeline, agent or archive, with the
page's own metadata and a content hash. Give it a list of URLs, or one start URL and let it crawl the site.

**You only pay for pages that come back with readable text.** A page that is blocked by robots.txt, missing
(404), erroring (5xx), timing out, behind a bot check, empty without JavaScript, or too large is returned with
the reason and **costs nothing**.

### What you get for each page

| Field | What it is |
|---|---|
| `url`, `final_url` | The URL you asked for and where it ended up after redirects |
| `title` | The page title (for a PDF: its document title, or its first line) |
| `content_markdown` | The main text as Markdown: headings, lists, links and tables kept; menus, scripts and styling dropped |
| `word_count` | Words in the Markdown |
| `content_sha256` | SHA-256 of the Markdown, to detect changes between runs |
| `metadata` | description, canonical URL, authors, published and modified dates, language, site name, image, type |
| `depth` | In crawl mode: link hops from the start page |
| `charged` | `true` if this page was billed, `false` if it was free |
| `error`, `detail` | Why a page couldn't be read (free) |

PDFs are supported: the text layer of the first 50 pages is read, with the document's title, author and dates.
Scanned PDFs with no text layer are returned as `no_readable_content` and are free.

### Input

- **`urls`**: pages to read, up to 1,000 per run. Duplicates are read once.
- **`crawl`**: also follow links to other pages on the same site, breadth-first.
- **`maxPages`** and **`maxDepth`**: limits for crawl mode (default 50 pages, 3 link hops).
- **`concurrency`**: pages in parallel (default 10). At most 2 requests at a time go to any one site.

Example: `{"urls": ["https://docs.python.org/3/library/asyncio.html"], "crawl": true, "maxPages": 25}`

### Pricing

**$0.002 per page delivered with readable text.** Everything that can't be read is free. Set a maximum cost per
run and the Actor stops before it reaches it.

### How it reads pages

- It fetches only public addresses, follows up to 3 redirects, and reads at most 2 MB per page (5 MB per PDF)
  within 15 seconds.
- It **respects robots.txt** and identifies itself as `InferrailReader/1.0 (+https://github.com/domondi1/inferrail)`.
- It does not run JavaScript: single-page apps that render only in the browser come back free as
  `no_readable_content`.
- It does not use proxies, so sites that refuse cloud traffic come back free with their status code.

The same reader runs as Inferrail Web Read, an open-source, pay-per-call API for agents:
https://github.com/domondi1/inferrail

### FAQ

**Is a page I already read charged again?** Each run reads and charges each distinct URL once.

**Can I use it from my agent?** Yes, through the Apify API or the Apify MCP server, like any Actor.

# Actor input Schema

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

Public http(s) pages to read (up to 1,000 per run). Duplicates are read and charged once.

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

Pages read in parallel (at most 2 at a time per site).

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

Also follow links on each page to other pages of the same site (breadth-first). Each page read is charged like a single page; pages that can't be read are free.

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

Most pages to attempt in a crawl, including the start pages.

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

How many link hops from a start page to follow.

## Actor input object example

```json
{
  "urls": [
    "https://docs.python.org/3/library/asyncio.html"
  ],
  "concurrency": 10,
  "crawl": false,
  "maxPages": 50,
  "maxDepth": 3
}
```

# Actor output Schema

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

All results as JSON, CSV or Excel from the default dataset.

# 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.python.org/3/library/asyncio.html"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("domondi1/web-page-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://docs.python.org/3/library/asyncio.html"] }

# Run the Actor and wait for it to finish
run = client.actor("domondi1/web-page-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://docs.python.org/3/library/asyncio.html"
  ]
}' |
apify call domondi1/web-page-to-markdown --silent --output-dataset

```

## MCP server setup

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