# Webpage to Markdown (`extremescrapes/webpage-to-markdown`) Actor

This actor cost-effectively converts websites into structured markdown optimized for AI processing. It extracts webpage content, formats it into clean markdown, and ensures compatibility with AI models.

- **URL**: https://apify.com/extremescrapes/webpage-to-markdown.md
- **Developed by:** [Extreme Scrapes](https://apify.com/extremescrapes) (community)
- **Categories:** AI, Automation
- **Features:** Limited permissions
- **Stats:** 235 total users, 7 monthly users, 99.9% runs succeeded, 10 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$50.00 / 1,000 results

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

## Website to AI Markdown Converter

This Apify Actor takes a list of website URLs as input and converts their content into AI-friendly Markdown format. The processed data is then stored in an Apify dataset for easy access and retrieval.

### Features

- **Processes multiple URLs** - Accepts a list of start URLs and fetches their content.
- **AI-optimized Markdown output** - Converts webpage content into structured Markdown.
- **Stores results in Apify dataset** - Data can be easily retrieved and used in other workflows.
- **Handles errors gracefully** - Logs errors and continues processing other URLs.

### How It Works

1. The Actor retrieves a list of start URLs from the input.
2. It fetches the content of each URL.
3. The extracted content is formatted into Markdown.
4. The processed data is stored in an Apify dataset.
5. Errors (if any) are logged for reference.

### Input

The Actor requires a JSON input with a list of URLs:

```json
{
    "startUrls": [
        { "url": "https://example.com" },
        { "url": "https://another-site.com" }
    ]
}
```

### Output

The Actor outputs structured Markdown content for each URL:

```json
{
    "url": "https://example.com",
    "markdownn": "  # Title\n\nContent of the webpage..."
}
```

### Usage

1. **Run on Apify Console:**
   - Open the Actor in Apify Console.
   - Provide the input JSON.
   - Start the Actor and retrieve results from the dataset.

2. **Run Locally:**
   - Install Apify CLI: `npm install -g apify-cli`
   - Pull the Actor: `apify pull <ActorId>`
   - Run it: `apify run`

### Additional Resources

- [Apify SDK Documentation](https://docs.apify.com/sdk/js)
- [Apify Platform](https://docs.apify.com/platform)
- [Apify Community](https://discord.com/invite/jyEM2PRvMU)

# Actor input Schema

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

URLs to start with.

## `maxRequestsPerCrawl` (type: `integer`):

Maximum number of requests that can be made by this crawler.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://crawlee.dev"
    }
  ],
  "maxRequestsPerCrawl": 100
}
```

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

// Run the Actor and wait for it to finish
const run = await client.actor("extremescrapes/webpage-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 = { "startUrls": [{ "url": "https://crawlee.dev" }] }

# Run the Actor and wait for it to finish
run = client.actor("extremescrapes/webpage-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 '{
  "startUrls": [
    {
      "url": "https://crawlee.dev"
    }
  ]
}' |
apify call extremescrapes/webpage-to-markdown --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,extremescrapes/webpage-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/OgCDnL9r5MgMUJSsb/builds/fppTMo9jiNG4OfgJ8/openapi.json
