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 . It does not decide how the resulting files are named, indexed, deduplicated against existing notes, or organized into a knowledge base — that belongs to the host PKM / the user's own conventions. Stopping at faithful extraction keeps this skill orthogonal and reusable. When the user wants the output filed into a vault, extract first, then hand the clean Markdown to their organizing workflow.
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) .
Choose the path
⚠️ base (Bitable) is not actually operationalized in Path A yet — the extractor only records the token ( DISPATCH["url base"] : "Bitable API (outside this skill) — record token" ) and Step 2 below has no row for it. Listed here for completeness of what a Feishu URL can be, not as a claim that Path A extracts Bitable content end to end.
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:
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:
…/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. On the .data.markdown branch (≤1.0.32), if it is still reachable at all, the tags already survive as literal text directly in source.md , and checking source.md there remains correct — this caveat is specific to the pandoc fallback, which is the current default : .data.markdown was null in every real document checked (11/11 — 3/3 fresh fetches on the currently installed lark cli 1.0.80, plus 8/8 archived 2026 07 25 fetches), so whether the old branch is still reachable on any current lark cli build was not confirmed.
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). 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). 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 is a plain regex scan — 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); svg and source output types also exist. The output path must have a real image extension matching what the command actually produces (it errors if you ask for .png when the true format is .jpg — match the extension to what the command reports, or omit the extension per its own help ). The preview is a working cache by default : record the whiteboard token, observed MIME/bytes/hash, and optional cache path in the artifact manifest; do not silently promote the JPEG to Git/LFS. If the durable archive needs an independent binary copy, route it explicitly to OSS. This matters because diagrams frequently carry decision relevant content absent from the document's plain text sections — e.g. a swimlane/process diagram can carry role by role steps and concrete numeric thresholds nowhere else in the doc. Treating a document as "fully extracted" without opening these blocks silently discards exactly the content most likely to carry its actual operating logic.
5. Final residual tag check (acceptance gate — run this on every fetched document, not just collections). A single standalone document with no cross doc references still needs this: an inline whiteboard or unresolved reference tag can appear with zero other documents involved (this is exactly what happened on a real single doc extraction 2026 08 16 — no hub, no recursion, just 3 unread whiteboards). Every rich media reference must have been resolved and rendered. Run this recursively over the whole working directory, not a single file — a collection has one <sanitized title .html / .md pair per document (step 3), and the pandoc converted .md can report "clean" on its own while real tags were silently dropped (see step 3's callout), so the scan needs to reach every .html on disk:
lark tr and view type= in that pattern are pre existing, unverified against real HTML terms — unlike the other five, they have no backing regex in feishu extract refs.py and no dispatch entry, so a hit here has no structured tooling support; treat it as "stop and inspect the raw tag by hand," not as something the extractor already understands.
⚠️ On each document's saved .html , "empty" is not a literal stop condition — treat each hit as a worklist item, not a failure to loop on