# Chinese to Markdown｜微信公众号/头条/新浪/知乎 → RAG-ready MD (`ahuang/chinese-article-to-markdown`) Actor

Paste WeChat 公众号 / Toutiao / Sina / Zhihu URLs → clean LLM-ready Markdown. Optional RAG chunks. $0.002/article; failed URLs free. Built for AI agents.

- **URL**: https://apify.com/ahuang/chinese-article-to-markdown.md
- **Developed by:** [HehuanHuang](https://apify.com/ahuang) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 article extracteds

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

## Chinese to Markdown｜微信公众号 / 头条 / 新浪 / 知乎 → RAG-ready MD

Turn Chinese articles into clean, **LLM-ready Markdown** with metadata. Paste URLs from **WeChat Official Accounts (微信公众号)**, **Toutiao (今日头条)**, **Sina (新浪)** and **Zhihu (知乎)** — ads, sidebars, follow-me footers and QR codes stripped.

Built for **RAG pipelines, LLM datasets and AI agents**. Pure HTTP — **no headless browser**. Charged **only on success**.

把中文网页文章转成干净 Markdown（去广告/侧栏/关注文案/二维码），面向 **RAG 知识库、数据集、AI 智能体**。纯 HTTP，失败不计费。

> **Positioning:** This Actor is for **known article URLs** you already have. It does **not** search WeChat accounts or scrape full history lists (that’s a different product category).

### Supported sites｜支持站点

| Site | Status | Notes |
|---|---|---|
| WeChat 公众号 (`mp.weixin.qq.com`) | ✅ | Author/account cleaned; footer/QR removed; images kept |
| Sina 新浪 | ✅ | Main body only |
| Toutiao 今日头条 | ⚠️ Limited | Text OK; videos / 微头条 / deleted no; signed image URLs expire |
| Zhihu 知乎专栏 | ⚠️ Limited | Some work; many blocked |
| Douban 豆瓣 | ❌ | Error row; **not charged** |

### Use cases｜用例

- **RAG / knowledge bases** — feed 公众号 & news into vector DBs（optional built-in chunking）
- **AI agents / MCP tools** — “read this Chinese URL as Markdown”
- **LLM datasets** — Chinese corpora with source fields
- **Brand & media monitoring** in China（when you already have links）

### Why this Actor｜对比（诚实）

| | This Actor | zen-studio WeChat scraper（品类头部） | technicaldost wechat→MD |
|---|---|---|---|
| Primary job | **URL → clean Markdown**（+ optional chunks） | Account **search / history / read counts** | WeChat → MD（+ optional Sogou discovery） |
| Sites | 公众号 + 头条 + 新浪 + 知乎 | WeChat-focused acquisition | WeChat-focused |
| Price (public) | **$0.002**/success article（~$2/1k） | Higher PPE on search/history events | ~$0.005/item class |
| Failures | Error row, **$0** | — | — |
| Best when | You already have links for RAG | You need to **discover** articles | WeChat-only MD |

We **don’t claim** #1 for 公众号 search — we claim **cheap, clean MD for known URLs**.

### Pricing｜定价（与线上一致）

| Event | Price |
|---|---|
| `article-extracted` | **$0.002** / successful article |
| `article-chunked` | **$0.003** / successful article（instead of extracted; **per article, not per chunk**） |
| Failed / blocked / unsupported | **$0** |
| `apify-actor-start` | ≈ **$0.00005** / run |

### Input｜输入

| Field | Required | Description |
|---|---|---|
| `startUrls` | yes | Article URLs |
| `outputFormat` | no | `markdown` | `json` | `jsonl` |
| `maxConcurrency` | no | default 5 |
| `chunking` | no | default false |
| `chunkSize` / `chunkOverlap` | no | 512 / 64（cl100k） |

### Output example

```json
{
  "inputUrl": "https://mp.weixin.qq.com/s/...",
  "title": "...",
  "author": "量子位",
  "date": "2025-05-18",
  "word_count": 3804,
  "markdown": "# ...\\n\\n..."
}
```

Failed: `{ "inputUrl": "...", "error": "...", "status": "..." }` — **not charged**.

### RAG chunking｜切块

`chunking: true` → token-based chunks（heading → paragraph → sentence）, OpenAI-compatible `cl100k`, overlap only within the same section. Also writes `RESULTS.jsonl` to the key-value store.

### Agents / MCP

Use as an agent tool: input URL list → Markdown / chunk rows. Enable Apify **Agents** category + Console **MCP** block. Prompt tip: “Convert these 公众号 URLs to Markdown chunks for embedding.”

### FAQ

**Q: Can it search a 公众号 and list all history?**\
A: **No.** Paste article URLs you already have. For discovery, use a WeChat search/history Actor.

**Q: Why did Zhihu / Toutiao fail?**\
A: Anti-bot / limited support. You get an error row and **pay $0**.

**Q: Does chunking cost more per chunk?**\
A: No — **$0.003 per successfully chunked article**, regardless of `chunkSize`.

**Q: Browser / login?**\
A: Pure HTTP, public pages only.

### Notes｜注意

Public pages only. WeChat verification pages: one automatic retry; still failing → free. Lower concurrency if rate-limited. Respect source ToS & copyright.

### You might also like｜同矩阵

- [Web to Markdown Extractor (RapidAPI)](https://rapidapi.com/阿黄/api/web-to-markdown-extractor) — same Chinese-first MD idea as an HTTP API
- [YouTube Transcript｜字幕→MD](https://apify.com/ahuang/youtube-transcript)
- [Bilibili Scraper](https://apify.com/ahuang/bilibili-video-comments-danmaku-scraper)
- [Weibo Snapshot](https://apify.com/ahuang/weibo-snapshot)

# Actor input Schema

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

Article URLs. Supported: WeChat 公众号 (mp.weixin.qq.com/s/...) — full support; Sina 新浪 (news.sina.com.cn) — full support; Toutiao 头条 (toutiao.com/article/...) — LIMITED (text articles only; videos / 微头条 / deleted may fail; image URLs expire); Zhihu 知乎 (zhuanlan.zhihu.com/p/...) — LIMITED (many articles blocked). Douban 豆瓣 is NOT supported (unsupported-site error, not charged). Failed URLs are not charged.
文章 URL。支持：微信公众号（完整支持）、新浪（完整支持）、今日头条（有限：仅图文；视频/微头条/已删可能失败；图片链接会过期）、知乎（有限：大量文章会被拦截）。豆瓣不支持（返回不支持错误，不计费）。失败不计费。

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

markdown (default): core fields — url, title, author, date, word_count, images, markdown. json: also site, fetchedUrl, image_count; WeChat adds account, original_author.
markdown（默认）：核心字段。json：额外含 site、fetchedUrl、image_count；公众号另含 account、original_author。
jsonl: same core fields as markdown, and the whole result is also saved as one JSONL file (key-value store record RESULTS.jsonl).
jsonl：字段同 markdown，并把全部结果另存为 JSONL 文件（KV 存储记录 RESULTS.jsonl）。

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

Parallel HTTP fetches (1–20, default 5). Lower this if a site rate-limits you.
并行 HTTP 请求数（1–20，默认 5）。若站点限流请调低。

## `chunking` (type: `boolean`):

Split each article into token-sized chunks for embedding. Each chunk becomes one dataset item with heading_path, chunk_index, token_count, overlap_tokens, text and source metadata (url, title, author, date, site); all chunks are also saved as RESULTS.jsonl in the key-value store. Tokens counted with tiktoken cl100k_base. Billing is still per successfully extracted article.
把每篇文章按 token 切块，便于向量化。每块一条 dataset 记录，含 heading_path、chunk_index、token_count、来源元数据；全部块另存为 KV 记录 RESULTS.jsonl。token 用 tiktoken cl100k_base 计数。仍按成功文章计费。

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

Max tokens per chunk (64–8192, default 512). Chunks split on Markdown headings first, then paragraphs, then sentences.
每块最大 token 数，优先按标题、段落、句子切。

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

Tokens repeated from the end of the previous chunk within the same section (0 to chunkSize/2, default 64). No overlap across headings.
同一小节内与上一块重叠的 token 数（0 到 chunkSize/2）。跨标题不重叠。

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://mp.weixin.qq.com/s/AcEPmIywwvC7poC7wmVdSA"
    }
  ],
  "outputFormat": "markdown",
  "maxConcurrency": 5,
  "chunking": false,
  "chunkSize": 512,
  "chunkOverlap": 64
}
```

# Actor output Schema

## `results` (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://mp.weixin.qq.com/s/AcEPmIywwvC7poC7wmVdSA"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ahuang/chinese-article-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://mp.weixin.qq.com/s/AcEPmIywwvC7poC7wmVdSA" }] }

# Run the Actor and wait for it to finish
run = client.actor("ahuang/chinese-article-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://mp.weixin.qq.com/s/AcEPmIywwvC7poC7wmVdSA"
    }
  ]
}' |
apify call ahuang/chinese-article-to-markdown --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ahuang/chinese-article-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/Ktj3hRi2ud4rFtBsC/builds/Kaz0yteDbl01vKQ8p/openapi.json
