# Web Page to Markdown for LLM — Fast & Cheap, CJK-ready (`masahishop/web-to-markdown-cjk`) Actor

Convert web pages to clean Markdown, text or RAG chunks without a browser — fast and cheap. Correctly decodes Japanese/Chinese/Korean legacy encodings (Shift_JIS, EUC-JP, GBK, Big5), handles furigana, respects robots.txt. $1 per 1,000 pages.

- **URL**: https://apify.com/masahishop/web-to-markdown-cjk.md
- **Developed by:** [Masahi Shop](https://apify.com/masahishop) (community)
- **Categories:** AI, Developer tools
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.85 / 1,000 page converteds

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

## Web Page to Markdown for LLM — Fast & Cheap, CJK-ready

Convert a list of web pages into **clean Markdown, plain text or RAG chunks** — **without a browser**, so it is fast and costs **$1 per 1,000 pages**.

Built to get **Japanese, Chinese and Korean pages right**:

- **No mojibake**: legacy encodings like **Shift_JIS, EUC-JP, GBK/GB18030, Big5, EUC-KR** are detected and decoded correctly
- **Furigana (ruby)**: remove readings (`漢字`) or keep them in parentheses (`漢字(かんじ)`)
- **No stray spaces** between CJK characters at line breaks
- **Sentence-aware RAG chunks** that end at `。！？` as well as `. ! ?`

And for every language:

- **Main content extraction** (Readability): navigation, ads, cookie bars and footers removed
- **Tables kept** as Markdown tables
- **Metadata**: title, description, site name, author, published time, canonical URL, language, charset
- **Polite by default**: respects robots.txt and Crawl-delay, waits between requests to the same site, never crawls beyond the URLs you give

### What can it be used for?

- Feed web pages to **ChatGPT, Claude or any LLM**
- Build a **RAG / vector database** from documentation, news or knowledge-base pages
- Archive or translate **Japanese / Chinese / Korean** web content without garbled characters
- Use it from **AI agents** via the Apify API or MCP as a cheap "read this URL" tool

### Input

| Field | Description |
|---|---|
| `urls` | Pages to convert. Only these URLs are fetched — no link following. |
| `outputFormat` | `markdown` (default), `text`, or `chunks` |
| `mode` | `article` (main content, default) or `fullPage` |
| `ruby` | `remove` (default) or `parentheses` |
| `includeLinks` | Keep hyperlinks in Markdown (default: off, cleaner for LLMs) |
| `chunkSize` / `chunkOverlap` | For `chunks` |
| `respectRobotsTxt` | Default on |
| `minDelayPerSiteMs`, `maxConcurrency`, `timeoutSecs`, `maxPageSizeMb` | Politeness and limits |

```json
{
    "urls": ["https://www.aozora.gr.jp/cards/000148/files/773_14560.html"],
    "ruby": "parentheses"
}
```

### Output

```json
{
    "url": "https://www.aozora.gr.jp/cards/000148/files/773_14560.html",
    "status": "success",
    "title": "夏目漱石 こころ",
    "language": "ja",
    "charset": "shift_jis",
    "extraction": "article",
    "charCount": 162544,
    "markdown": "### 上　先生と私\n\n#### 一\n\n　私(わたくし)はその人を常に先生と呼んでいた。…"
}
```

`status` is `success`, `failed` (with `error`), or `blocked_by_robots_txt`. With `outputFormat: "chunks"` you get `chunks: [{ index, charCount, text }]` and `chunkCount` instead of `markdown`.

### Pricing

| Event | Price |
|---|---|
| Page converted (per successfully converted page) | $0.001 ($1 per 1,000 pages) |

Failed pages, pages blocked by robots.txt, PDFs and non-HTML URLs are **not charged**. Platform usage is included.

### Limitations

- **No JavaScript rendering.** Pages that build their content in the browser (some single-page apps) may return little text — the item then fails with an explanation and is not charged.
- Pages behind logins or paywalls are not supported.
- For PDFs use [PDF to Markdown for LLM & RAG](https://apify.com/masahishop/pdf-to-markdown); for images and scans use [OCR Japanese, Chinese, Korean & English](https://apify.com/masahishop/ocr-cjk).

### Responsible use

Only submit pages you are allowed to process. The Actor identifies itself in the User-Agent (`ApifyWebToMarkdownCJK`), honours robots.txt by default and spaces out requests to each site.

# Actor input Schema

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

Pages to convert. Only these URLs are fetched — the Actor does not follow links or crawl.

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

<b>markdown</b> (default), <b>text</b>, or <b>chunks</b> (sentence-aware chunks for RAG).

## `mode` (type: `string`):

<b>article</b>: main content only (navigation, ads and footers removed). <b>fullPage</b>: the whole page body.

## `ruby` (type: `string`):

How to handle Japanese reading annotations: <b>remove</b> → 漢字, <b>parentheses</b> → 漢字(かんじ).

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

Keep hyperlinks as Markdown links. Off = link text only (cleaner for LLMs).

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

Target chunk length in characters (for RAG chunks).

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

Characters repeated between neighbouring chunks.

## `respectRobotsTxt` (type: `boolean`):

Skip pages that the site disallows for automated access (recommended).

## `minDelayPerSiteMs` (type: `integer`):

Minimum time between two requests to the same website. A Crawl-delay in robots.txt is also honoured.

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

Pages fetched at the same time (across different websites).

## `timeoutSecs` (type: `integer`):

Maximum time to download one page.

## `maxPageSizeMb` (type: `integer`):

Larger pages are skipped (and not charged).

## Actor input object example

```json
{
  "urls": [
    "https://en.wikipedia.org/wiki/Optical_character_recognition",
    "https://www.aozora.gr.jp/cards/000148/files/773_14560.html"
  ],
  "outputFormat": "markdown",
  "mode": "article",
  "ruby": "remove",
  "includeLinks": false,
  "chunkSize": 1000,
  "chunkOverlap": 100,
  "respectRobotsTxt": true,
  "minDelayPerSiteMs": 1000,
  "maxConcurrency": 5,
  "timeoutSecs": 30,
  "maxPageSizeMb": 10
}
```

# Actor output Schema

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

Converted pages with metadata.

## `overview` (type: `string`):

Status, title, language and size of each page.

# 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://en.wikipedia.org/wiki/Optical_character_recognition",
        "https://www.aozora.gr.jp/cards/000148/files/773_14560.html"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("masahishop/web-to-markdown-cjk").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://en.wikipedia.org/wiki/Optical_character_recognition",
        "https://www.aozora.gr.jp/cards/000148/files/773_14560.html",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("masahishop/web-to-markdown-cjk").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://en.wikipedia.org/wiki/Optical_character_recognition",
    "https://www.aozora.gr.jp/cards/000148/files/773_14560.html"
  ]
}' |
apify call masahishop/web-to-markdown-cjk --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,masahishop/web-to-markdown-cjk"
        }
    }
}
```

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/YimGGzkIY9Eijm2Mg/builds/WkCKNmESxafVrjOsN/openapi.json
