annas-archive-ebooks by ratacat/claude-skills
npx skills add https://github.com/ratacat/claude-skills --skill annas-archive-ebooks从 Anna's Archive 搜索并下载电子书,该网站索引了数百万本不同格式(PDF、EPUB、MOBI 等)的书籍。
重要提示:下载功能需要 Anna's Archive 会员密钥。
在使用下载功能之前,用户必须:
export ANNAS_ARCHIVE_KEY="your-key"密钥在成为会员后,可在账户设置中找到。搜索功能无需密钥,但下载会失败。
如果未设置密钥: 告知用户需要设置 ANNAS_ARCHIVE_KEY 并提供上述设置说明。
| 任务 | 命令 |
|---|---|
| 搜索 | python3 annas.py search "query" --format pdf |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 获取详情 | python3 annas.py details <md5> |
| 下载 | python3 annas.py download <md5> --output /path/ |
| 验证匹配 | python3 annas.py search "title author" --verify "expected title" |
export ANNAS_ARCHIVE_KEY="your-membership-key"
密钥可在您的 Anna's Archive 账户设置中找到。
digraph download_flow {
rankdir=TB;
node [shape=box];
search [label="Search by title/author"];
verify [label="Verify correct book\n(check title, author, year)"];
multiple [label="Multiple editions?" shape=diamond];
prefer_recent [label="Prefer most recent\nunless specific edition requested"];
format_ok [label="Preferred format available?" shape=diamond];
download [label="Download via fast API"];
convert [label="Use ebook-extractor\nto convert to text"];
search -> verify;
verify -> multiple;
multiple -> prefer_recent [label="yes"];
multiple -> format_ok [label="no"];
prefer_recent -> format_ok;
format_ok -> download [label="yes"];
format_ok -> search [label="no - try different format"];
download -> convert;
}
# 按格式偏好搜索
python3 annas.py search "Clean Code Robert Martin" --format pdf --limit 5
# 验证是否为正确的书籍,获取详情
python3 annas.py details adb5293cf369256a883718e71d3771c3
# 下载
python3 annas.py download adb5293cf369256a883718e71d3771c3 --output ./books/
当搜索返回多个版本时:
用户未指定时的默认优先级:pdf > epub > mobi > azw3 > djvu
搜索端点: https://annas-archive.org/search
q - 查询字符串ext - 格式过滤器(pdf、epub、mobi、azw3、djvu)sort - year_desc 表示最新优先快速下载 API: https://annas-archive.org/dyn/api/fast_download.json
md5 - 书籍标识符key - 来自 ANNAS_ARCHIVE_KEY 环境变量| 错误 | 修复方法 |
|---|---|
| 未设置密钥 | 检查 echo $ANNAS_ARCHIVE_KEY |
| 版本错误 | 使用 --verify 标志并指定预期标题 |
| 格式不匹配 | 明确设置 --format |
| 未找到书籍 | 尝试更短的查询、作者名的变体 |
下载的文件是其原始格式(PDF、EPUB、MOBI 等)。要转换为纯文本以便分析或处理,请在下载后使用 ebook-extractor 技能。
典型工作流程:
books/Clean_Code.pdfbooks/Clean_Code.txt如果主域名不可用,脚本会自动尝试多个镜像域名:
第一个可用的镜像会被缓存用于当前会话。当使用回退镜像时,您会在 stderr 中看到 Using mirror: <domain>。
如果看到此错误:
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate
这是因为 Python 在 macOS 上找不到系统的 CA 证书包。
快速修复:
安装 certifi:
pip3 install certifi
找到您的证书路径:
python3 -c "import certifi; print(certifi.where())"
添加到 ~/.zshrc:
export SSL_CERT_FILE=/path/from/step/2/cacert.pem
重新加载 shell:source ~/.zshrc
验证是否生效:
python3 -c "import urllib.request; urllib.request.urlopen('https://google.com')"
原因: macOS 使用 Keychain 管理证书,但 Python 默认不使用它。框架安装(如 /Library/Frameworks/Python.framework)通常缺少证书配置。
请勿使用 verify=False 或 PYTHONHTTPSVERIFY=0 - 这会完全禁用 SSL,并不安全。
每周安装数
99
仓库
GitHub 星标数
25
首次出现
Jan 24, 2026
安全审计
安装于
opencode91
codex88
gemini-cli88
cursor85
github-copilot82
amp80
Search and download ebooks from Anna's Archive, which indexes millions of books across formats (PDF, EPUB, MOBI, etc.).
IMPORTANT: Downloads require an Anna's Archive membership key.
Before using download functionality, the user must:
export ANNAS_ARCHIVE_KEY="your-key"The key is found in Account Settings after becoming a member. Search works without a key, but downloads will fail.
If key is not set: Inform the user they need to set ANNAS_ARCHIVE_KEY and provide the setup instructions above.
| Task | Command |
|---|---|
| Search | python3 annas.py search "query" --format pdf |
| Get details | python3 annas.py details <md5> |
| Download | python3 annas.py download <md5> --output /path/ |
| Verify match | python3 annas.py search "title author" --verify "expected title" |
export ANNAS_ARCHIVE_KEY="your-membership-key"
The key is found in your Anna's Archive account settings.
digraph download_flow {
rankdir=TB;
node [shape=box];
search [label="Search by title/author"];
verify [label="Verify correct book\n(check title, author, year)"];
multiple [label="Multiple editions?" shape=diamond];
prefer_recent [label="Prefer most recent\nunless specific edition requested"];
format_ok [label="Preferred format available?" shape=diamond];
download [label="Download via fast API"];
convert [label="Use ebook-extractor\nto convert to text"];
search -> verify;
verify -> multiple;
multiple -> prefer_recent [label="yes"];
multiple -> format_ok [label="no"];
prefer_recent -> format_ok;
format_ok -> download [label="yes"];
format_ok -> search [label="no - try different format"];
download -> convert;
}
# Search with format preference
python3 annas.py search "Clean Code Robert Martin" --format pdf --limit 5
# Verify it's the right book, get details
python3 annas.py details adb5293cf369256a883718e71d3771c3
# Download
python3 annas.py download adb5293cf369256a883718e71d3771c3 --output ./books/
When search returns multiple editions:
Default priority when user doesn't specify: pdf > epub > mobi > azw3 > djvu
Search endpoint: https://annas-archive.org/search
q - query stringext - format filter (pdf, epub, mobi, azw3, djvu)sort - year_desc for most recent firstFast download API: https://annas-archive.org/dyn/api/fast_download.json
md5 - book identifierkey - from ANNAS_ARCHIVE_KEY env var| Mistake | Fix |
|---|---|
| Key not set | Check echo $ANNAS_ARCHIVE_KEY |
| Wrong edition | Use --verify flag with expected title |
| Format mismatch | Explicitly set --format |
| Book not found | Try shorter query, author name variations |
Downloaded files are in their original format (PDF, EPUB, MOBI, etc.). To convert to plain text for analysis or processing, use the ebook-extractor skill after downloading.
Typical workflow:
books/Clean_Code.pdfbooks/Clean_Code.txtThe script automatically tries multiple mirror domains if the primary domain is unavailable:
The first working mirror is cached for the session. You'll see Using mirror: <domain> in stderr when a fallback is used.
If you see this error:
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate
This happens because Python can't find the system's CA certificate bundle on macOS.
Quick Fix:
Install certifi:
pip3 install certifi
Find your certificate path:
python3 -c "import certifi; print(certifi.where())"
Add to ~/.zshrc:
export SSL_CERT_FILE=/path/from/step/2/cacert.pem
Reload shell: source ~/.zshrc
Verify it works:
python3 -c "import urllib.request; urllib.request.urlopen('https://google.com')"
Why this happens: macOS uses Keychain for certificates, but Python doesn't use it by default. Framework installs (like /Library/Frameworks/Python.framework) often lack certificate configuration.
Do NOT use verify=False or PYTHONHTTPSVERIFY=0 - this disables SSL entirely and is insecure.
Weekly Installs
99
Repository
GitHub Stars
25
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykWarn
Installed on
opencode91
codex88
gemini-cli88
cursor85
github-copilot82
amp80
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
46,600 周安装
二进制初步分析指南:使用ReVa工具快速识别恶意软件与逆向工程
69 周安装
PrivateInvestigator 道德人员查找工具 | 公开数据调查、反向搜索与背景研究
69 周安装
TorchTitan:PyTorch原生分布式大语言模型预训练平台,支持4D并行与H100 GPU加速
69 周安装
screenshot 截图技能:跨平台桌面截图工具,支持macOS/Linux权限管理与多模式捕获
69 周安装
tmux进程管理最佳实践:交互式Shell初始化、会话命名与生命周期管理
69 周安装
Git Rebase Sync:安全同步分支的Git变基工具,解决冲突与备份
69 周安装