This is a tool for downloading Feishu documents as Markdown files, implemented using Go language.
Please see here: Recruit developers with needs and interests to discuss development and maintenance together. If you are interested, please contact us.
"One skill a day | This small tool I developed can easily help you convert Feishu documents into Markdown"
The configuration file needs to fill in the APP ID and APP SECRET information. Please refer to Feishu official documentation to obtain it. The recommended setting is
Enter the Feishu developer backend
Create an enterprise self-built application (personal version) and fill in the information as you like
(Important) Open permission management and enable the following necessary permissions (you can click the link below to refer to the API debugging console -> permission configuration field)
Obtain basic information of the document, "View new version of the document" permission docx:document:readonly
Get all blocks of the document, "View new version of the document" permission docx:document:readonly
Download materials, "Download images and attachments in cloud documents" permission docs:document.media:download
Get the list of files in the folder, "View, comment, edit and manage all files in the cloud space" permission drive:file:readonly
Obtain knowledge space node information, "View knowledge base" permission wiki:wiki:readonly
Open the credentials and basic information to obtain the App ID and App Secret
Note: The download tool for old versions of Feishu documents has been decided not to be maintained anymore, but the branch v1_support can still be used, and the corresponding archive is v1.4.0. Please be informed.
With the cross-platform feature of Go language, the executable files of the main platforms have been compiled and can be downloaded in Release, and the feishu2md executable file of the corresponding platform can be placed in the PATH path.
Check the help documentation
$ 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 commandGLOBAL 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)
Generate configuration file
The tool's configuration file can be generated through the feishu2md config --appId <your_id> --appSecret <your_secret>
command.
You can use the feishu2md config
command to check the configuration file path and whether the configuration is successful.
For more configuration options, please manually open the configuration file changes.
Download a single document as Markdown
Download directly through feishu2md dl <your feishu docx url>
, the document link can be obtained by sharing > turn on link sharing > people who get the link on the Internet can read > copy the link .
Example:
$ feishu2md dl "https://domain.feishu.cn/docx/docxtoken"
Batch download all documents in a folder as Markdown
This feature does not currently support Docker versions
Download directly through feishu2md dl --batch <your feishu folder url>
. The folder link can be obtained by sharing > turning on link sharing > people who get the link on the Internet can read > copy the link .
Example:
$ feishu2md dl --batch -o output_directory "https://domain.feishu.cn/drive/folder/foldertoken"
Batch download all documents of a knowledge base as Markdown
Download directly through feishu2md dl --wiki <your feishu wiki setting url>
, the wiki settings link can be obtained by opening the knowledge base settings.
Example:
$ feishu2md dl --wiki -o output_directory "https://domain.feishu.cn/wiki/settings/123456789101112"
Docker image: https://hub.docker.com/r/wwwsine/feishu2md
Docker command: 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.ymlversion: '3'services: feishu2md:image: wwwsine/feishu2mdenvironment: FEISHU_APP_ID: <your id> FEISHU_APP_SECRET: <your secret> GIN_MODE: releaseports: - "8080:8080"
Start the service docker compose up -d
Then visit https://127.0.0.1:8080 and paste the document link. The document link can be obtained by sharing > Enable link sharing > Copy link .
I used my personal test API Token to deploy an Unstable version on the Render platform. This version will not save any documentation and pictures in the container, and directly returns the compressed package file from the memory through HTTP, but the Log of the Render platform may Log some HTTP information.
The current version is only for temporary use by users who don't care about privacy or are too lazy to configure it. It can also be used to test and compare whether there is a problem with their own Token permission configuration. The Render platform uses free quota and only has 512M of memory. High availability is not guaranteed. The trust chain relies entirely on open source code, so please use it at your own discretion.
Visit https://feishu2md.onrender.com/ and paste the document link. The document link can be obtained by sharing > enable link sharing > copy link .
chyroc/lark
chyroc/lark_docs_md