feishu-doc-scraper
Extract Feishu (Lark) Docs, Wiki pages/collections, spreadsheets, and Minutes (妙记) transcripts into faithful local Markdown via the lark-cli API (no LLM rewriting of the body; browser-DOM fallback when lark-cli can't reach the content). Use whenever the source is a Feishu/Lark URL and fidelity matte
By daymade · 505 installs
npx skills add daymade/claude-code-skills --skill feishu-doc-scraper
Source repository · Upstream listing
Feishu Doc Scraper
Extract a Feishu/Lark source into faithful local Markdown. Prefer the lark cli API — it extracts the body programmatically (no model paraphrasing), follows a collection's reference graph, and reads permission boundaries from error codes instead of guessing. Treat the rendered browser page as a fallback , not the source of truth: in real collection scraping work the API path consistently does the whole job while the browser path is never needed.
Scope (read this first)
This skill's contract is faithful per source Markdown + a record of what was extracted . Naming, indexing, deduplication and knowledge ownership belong to the recipient's archive workflow. For a filing request, including permission to choose a suitable location, first follow [archive destination handoff](references/archive destination handoff.md). Temporary extraction may proceed while the destination is unresolved; permanent filing and uploads follow the host's selected ownership and storage contract.
For every document read or archived, load [comments and feedback](references/comments and feedback.md).
It owns the body plus discussion workflow, selected scope, body only exception,
snapshot commands, interpretation and coverage checks.
Extraction and durable storage are separate decisions. A downloaded MP4/XLSX/DOCX/image is a working copy, not evidence that the file belongs in Git or Git LFS. For a knowledge base archive, default to:
Git: faithful Markdown plus structured CSV/JSON/HTML, source locators, revision/permission state, byte counts, MIME types, and hashes.
Platform original: Feishu remains the source of record for raw binary attachments when the stable document/file token is still retrievable. A local download is an optional cache and may be absent on a fresh clone.
OSS/object storage: only when the archive needs an independent durable copy or the platform source is not a reliable long term retrieval path. Uploading is a separate authorized operation, not a fallback the extractor chooses by itself.
Before filing an archive, declare this split in an artifact manifest and run the bundled storage validator. The complete schema and examples are in [references/archive storage contract.md](references/archive storage contract.md) .
Select the delivery scope from the user's requested result before loading fallback
or reader procedures. For original file downloads, use
[attachment archives](references/attachment archives.md): fetch the body first,
enumerate its actual resource types, then load only those handlers. Record body,
attachments, independent retention and reader acceptance separately. An attachment
batch alone never establishes completion of the document's reference graph.
For failed media exports, original preview retrieval, or an Obsidian reading handoff, load
[original media and reader handoff](references/original media and reader.md).
Use its verified preview downloader and API capture renderer before expanding
the batch. Its Delivery completion gate ( check reader delivery.py finalize )
is the reader delivery completion entry; conversion, byte and search success do
not replace a current actual reader evidence record.
For a user selected personal favorites destination, its source catalog producer
hands off to favorites search without changing this Skill's filing ownership.
Choose the path
Resolve wiki nodes before choosing a handler. Use the actual obj type and its installed CLI guide; for example, bitable uses lark base . A 3380002 Unsupported document type response from docs +fetch identifies a handler mismatch, not a permission denial. If the required guide is unavailable, retain the token and type in the worklist as unextracted.
A collection/hub is just a docx whose body references other docs — Path A handles it by recursively following the reference graph , not by visiting pages in a browser.
Path A — lark cli API extraction (primary)
Full command catalog, recursion engine, cross tenant and personal space nuances: [references/lark cli api extraction.md](references/lark cli api extraction.md) . The essentials for the common case:
Resolve current CLI commands, identity and permission handling through
lark cli router when available, otherwise the installed lark cli skills list
and its selected lark guides. Historical examples below document capture
shapes; use the installed guide when flags, response envelopes or methods differ.
For source card files, the [batch archive procedure](references/attachment archives.md)
uses the exercised download command. A supplied share password does not establish
whether the current identity needs browser access; attempt the authorized API read
first, and respect its permission result.
1. Disable the proxy for Feishu domestic domains. Feishu's .feishu.cn endpoints are direct connect in mainland China; routing them through a local proxy leaks credentials through the proxy and gets DNS hijacked. lark cli itself warns about this. Always:
This does not conflict with any "Claude/Anthropic domains must use the proxy" rule — Feishu is a different host and is direct.
2. Classify the URL, then resolve to a fetchable doc token.
…/wiki/<node token — a wiki node token is not a doc token. Resolve it first:
Then dispatch on the actual obj type — never assume docx: docx → step 3 below; sheet / sheets → step 4 in the reference; bitable → the installed lark base guide; file / slides → the installed lark drive /slides guide. docs +fetch on a non docx obj type fails with 3380002 Unsupported document type '…'. Only docx is supported. — that error is evidence the wrong handler was selected, not that the source is unreadable.
…/docx/<doc token — already a doc token, fetch directly.
…/sheets/<token — spreadsheet, use the sheets commands (see reference).
…/minutes/<token — Minutes, go to Path C .
3. Fetch the body programmatically — never via the model. The body field moved across lark cli versions, so probe both rather than hard coding one (this keeps working whichever version is installed):
⚠️ <sanitized title must be a distinct name per document, never the literal string "source" reused across fetches. Step 4 below fetches multiple documents (the hub, then every child it references) into the same working directory — running this exact snippet twice with a hardcoded source.md / source.html would let the second fetch silently overwrite the first document's saved body before you ever got to check it. The rest of this section still says " source.html "/" source.md " as shorthand for whichever document's own saved files you're currently looking at — not one shared filename for the whole collection.
⚠️ On this pandoc branch, pandoc f html t gfm silently strips several of Feishu's custom embedded tags — verified against real documents, 2026 08 16/17, and the damage is worse the deeper you look:
whiteboard ( <whiteboard token="…" , an inline diagram block) vanishes with zero trace. Confirmed on a real document: 3 raw tags in .data.document.content → 0 trace in the pandoc converted source.md ( grep c whiteboard found 3 hits in the raw HTML, 0 in the converted Markdown).
mention doc — whose real raw tag is <cite doc id="…" file type="wiki docx" title="…" type="doc" </cite , not the <mention doc token="…" type="…" Title</mention doc shape this skill originally assumed — also vanishes with zero trace, and worse than just losing the token/type: the title lives in a title="…" attribute and the tag body is empty, so pandoc drops the whole element and not even the bare title text survives.
sheet is unconfirmed either way (no real sheet reference document was found to test) — treat it as capable of silently vanishing too until proven otherwise.
image — whose real raw tag is a standard <img src="<drive token " alt="…" … , not <image token="…" — does not vanish: pandoc passes the raw <img element through mostly intact ( src / id / href / width / height / alt survive; name= is dropped; mime= / scale= are renamed data mime= / data scale= ).
lark table turns out not to be a real tag for ordinary docx tables at all — they use plain <table HTML, and pandoc generally converts them intact (clean GFM pipe table syntax for single paragraph cells, or a raw <table HTML block for multi paragraph cells) — not part of this silent loss class.
Because the loss is real and type dependent, extraction (step 4) and the residual tag check (step 5) must operate on source.html , never on source.md , whenever this pandoc branch was taken. If the actual response provides .data.markdown , check that saved Markdown instead. Select the branch from the current response, not a remembered CLI version; the 1.0.80 HTML tests establish the pandoc loss mechanism, not which field every later release returns.
format markdown is not a valid value (lark cli warns and falls back to json). Keep stdout and stderr separate — a harmless [deprecated] line goes to stderr, and piping 2 /dev/null and jq together produced a false Exit code 5 in practice. The body must reach disk via jq / pandoc , never retyped or summarized by the model — paraphrasing silently corrupts source text, the single most important fidelity rule. (pandoc only re renders HTML structure to Markdown; it does not rewrite prose — the tag stripping above is a structural loss, not a prose fidelity one, which is why source.html must stay on disk and stay authoritative for rich media references.)
4. If it's a collection/hub, follow the reference graph (BFS) within the user's authorized capture scope. The hub body contains <mention doc (real raw tag: <cite doc id="…" ), <sheet , <image (real raw tag: <img src="…" ) tags, <whiteboard token="…" blocks, and cross tenant / Minutes / Tencent Meeting URLs. Extract every reference, dispatch by type, fetch, and repeat on each newly fetched doc until no new references remain (leaf nodes) — except whiteboard , which is never fetched or recursed : it's inline visual content, not a link to another document (see the dedicated instruction below). The caller applies the user's selected roots, depth and resource set: a reference beyond that scope stays a recorded locator (URL/token + title), marked not captured in the worklist, and does not become a required fetch. A full collection request still uses BFS until all in scope branches reach leaves. Use the bundled extractor so nothing is silently missed (a missed reference = a missing document, the 1 hub scraping failure):
Run this once per fetched document — the root, then every newly fetched child — using that document's own <sanitized title .html (see step 3's naming caveat). The extractor scans reference text and parses source card tags — it works on either the .html or .md for a given document, since it just checks whether the file's text contains the tags — but .html is the one to trust when both exist ; fall back to .md only if no .html was ever saved for that document (the .data.markdown branch, see step 3). Recursion loop, dispatch table, and the cross tenant/ my.feishu.cn personal space rules are in the reference.
Whiteboard blocks are not a followable reference — export and read them in place. A whiteboard token="…" tag is Feishu's native diagram/flowchart block, inlined in the current document — it is not a pointer to another document, so don't try to recurse/fetch it like mention doc / sheet . It must be understood visually: a flowchart's meaning is not reliably recoverable from raw node coordinates/text fragment lists alone. Export a preview image and actually look at it:
Then use the Read tool on the resulting .jpg to see the diagram's actual content. output type raw is also available (structured node JSON — useful as a cross check/searchable index, but not a substitute for looking at the rendered image);