zlib-download

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Book Tools

书籍工具

Search and download books from multiple sources through a unified CLI.
通过统一的CLI从多个来源搜索和下载书籍。

Backends

后端源

BackendSourceAuth RequiredBest For
zlibZ-Library (EAPI)Email + PasswordLargest catalog, direct download
annasAnna's ArchiveAPI Key (donation)Aggregated sources, multiple mirrors
后端源来源是否需要认证最佳适用场景
zlibZ-Library (EAPI)邮箱 + 密码最大的目录库,支持直接下载
annasAnna's ArchiveAPI密钥(需捐赠获取)聚合来源,多镜像站点

First-Time Setup

首次设置

On first invocation, run the setup check and guide the user through configuration interactively.
首次调用时,运行设置检查并引导用户交互式完成配置。

Step 1: Check Dependencies

步骤1:检查依赖

bash
bash ${SKILL_PATH}/scripts/setup.sh check
Output is key=value pairs. Check each:
KeyOKMissing Action
PYTHON
ok
Python 3 not found — user must install it
REQUESTS
ok
Run
bash ${SKILL_PATH}/scripts/setup.sh install-deps
ANNAS_BINARY
ok
Run
bash ${SKILL_PATH}/scripts/setup.sh install-annas
(optional)
bash
bash ${SKILL_PATH}/scripts/setup.sh check
输出为键值对形式。检查以下各项:
正常状态缺失时的操作
PYTHON
ok
未找到Python 3 — 用户需要安装它
REQUESTS
ok
运行
bash ${SKILL_PATH}/scripts/setup.sh install-deps
ANNAS_BINARY
ok
运行
bash ${SKILL_PATH}/scripts/setup.sh install-annas
(可选)

Step 2: Configure Credentials

步骤2:配置凭据

Credentials are stored in
~/.claude/book-tools/.env
. Create the file from the skill's bundled template:
bash
mkdir -p ~/.claude/book-tools
cp ${SKILL_PATH}/scripts/.env.example ~/.claude/book-tools/.env
The
.env
file looks like this:
undefined
凭据存储在
~/.claude/book-tools/.env
中。从技能附带的模板创建该文件:
bash
mkdir -p ~/.claude/book-tools
cp ${SKILL_PATH}/scripts/.env.example ~/.claude/book-tools/.env
.env
文件内容如下:
undefined

Z-Library credentials

Z-Library凭据

ZLIB_EMAIL=your_email@example.com ZLIB_PASSWORD=your_password_here
ZLIB_EMAIL=your_email@example.com ZLIB_PASSWORD=your_password_here

Anna's Archive (optional, requires donation for API key)

Anna's Archive(可选,需捐赠获取API密钥)

ANNAS_SECRET_KEY=your_api_key_here

ANNAS_SECRET_KEY=your_api_key_here


**IMPORTANT**: Do NOT ask the user for credentials directly in chat. Instead:
1. Create the `.env` file (or `.env.example` template)
2. Tell the user to edit `~/.claude/book-tools/.env` with their credentials
3. Wait for the user to confirm they've filled it in
4. Then proceed with search

Alternatively, credentials can be set via CLI (less recommended — visible in shell history):

```bash
python3 ${SKILL_PATH}/scripts/book.py config set --zlib-email "user@mail.com" --zlib-password "password"

**重要提示**:不要在聊天中直接向用户索要凭据。正确步骤:
1. 创建 `.env` 文件(或 `.env.example` 模板)
2. 告知用户编辑 `~/.claude/book-tools/.env` 填入他们的凭据
3. 等待用户确认已填写完毕
4. 然后继续搜索操作

或者,也可以通过CLI设置凭据(不推荐 — 会在Shell历史中可见):

```bash
python3 ${SKILL_PATH}/scripts/book.py config set --zlib-email "user@mail.com" --zlib-password "password"

Step 3: Verify

步骤3:验证

bash
python3 ${SKILL_PATH}/scripts/book.py setup
Expected output when Z-Library is configured:
json
{
  "zlib": { "requests_installed": true, "configured": true },
  "annas": { "binary_found": true, "api_key_configured": false }
}
If
configured
is
true
, the skill is ready to use.
bash
python3 ${SKILL_PATH}/scripts/book.py setup
当Z-Library配置完成后,预期输出:
json
{
  "zlib": { "requests_installed": true, "configured": true },
  "annas": { "binary_found": true, "api_key_configured": false }
}
如果
configured
true
,则技能已准备就绪。

Credential Storage Details

凭据存储详情

Two sources are merged (
.env
values take priority):
SourcePathFormat
.env
file
~/.claude/book-tools/.env
KEY=value
per line
Config JSON
~/.claude/book-tools/config.json
JSON (auto-managed)
On first successful Z-Library login, remix tokens are cached in
config.json
— subsequent calls skip the email/password login and use tokens directly.
会合并两个来源的配置(
.env
中的值优先级更高):
来源路径格式
.env
文件
~/.claude/book-tools/.env
每行
KEY=value
配置JSON
~/.claude/book-tools/config.json
JSON(自动管理)
首次成功登录Z-Library后,remix令牌会缓存到
config.json
中 — 后续调用会跳过邮箱/密码登录,直接使用令牌。

Workflow

工作流程

The typical flow is: search → pick → download.
典型流程为:搜索 → 选择 → 下载

1. Search

1. 搜索

bash
undefined
bash
undefined

Auto-detect backend (tries zlib first, then annas)

自动检测后端源(先尝试zlib,再尝试annas)

python3 ${SKILL_PATH}/scripts/book.py search "machine learning" --limit 10
python3 ${SKILL_PATH}/scripts/book.py search "machine learning" --limit 10

Z-Library with filters

带筛选条件的Z-Library搜索

python3 ${SKILL_PATH}/scripts/book.py search "deep learning" --source zlib --lang english --ext pdf --limit 5
python3 ${SKILL_PATH}/scripts/book.py search "deep learning" --source zlib --lang english --ext pdf --limit 5

Anna's Archive

Anna's Archive搜索

python3 ${SKILL_PATH}/scripts/book.py search "reinforcement learning" --source annas
python3 ${SKILL_PATH}/scripts/book.py search "reinforcement learning" --source annas

Chinese books

中文书籍搜索

python3 ${SKILL_PATH}/scripts/book.py search "莱姆 索拉里斯" --source zlib --lang chinese --limit 5

**Output** (JSON to stdout):
```json
{
  "source": "zlib",
  "count": 5,
  "books": [
    {
      "source": "zlib",
      "id": "12345",
      "hash": "abc123def",
      "title": "Deep Learning",
      "author": "Ian Goodfellow",
      "year": "2016",
      "language": "english",
      "extension": "pdf",
      "filesize": "22.5 MB"
    }
  ]
}
python3 ${SKILL_PATH}/scripts/book.py search "莱姆 索拉里斯" --source zlib --lang chinese --limit 5

**输出**(标准输出为JSON格式):
```json
{
  "source": "zlib",
  "count": 5,
  "books": [
    {
      "source": "zlib",
      "id": "12345",
      "hash": "abc123def",
      "title": "Deep Learning",
      "author": "Ian Goodfellow",
      "year": "2016",
      "language": "english",
      "extension": "pdf",
      "filesize": "22.5 MB"
    }
  ]
}

2. Present Results to User

2. 向用户展示结果

After searching, present results as a numbered table so the user can pick:
| # | Title | Author | Year | Format | Size |
|---|-------|--------|------|--------|------|
| 1 | Deep Learning | Ian Goodfellow | 2016 | pdf | 22.5 MB |
| 2 | ... | ... | ... | ... | ... |
If results span multiple languages or editions, group them by language or category with sub-headings for clarity.
Ask: "Which book would you like to download? (number)"
搜索完成后,将结果以编号表格形式展示,方便用户选择:
| 序号 | 书名 | 作者 | 年份 | 格式 | 大小 |
|---|-------|--------|------|--------|------|
| 1 | Deep Learning | Ian Goodfellow | 2016 | pdf | 22.5 MB |
| 2 | ... | ... | ... | ... | ... |
如果结果包含多种语言或版本,按语言或类别分组,并添加子标题以确保清晰。
询问用户:“你想要下载哪本书?(请输入序号)”

3. Download

3. 下载

bash
undefined
bash
undefined

Z-Library download (needs id + hash from search results)

Z-Library下载(需要搜索结果中的id和hash)

python3 ${SKILL_PATH}/scripts/book.py download --source zlib --id 12345 --hash abc123def -o ~/Downloads/
python3 ${SKILL_PATH}/scripts/book.py download --source zlib --id 12345 --hash abc123def -o ~/Downloads/

Anna's Archive download (needs MD5 hash from search results)

Anna's Archive下载(需要搜索结果中的MD5哈希值)

python3 ${SKILL_PATH}/scripts/book.py download --source annas --hash a1b2c3d4e5 --filename "deep_learning.pdf" -o ~/Downloads/

**Output**:
```json
{
  "source": "zlib",
  "status": "ok",
  "path": "/Users/user/Downloads/Deep Learning (Ian Goodfellow).pdf",
  "size": 23592960
}
python3 ${SKILL_PATH}/scripts/book.py download --source annas --hash a1b2c3d4e5 --filename "deep_learning.pdf" -o ~/Downloads/

**输出**:
```json
{
  "source": "zlib",
  "status": "ok",
  "path": "/Users/user/Downloads/Deep Learning (Ian Goodfellow).pdf",
  "size": 23592960
}

4. Report to User

4. 向用户反馈结果

After download, report:
  • File path (so user can open it)
  • File size
  • Any remaining download quota (Z-Library has daily limits)
下载完成后,反馈以下信息:
  • 文件路径(方便用户打开)
  • 文件大小
  • 剩余下载配额(Z-Library有每日限制)

Other Commands

其他命令

Book Info (Z-Library only)

书籍信息(仅Z-Library支持)

bash
python3 ${SKILL_PATH}/scripts/book.py info --source zlib --id 12345 --hash abc123def
Returns full metadata: description, ISBN, pages, table of contents, etc.
bash
python3 ${SKILL_PATH}/scripts/book.py info --source zlib --id 12345 --hash abc123def
返回完整元数据:描述、ISBN、页数、目录等。

Check Config

查看配置

bash
python3 ${SKILL_PATH}/scripts/book.py config show
bash
python3 ${SKILL_PATH}/scripts/book.py config show

Check Backend Status

检查后端源状态

bash
python3 ${SKILL_PATH}/scripts/book.py setup
bash
python3 ${SKILL_PATH}/scripts/book.py setup

Error Handling

错误处理

ErrorCauseAction
"Z-Library not configured"No credentialsGuide user to edit
~/.claude/book-tools/.env
"Z-Library login failed"Bad credentials or service downAsk user to verify credentials. Z-Library domains change — if persistent, the vendored
Zlibrary.py
domain may need updating.
"annas-mcp binary not found"Binary not installedRun
setup.sh install-annas
"Anna's Archive API key not configured"No API keyGuide user to donate at Anna's Archive for API access, then add key to
.env
Search timeoutNetwork issueRetry once. If persistent, try the other backend.
"No backend available"Neither backend configuredWalk through full setup flow from Step 1
错误信息原因处理操作
"Z-Library not configured"无凭据引导用户编辑
~/.claude/book-tools/.env
"Z-Library login failed"凭据错误或服务不可用请用户验证凭据。Z-Library域名会变化 — 如果问题持续,可能需要更新内置的
Zlibrary.py
中的域名。
"annas-mcp binary not found"未安装二进制文件运行
setup.sh install-annas
"Anna's Archive API key not configured"无API密钥引导用户前往Anna's Archive捐赠获取API访问权限,然后将密钥添加到
.env
搜索超时网络问题重试一次。如果问题持续,尝试切换到另一个后端源。
"No backend available"两个后端源均未配置引导用户从步骤1开始完成完整的设置流程

Tips

小贴士

  • Z-Library has a daily download limit (usually 10/day for free accounts). Use
    info
    to check a book before downloading to avoid wasting quota.
  • Anna's Archive requires an API key for both search and download (obtained via donation).
  • For Chinese books, use
    --lang chinese
    with Z-Library for best results.
  • If Z-Library is unreachable, automatically fall back to Anna's Archive with
    --source auto
    .
  • When searching for a specific author in multiple languages, run parallel searches (e.g. English name + Chinese name) and merge results into one table.
  • Z-Library有每日下载限制(免费账户通常为10本/天)。下载前使用
    info
    命令查看书籍信息,避免浪费配额。
  • Anna's Archive的搜索和下载都需要API密钥(需捐赠获取)。
  • 对于中文书籍,在Z-Library中使用
    --lang chinese
    参数可获得最佳结果。
  • 如果Z-Library无法访问,使用
    --source auto
    参数会自动回退到Anna's Archive。
  • 当搜索多语言的特定作者时,可并行搜索(例如英文名 + 中文名),并将结果合并到一个表格中。