Xpersona
语

语雀知识库导出

CLAWHUB · Unverified

将语雀知识库的所有文档导出为本地 Markdown 文件,保留目录结构。需要 Chrome DevTools MCP。 Skill: 语雀知识库导出 Owner: sh1-5 Summary: 将语雀知识库的所有文档导出为本地 Markdown 文件,保留目录结构。需要 Chrome DevTools MCP。 Tags: latest:1.0.1 Version history: v1.0.1 | 2026-03-24T07:24:17.730Z | user yuque-export 1.0.1 - 新增支持自动保留语雀知识库的目录层级结构,导出时按分组/文件夹生成对应本地文件夹。 - 新增 --images 参数:可批量下载 Markdown 里的图片到本地 _assets/ 目录,图片链接同时替换为本地相对路径。 - 目录和文档树改为通过 /api/catalog_nodes 获取,准确反映原有的文件夹和分组层级。 - 默认输出目录更新为 ~/Downloads/yuque-export,可通过 --output 自定义,导出方式更灵活。

62
Rank
84
Safety
1.0k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1K downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17feztf2vzncxbpyvd0mkrzqd83hf6z:yuque-export
  1. Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-sh1-5-yuque-export/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

28,915 characters of source documentation, loaded on request.

Extracted files

3 files captured from the source.

SKILL.md

---
argument-hint: <语雀知识库URL> [--output=~/Downloads/yuque-export] [--images]
description: 将语雀知识库的所有文档导出为本地 Markdown 文件,保留目录结构。需要 Chrome DevTools MCP。
---

# yuque-export

将指定语雀知识库的所有文档导出为 Markdown 文件,保留知识库的目录层级结构。

## 使用方式

```
/yuque-export https://www.yuque.com/{username}/{repo-name}
/yuque-export https://www.yuque.com/{username}/{repo-name} --output=~/Documents/notes
/yuque-export https://www.yuque.com/{username}/{repo-name} --images
```

- `--output`:指定输出目录,默认 `~/Downloads/yuque-export`
- `--images`:同时下载图片到本地 `_assets/` 目录,并替换 Markdown 中的图片链接

## 前置条件

- **Chrome DevTools MCP** 必须已连接 —— 通过浏览器已登录的 session 访问语雀内部 API。

## 执行步骤

### Step 1:导航并确认登录

用 `mcp__chrome-devtools__navigate_page` 打开知识库 URL(如 `https://www.yuque.com/user/repo`)。

然后用 `mcp__chrome-devtools__evaluate_script` 检查登录状态:

```javascript
const resp = await fetch('/api/mine', { credentials: 'include', headers: { 'Accept': 'application/json' } });
const data = await resp.json();
JSON.stringify({ loggedIn: resp.ok, user: data.data?.name || null });
```

若未登录(`loggedIn: false`),导航到 `https://www.yuque.com/login`,提示用户手动登录,然后用 `mcp__chrome-devtools__wait_for` 等待登录完成(等待 URL 变化离开 login 页面)。

### Step 2:获取 book_id

导航到知识库首页后,语雀会自动发起包含 book_id 的 API 请求。用 `mcp__chrome-devtools__list_network_requests` 过滤 fetch/xhr 请求,从中提取 book_id:

```
查找匹配以下模式的请求 URL:
- /api/books/{book_id}/overview
- /api/docs?book_id={book_id}
```

用正则 `/\/api\/(?:books\/(\d+)|docs\?book_id=(\d+))/` 匹配,提取数字部分即为 book_id。

**注意**:`/api/v2/repos/` 需要 Token 认证,浏览器 session 不够,**不要使用**。

### Step 3:获取目录结构和文档列表

**必须使用 `/api/catalog_nodes` API**(不是 `/api/books/{id}/docs`),只有这个 API 返回完整的目录层级信息:

```javascript
const BOOK_ID = /* Step 2 获取的 book_id */;
const resp = await fetch(`/api/catalog_nodes?book_id=${BOOK_ID}`, {
  credentials: 'include', headers: { 'Accept': 'application/json' }
});
const nodes = (await resp.json()).data || [];
JSON.stringify(nodes.map(n => ({
  title: n.title,
  type: n.type,           // 'DOC' = 文档, 'TITLE' = 目录节点(注意是大写)
  uuid: n.uuid,
  url: n.url,             // 即 slug,用于 API 调取文档内容
  parent_uuid: n.parent_uuid || '',
  level: n.level,         // 层级深度,0=根级
  doc_id: n.doc_id,
  visible: n.visible,
})));
```

**注意**:
- `/api/books/{id}/docs` 和 `/api/docs?book_id=` **不返回** uuid/parent_uuid 字段,无法构建目录树
- catalog_nodes 不需要分页,一次返回全部
- `type` 值是**大写**的 `'DOC'` 和 `'TITLE'`

拿到节点列表后,**在 Claude 端构建目录树**:
1. `type === 'TITLE'` 的节点是纯目录节点(不含内容),其 `title` 用作目录名
2. `type === 'DOC'` 的节点是文档,生成 `{title}.md` 文件
3. 用 `parent_uuid` → `uuid` 关系建立父子层级
4. `parent_uuid` 为空的是根级节点
5. 为每篇 DOC 文档计算相对路径(如 `效率类/Markdown 语法.md`)
6. 只下载 `type === 'DOC'` 的节点内容,TITLE 节点跳过

### Step 4:注入 lakeToMarkdown 转换函数

通过 `mcp__chrome-devtools__evaluate_script` 注入。注意:这个函数很长,**必须单独注入,不要和其他逻辑混在一起**。

```javascript
window._lakeToMarkdown = function(lakeHtml, title) {
  if (!lakeHtml || lakeHtml.trim().length < 10) return `# ${title}\n\n(空文档)\n`;

  let html = lakeHtml;

  // ===== Phase 1: 在 DOMParser 前提取特殊 card 元素 =====

  // 代码块
  html = html.replace(
 

_meta.json

{
  "ownerId": "kn7baja5jexcnpqzkm9jep9mqn82fdpf",
  "slug": "yuque-export",
  "version": "1.0.1",
  "publishedAt": 1774337057730
}

skill-card.md

## Description:

通过 Chrome DevTools MCP 使用已登录的浏览器会话,将语雀知识库文档导出为保留目录结构的本地 Markdown 文件。

This skill is ready for commercial/non-commercial use.

## Publisher:

[sh1-5](https://clawhub.ai/user/sh1-5)

### License/Terms of Use:

MIT-0

## Use Case:

Developers and knowledge workers use this skill to export authenticated Yuque knowledge bases into local Markdown archives. It is useful when preserving Yuque folder structure and optionally localizing referenced images for offline review or migration.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: The skill processes authenticated Yuque knowledge-base content through the agent.

Mitigation: Use it only for Yuque repositories whose contents are appropriate for agent processing.

Risk: The skill writes exported Markdown files to a local destination.

Mitigation: Export to a dedicated folder and review the destination before running.

Risk: The --images option downloads remote Yuque CDN assets into local storage.

Mitigation: Enable --images only when local image copies are desired, then review the generated _assets folder.

## Reference(s):


## Skill Output:

**Output Type(s):** [text, markdown, shell commands, configuration, guidance]

**Output Format:** [Markdown files and concise progress or completion text, with optional shell commands for local file and asset handling.]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [Writes a local directory tree under the selected output path and may create an _assets folder when image download is requested.]

## Skill Version(s):

1.0.1 (source: server release evidence)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

Sponsored

Ads related to 语雀知识库导出 and adjacent AI workflows.