文档抓取工具

设计与多媒体 社区

技能解读

当前原文的自动摘译,尚未人工审校。

概述

这是一种提取技巧,而不是写作技巧。请勿使用 LLM 重写、总结、平滑或推断缺失的文档内容,除非用户明确要求在存档完成后进行单独分析。

工作流决策树

识别 URL 类型。 kdocs.cn/view/l/<share_id>或kdocs.cn/l/<share_id>:首先读取公共链接元数据。 wps.processon.com/diagrams/view?...:提取file_id和group_id,然后使用ProcessOn数据API。 wps.processon.com/wpsapi/diagrams/view/api?...:直接视为源API。其他 WPS/KDocs 页面:收集公共元数据,仅在可用时尝试官方公共导出/下载,然后使用浏览器 DOM 捕获作为后备。

硬性规定

除非用户明确请求,否则切勿登录、保存到帐户、复制到用户的云驱动器或更改远程文档。切勿绕过验证码、付费墙、租户限制或权限墙。除非用户提供授权访问,否则需要登录的公共链接是硬边界。不要推断隐藏节点或丢失的文本。保留 API 或渲染的 DOM 实际公开的内容。

脚本/

wps_processon_extract.py:公共 WPS/KDocs ProcessOn .pof 思维导图的确定性提取器。它解析 KDocs 共享元数据,下载 ProcessOn 数据 API JSON,解析嵌入的定义,并编写 Markdown 和清单。 render_svg_tiles.py:基于 macOS Quick Look 的 SVG 到 PNG 渲染器,用于带有 foreignObject 文本的全画布 SVG。它渲染方形垂直图块并将它们拼接成一个 PNG。

参考文献/

processon-mindmap-api.md:WPS 托管的 ProcessOn 文件的端点模式和有效负载形状。 rendered-svg-capture.md:用于提取渲染的全画布 SVG 并生成 PNG 的浏览器端进程。 capture-manifest.md:最小清单字段和验收检查。 permission-and-failure-boundaries.md:登录墙、禁止升级和故障报告规则。

流狐档案 运行与权限由流狐静态检查推断,不代表作者声明或实际测试结果。
领域
设计与多媒体
作者声明的智能体
未找到明确声明;不据此推断已兼容或已测试
静态检查
88 / 100 · 启发式扫描,不代表运行安全
运行环境证据
未执行;当前没有隔离运行测试证据
作者 / 版本 / 许可证
@daymade · 未声明许可证
上下文用量评级
低消耗
接入复杂程度
需简单配置
是否需要外部接口密钥
不需要
兼容的系统
macOS
运行环境要求
未检出明确要求
检测到的文件与系统行为
  • 只读
  • 允许写入 / 修改
  • 命令执行
网络行为
仅限本地
安装命令数
无(仅作为资料)

需要注意: 未声明工具权限范围;实际权限由运行环境决定。

作者说明文件(原文) SKILL.md

# WPS Doc Scraper

## Overview

Archive WPS/KDocs public documents with source fidelity. Prefer unauthenticated data APIs, keep the raw payloads, capture the original visual artifact when the document is a canvas or mind map, and generate Markdown only as a structured representation of the source.

This is an extraction skill, not a writing skill. Do not use an LLM to rewrite, summarize, smooth, or infer missing document content unless the user explicitly asks for a separate analysis after the archive is complete.

## Workflow Decision Tree

1. Identify the URL type.
   - `kdocs.cn/view/l/<share_id>` or `kdocs.cn/l/<share_id>`: read public link metadata first.
   - `wps.processon.com/diagrams/view?...`: extract `file_id` and `group_id`, then use the ProcessOn data API.
   - `wps.processon.com/wpsapi/diagrams/view/api?...`: treat as the source API directly.
   - Other WPS/KDocs pages: collect public metadata, try official public export/download only when available, then use browser DOM capture as a fallback.

2. For ProcessOn `.pof` mind maps or canvases, run the API extractor:

   ```bash
   python3 /path/to/wps-doc-scraper/scripts/wps_processon_extract.py \
     --url "https://www.kdocs.cn/view/l/..." \
     --output-dir "/path/to/archive-dir"
   ```

   Expected outputs: `processon-api.json`, `processon-definition.json`, `capture-manifest.json`, and `<title>.md`.

3. Capture the original image.
   - If the page exposes a rendered SVG, save the serialized full SVG as `<title>-全画布.svg`.
   - If the SVG uses `foreignObject`, do not trust ImageMagick alone for text rendering. Use `scripts/render_svg_tiles.py` to make the PNG through macOS Quick Look square tiles.

   ```bash
   python3 /path/to/wps-doc-scraper/scripts/render_svg_tiles.py \
     --svg "/path/to/<title>-全画布.svg" \
     --output "/path/to/<title>-全画布.png"
   ```

4. Validate the archive.
   - Markdown is a structural conversion, not an editorial rewrite.
   - The original image exists for visual documents.
   - Raw JSON and manifest exist.
   - No output text contains the Unicode replacement character `�`.
   - Any failed or permission-limited path is recorded in the manifest or final response.

## Hard Rules

- Never log in, save to an account, copy into the user's cloud drive, or mutate the remote document unless the user explicitly requests it.
- Never bypass CAPTCHAs, paywalls, tenant restrictions, or permission walls. A public link that requires login is a hard boundary unless the user provides authorized access.
- Do not infer hidden nodes or missing text. Preserve what the API or rendered DOM actually exposes.
- HTTP 200 is not enough. Detect login-wall payloads such as `用户未登录`, empty definitions, and placeholder shells.
- Keep raw source artifacts before transformation: API JSON, parsed definition JSON, serialized SVG, screenshots or PNGs, and a capture manifest.
- For browser fallback, capture DOM/source data before screenshots when possible; screenshots alone are not a faithful text archive.
- Report extraction gaps plainly. Do not silently produce a polished Markdown file from partial data.

## Bundled Resources

### scripts/

- `wps_processon_extract.py`: deterministic extractor for public WPS/KDocs ProcessOn `.pof` mind maps. It resolves KDocs share metadata, downloads the ProcessOn data API JSON, parses the embedded definition, and writes Markdown plus a manifest.
- `render_svg_tiles.py`: macOS Quick Look based SVG-to-PNG renderer for full-canvas SVGs with `foreignObject` text. It renders square vertical tiles and stitches them into one PNG.

### references/

- `processon-mindmap-api.md`: endpoint pattern and payload shape for WPS-hosted ProcessOn files.
- `rendered-svg-capture.md`: browser-side process for extracting the rendered full-canvas SVG and producing a PNG.
- `capture-manifest.md`: minimum manifest fields and acceptance checks.
- `permission-and-failure-boundaries.md`: login walls, forbidden escalation, and failure reporting rules.

讨论

基于 GitHub Discussions。登录 GitHub 即可参与讨论、点赞、订阅更新。