Clawdible
Manage Audible via the audible Python library (unofficial API). Works across platforms — macOS, Linux, Windows.
Dependencies
Both scripts auto-install dependencies on first run via pip:
- -
audible — unofficial Audible API client - INLINECODE2 — HTTP client
No manual pip install needed.
Locating the scripts
Resolve the skill directory at runtime:
CODEBLOCK0
Or use the path OpenClaw provides when loading this skill (available as the skill's directory).
Setup (one-time)
Auth stored at ~/.config/audible/auth.json (chmod 600).
Step 1 — generate login URL:
python3 audible_auth.py --locale us
Send URL to user. They open it on any device and sign into Amazon.
Step 2 — after login, Amazon redirects to https://www.amazon.com/ap/maplanding.... User pastes that URL:
CODEBLOCK2
Verify:
CODEBLOCK3
Locale options: us, au, uk, de, ca, fr, in, it, jp, es
Auth file's locale_code is auto-detected; override with --locale if needed.
Commands
All commands accept --locale LOCALE and --json.
CODEBLOCK4
Workflow
Typical search-and-buy:
- 1.
search — find title, note the ASIN - INLINECODE20 — confirm correct edition/narrator
- Confirm purchase with user verbally
- INLINECODE21 — execute purchase
Never run buy without explicit user confirmation.
Marketplace
- - Auto-detects locale from auth file
- Override with
--locale when needed (e.g. user's account is US but located in AU) - Fallback purchase URL on API failure:
https://www.audible.com/pd/<asin> (adjust domain per locale)
Error Handling
| Error | Cause | Fix |
|---|
| No auth file | Not set up | Run INLINECODE25 |
| 401/403 |
Token expired | Re-run
audible_auth.py |
| 404 | Wrong ASIN or locale | Try different
--locale |
| 429 | Rate limited | Wait and retry |
| Buy fails | API blocked | Send manual URL to user |
| InvalidValue on auth | Code expired | Start auth flow again |
Notes
- -
audible library is unofficial — Amazon may change their API without notice - Auth tokens auto-refresh via device private key; re-auth only needed if device is deregistered
- Auth file is chmod 600 (owner-only read/write)
Clawdible
通过 audible Python 库(非官方 API)管理 Audible。支持跨平台运行——macOS、Linux、Windows。
依赖项
两个脚本在首次运行时通过 pip 自动安装依赖:
- - audible — 非官方 Audible API 客户端
- httpx — HTTP 客户端
无需手动执行 pip 安装。
定位脚本
在运行时解析技能目录:
bash
SKILL_DIR=$(python3 -c
import subprocess, json
skills = subprocess.check_output([openclaw, skills, --json], text=True)
for s in json.loads(skills):
if s[name] == clawdible:
print(s[path]); break
2>/dev/null || find ~/.openclaw -name audible_cli.py -path /clawdible/ 2>/dev/null | head -1 | xargs dirname)
SCRIPT=python3 $SKILLDIR/audiblecli.py
AUTH=python3 $SKILLDIR/audibleauth.py
或者使用 OpenClaw 加载此技能时提供的路径(可作为技能目录使用)。
设置(一次性)
认证信息存储在 ~/.config/audible/auth.json(权限为 600)。
步骤 1 — 生成登录 URL:
bash
python3 audible_auth.py --locale us
将 URL 发送给用户。用户可在任何设备上打开该 URL 并登录亚马逊。
步骤 2 — 登录后,亚马逊重定向至 https://www.amazon.com/ap/maplanding...。用户粘贴该 URL:
bash
python3 audible_auth.py --callback <重定向 URL>
验证:
bash
python3 audible_cli.py status
地区选项: us、au、uk、de、ca、fr、in、it、jp、es
认证文件中的 locale_code 会自动检测;如有需要可使用 --locale 覆盖。
命令
所有命令均接受 --locale LOCALE 和 --json 参数。
bash
认证状态
python3 audible_cli.py status
python3 audible_cli.py status --locale us
搜索目录
python3 audible_cli.py search 火星救援
python3 audible_cli.py search 安迪·威尔 --limit 5 --locale us
查看库
python3 audible_cli.py library
python3 audible_cli.py library --limit 50
获取书籍详情
python3 audible_cli.py info B08G9PRS1K
购买(需要显式 --confirm — 务必先与用户确认)
python3 audible_cli.py buy B08G9PRS1K --confirm
心愿单
python3 audible_cli.py wishlist
python3 audible_cli.py wishlist add B08G9PRS1K
工作流程
典型的搜索与购买流程:
- 1. search — 搜索标题,记录 ASIN
- info — 确认正确的版本/朗读者
- 与用户口头确认购买
- buy --confirm — 执行购买
未经用户明确确认,切勿运行 buy 命令。
市场
- - 从认证文件自动检测地区
- 需要时使用 --locale 覆盖(例如用户账户为美区但位于澳大利亚)
- API 失败时的备用购买 URL:https://www.audible.com/pd/(根据地区调整域名)
错误处理
| 错误 | 原因 | 解决方法 |
|---|
| 无认证文件 | 未设置 | 运行 audibleauth.py |
| 401/403 |
令牌过期 | 重新运行 audibleauth.py |
| 404 | ASIN 或地区错误 | 尝试不同的 --locale |
| 429 | 请求频率限制 | 等待后重试 |
| 购买失败 | API 被屏蔽 | 向用户发送手动 URL |
| 认证时 InvalidValue | 验证码过期 | 重新开始认证流程 |
注意事项
- - audible 库为非官方库——亚马逊可能随时更改其 API
- 认证令牌通过设备私钥自动刷新;仅当设备被注销时才需重新认证
- 认证文件权限为 600(仅所有者可读写)