Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

hotic/feishu2md

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

119 Commits
119 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

feishu2md

Golang - feishu2md Unittest Release Docker - feishu2md Render - feishu2md Last Review

这是一个下载飞书文档为 Markdown 文件的工具,使用 Go 语言实现。

请看这里:由于原作者已不再使用飞书文档,项目转为社区维护,欢迎 PR,有能力的维护者会被选择为主协调员。

动机

《一日一技 | 我开发的这款小工具,轻松助你将飞书文档转为 Markdown》

获取 API Token

配置文件需要填写 APP ID 和 APP SECRET 信息,请参考 飞书官方文档 获取。推荐设置为

  • 进入飞书开发者后台
  • 创建企业自建应用(个人版),信息随意填写
  • (重要)打开权限管理,开通以下必要的权限(可点击以下链接参考 API 调试台->权限配置字段)
  • 打开凭证与基础信息,获取 App ID 和 App Secret

如何使用

注意:飞书旧版文档的下载工具已决定不再维护,但分支 v1_support 仍可使用,对应的归档为 v1.4.0,请知悉。

命令行版本

借助 Go 语言跨平台的特性,已编译好了主要平台的可执行文件,可以在 Release 中下载,并将相应平台的 feishu2md 可执行文件放置在 PATH 路径中即可。

查阅帮助文档

$ feishu2md -h
NAME:
  feishu2md - Download feishu/larksuite document to markdown file

USAGE:
  feishu2md [global options] command [command options] [arguments...]

VERSION:
  v2-0e25fa5

COMMANDS:
  config        Read config file or set field(s) if provided
  download, dl  Download feishu/larksuite document to markdown file
  help, h       Shows a list of commands or help for one command

GLOBAL OPTIONS:
  --help, -h     show help (default: false)
  --version, -v  print the version (default: false)

$ feishu2md config -h
NAME:
   feishu2md config - Read config file or set field(s) if provided

USAGE:
   feishu2md config [command options] [arguments...]

OPTIONS:
   --appId value      Set app id for the OPEN API
   --appSecret value  Set app secret for the OPEN API
   --help, -h         show help (default: false)

$ feishu2md dl -h
NAME:
  feishu2md download - Download feishu/larksuite document to markdown file

USAGE:
  feishu2md download [command options] <url>

OPTIONS:
  --output value, -o value  Specify the output directory for the markdown files (default: "./")
  --dump                    Dump json response of the OPEN API (default: false)
  --batch                   Download all documents under a folder (default: false)
  --wiki                    Download all documents within the wiki. (default: false)
  --help, -h                show help (default: false)

生成配置文件

通过 feishu2md config --appId <your_id> --appSecret <your_secret> 命令即可生成该工具的配置文件。

通过 feishu2md config 命令可以查看配置文件路径以及是否成功配置。

更多的配置选项请手动打开配置文件更改。

下载单个文档为 Markdown

通过 feishu2md dl <your feishu docx url> 直接下载,文档链接可以通过 分享 > 开启链接分享 > 互联网上获得链接的人可阅读 > 复制链接 获得。

示例:

$ feishu2md dl "https://domain.feishu.cn/docx/docxtoken"

批量下载某文件夹内的全部文档为 Markdown

此功能暂时不支持Docker版本

通过feishu2md dl --batch <your feishu folder url> 直接下载,文件夹链接可以通过 分享 > 开启链接分享 > 互联网上获得链接的人可阅读 > 复制链接 获得。

示例:

$ feishu2md dl --batch -o output_directory "https://domain.feishu.cn/drive/folder/foldertoken"

批量下载某知识库的全部文档为 Markdown

通过feishu2md dl --wiki <your feishu wiki setting url> 直接下载,wiki settings链接可以通过 打开知识库设置获得。

示例:

$ feishu2md dl --wiki -o output_directory "https://domain.feishu.cn/wiki/settings/123456789101112"
Sync 配置:导出多维表格为 CSV/XLSX

sync_config.yaml 的某个条目中新增 type: csvtype: xlsx,并提供带有 table=tbl...&view=vew... 的链接(通常是知识库页面中嵌入的多维表格页面 URL)。示例:

运行 feishu2md sync run 即可在输出目录下生成以“应用名_表名_视图名”命名的导出文件(与网页版默认命名一致)。字段顺序、筛选与排序与视图一致,支持分页导出。

Docker版本

Docker 镜像:https://hub.docker.com/r/wwwsine/feishu2md

Docker 命令:docker run -it --rm -p 8080:8080 -e FEISHU_APP_ID=<your id> -e FEISHU_APP_SECRET=<your secret> -e GIN_MODE=release wwwsine/feishu2md

Docker Compose:

# docker-compose.yml
version: '3'
services:
  feishu2md:
    image: wwwsine/feishu2md
    environment:
      FEISHU_APP_ID: <your id>
      FEISHU_APP_SECRET: <your secret>
      GIN_MODE: release
    ports:
      - "8080:8080"

启动服务 docker compose up -d

然后访问 https://127.0.0.1:8080 粘贴文档链接即可,文档链接可以通过 分享 > 开启链接分享 > 复制链接 获得。

感谢

About

一键命令下载飞书文档为 Markdown

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 97.5%
  • HTML 1.8%
  • Other 0.7%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.