zlib README

项目的 README,来自 github.com/heartleo/zlib。合并为一个 markdown 文件:README.md。

zlib

A Z-Library CLI for you and your AI agents.

Go version CI Release Downloads License

heartleo%2Fzlib | Trendshift

English | 简体中文

Install · Quick start · Terminal interface · Commands · Agent setup · Docs

Book search in the terminal

Features

🔍 Search — filter by year, language, and format; sort results
📚 Browse — favorites, recommendations, popular books, and download history
📥 Download — view book details and covers, choose a download directory
📖 Send to Kindle — deliver files to your Kindle address
🌏 Send to WeRead — import books into your WeRead shelf
🕒 Profile — check your daily download quota
🎨 Themes — change the color theme
🌐 Network — check which mirrors work, trust your own mirror, or use a proxy
🤖 AI Agent Integration — integrate with Claude Code and Codex through Agent plugins

Install

macOS / Linux with Homebrew:

brew install heartleo/tap/zlib-cli

macOS / Linux with the install script (installs to /usr/local/bin, may ask for sudo):

curl -fsSL https://raw.githubusercontent.com/heartleo/zlib/main/install.sh | sh

Windows with winget:

winget install --id heartleo.zlib --exact

Or download a binary from Releases and put it on your PATH. See Installation for Go installation, source builds, and upgrades.

Quick start

You need a Z-Library account. First, find a domain reachable from your network:

zlib doctor

Log in with a domain from the results. Replace the example URL below with one from your results; enter your email and password in the prompt:

zlib login --domain https://z-lib.gd
zlib tui

Press /, choose /search, enter a title, author, or ISBN, and press Ctrl+S. You can also type /search dune and press Enter. Select a book and press Enter to confirm the download.

Downloads default to the current directory. You can choose another folder before downloading. Login is saved locally; subsequent sessions only need zlib tui.

If no domain works or login fails, see Troubleshooting. Existing browser sessions can be imported as cookies.

Terminal interface

zlib tui opens one persistent shell. Every screen lists its keys at the bottom; these cover a first session:

Key Action
/ Open the command list: search, favorites, history, profile, settings, themes
↑/↓ or j/k Select a book
←/→ Previous or next page of results
Enter Download the selected book, after a confirmation
Ctrl+F Change the query and filters of the current search
Esc Go back
/quit Exit

Settings live under /config (network, downloads, search formats, Kindle, WeRead). See Terminal interface for every screen and key.

Commands

Pass a query for table output, or add --json for scripts:

zlib search "dune" --ext epub
zlib search "dune" --ext epub --json --count 10
Task Command
Browse favorites zlib favorites
Browse recommendations zlib recommended
Browse popular books zlib most-popular
Browse download history zlib history
Check account and quota zlib profile
Send to Kindle zlib kindle send ./book.epub
Send to WeRead zlib weread import ./book.epub

To download, replace id:hash with a book's complete id from the results:

zlib download "id:hash"

Run zlib <command> --help for flags. Usage covers filters, pagination, and download options.

Agent setup

Install the plugin, or register the MCP server (zlib mcp). If zlib is missing, the plugin installs it on first use. Log in yourself with zlib login so your password stays out of chat.

Claude Code

Plugin:

/plugin marketplace add heartleo/zlib
/plugin install zlib@zlib-plugin-cc

Codex

Plugin:

codex plugin marketplace add heartleo/zlib
codex plugin add zlib@zlib

MCP server

Register zlib mcp as a local stdio server. zlib must be on PATH and signed in:

# Claude Code
claude mcp add -s user zlib -- zlib mcp

# Codex
codex mcp add zlib -- zlib mcp

Add --read-only after mcp to hide download, history deletion, Kindle delivery and WeRead import. See MCP server for other clients, flags, and tools.

Documentation

Guide Covers
Installation Install methods, source builds, zlib update
Usage Search, downloads, favorites, history
Terminal interface Commands and keyboard controls
Book covers Supported terminals, limits and cache
Configuration Domains, proxies, folders, configuration paths
Themes Available palettes and preview controls
Kindle SMTP setup and delivery
WeRead QR login and imports into WeRead
MCP server Client setup, flags, and tools for zlib mcp
Troubleshooting Login and network problems

Report bugs in Issues with your zlib version, OS, command, and error. Omit passwords, cookies, and session files. Report security vulnerabilities privately as described in SECURITY.md.

Star History

Star History Chart

zlib (heartleo/zlib)

正在搜索数据库…

2.1K ·GitHub
这是什么?zlib 是一个面向 Z-Library 的命令行工具,可以搜索书籍、下载书籍,并把书籍发送到你的 Kindle。它还提供插件,让 Claude Code 和 Codex 可以替你搜索和下载书籍。
这是图形界面应用还是命令行工具?这是一个带交互式 TUI 的终端工具:用方向键浏览搜索结果和下载历史,并且提供多种配色主题。
使用这个工具需要 Z-Library 账号吗?需要。你要用自己的 Z-Library 账号信息登录,还需要把 ZLIBDOMAIN 设置为当前可用的镜像域名,因为大多数 Z-Library 域名都有 DiamWall 反机器人验证挡在前面。
登录能直接成功吗?不一定。Z-Library 的镜像域名经常变动。据说,ZLIBDOMAIN 的值过时或错误,是“登录成功、后续命令却失败”最常见的唯一原因。`doctor` 命令可以检查当前哪些镜像域名正常。
Claude Code 插件能帮我做什么?它会添加斜杠命令,让 Claude 替你搜索和下载书籍,例如用 /zlib 'the pragmatic programmer' 搜索并下载,用 /zlib:kindle 把书发送到你的 Kindle。
Codex 插件是什么?zlib 为 Codex 提供了一个仅包含 skills 的插件:你可以让 Codex 搜索或下载书籍,也可以使用内置的 Kindle skill,把本地文件发送到你的 Kindle。
它能直接把书发送到我的 Kindle 吗?可以。send-to-kindle 功能会把文件发送到你的 Kindle 邮箱地址,并通过环境变量 ZLIBSMTPPWD 设置的 SMTP 密码进行身份验证。
镜像域名被 DiamWall 拦截时会怎样?`doctor` 命令会在不登录的情况下检查所有已知域名。状态为 'challenged' 的域名仍然可用,因为客户端会自动完成其工作量证明(proof-of-work)验证;而 diamwallblocked、httperror、redirectloop 和 networkerror 状态的域名则不可用。
作者
heartleo
大小
10.4 MB
星标
2.1K
时长
7个月
提交 · 90 天