feishu-docx

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Feishu Docx Exporter

Feishu Docx 导出工具

Export Feishu/Lark cloud documents to Markdown format for AI analysis.
将Feishu/Lark云文档导出为Markdown格式,以便进行AI分析。

Instructions

使用说明

Setup (One-time)

设置(仅需一次)

  1. Install the tool:
bash
pip install feishu-docx
  1. Configure Feishu app credentials:
bash
feishu-docx config set --app-id YOUR_APP_ID --app-secret YOUR_APP_SECRET
  1. 安装工具:
bash
pip install feishu-docx
  1. 配置Feishu应用凭证:
bash
feishu-docx config set --app-id YOUR_APP_ID --app-secret YOUR_APP_SECRET

or use environment variables

或使用环境变量


3. Authorize with OAuth (opens browser):
```bash
feishu-docx auth

3. 通过OAuth授权(将打开浏览器):
```bash
feishu-docx auth

Export Documents

导出文档

Export any Feishu document URL to Markdown:
bash
feishu-docx export "<FEISHU_URL>" -o ./output
The exported Markdown file will be saved with the document's title as filename.
将任意Feishu文档URL导出为Markdown:
bash
feishu-docx export "<FEISHU_URL>" -o ./output
导出的Markdown文件将以文档标题作为文件名保存。

Supported Document Types

支持的文档类型

  • docx: Feishu cloud documents → Markdown with images
  • sheet: Spreadsheets → Markdown tables
  • bitable: Multidimensional tables → Markdown tables
  • wiki: Knowledge base nodes → Auto-resolved and exported
  • docx:Feishu云文档 → 带图片的Markdown格式
  • sheet:电子表格 → Markdown表格
  • bitable:多维表格 → Markdown表格
  • wiki:知识库节点 → 自动解析并导出

Examples

示例

Export a wiki page

导出知识库页面

bash
feishu-docx export "https://xxx.feishu.cn/wiki/ABC123" -o ./docs
bash
feishu-docx export "https://xxx.feishu.cn/wiki/ABC123" -o ./docs

Export a document with custom filename

使用自定义文件名导出文档

bash
feishu-docx export "https://xxx.feishu.cn/docx/XYZ789" -o ./docs -n meeting_notes
bash
feishu-docx export "https://xxx.feishu.cn/docx/XYZ789" -o ./docs -n meeting_notes

Export spreadsheet as Markdown table

将电子表格导出为Markdown表格

bash
feishu-docx export "https://xxx.feishu.cn/sheets/DEF456" --table md
bash
feishu-docx export "https://xxx.feishu.cn/sheets/DEF456" --table md

Read content directly (recommended for AI Agent)

直接读取内容(推荐AI Agent使用)

bash
undefined
bash
undefined

Output content to stdout instead of saving to file

将内容输出到标准输出而非保存到文件

feishu-docx export "https://xxx.feishu.cn/wiki/ABC123" --stdout
feishu-docx export "https://xxx.feishu.cn/wiki/ABC123" --stdout

or use short flag

或使用短标志

feishu-docx export "https://xxx.feishu.cn/wiki/ABC123" -c
undefined
feishu-docx export "https://xxx.feishu.cn/wiki/ABC123" -c
undefined

Read content without saving to file (Python)

不保存文件直接读取内容(Python)

python
from feishu_docx import FeishuExporter

exporter = FeishuExporter(app_id="xxx", app_secret="xxx")
content = exporter.export_content("https://xxx.feishu.cn/wiki/xxx")
print(content)
python
from feishu_docx import FeishuExporter

exporter = FeishuExporter(app_id="xxx", app_secret="xxx")
content = exporter.export_content("https://xxx.feishu.cn/wiki/xxx")
print(content)

Command Reference

命令参考

CommandDescription
feishu-docx export <URL>
Export document to Markdown
feishu-docx auth
OAuth authorization
feishu-docx config set
Set credentials
feishu-docx config show
Show current config
feishu-docx config clear
Clear token cache
命令描述
feishu-docx export <URL>
将文档导出为Markdown格式
feishu-docx auth
OAuth授权
feishu-docx config set
设置凭证
feishu-docx config show
查看当前配置
feishu-docx config clear
清除令牌缓存

Tips

提示

  • Images are automatically downloaded to a folder named after the document
  • Use
    --table md
    for Markdown tables instead of HTML
  • Token is cached and auto-refreshed, no need to re-authorize
  • For Lark (overseas), add
    --lark
    flag
  • 图片将自动下载到以文档命名的文件夹中
  • 使用
    --table md
    参数生成Markdown表格而非HTML表格
  • 令牌会被缓存并自动刷新,无需重新授权
  • 针对海外版Lark,添加
    --lark
    参数