library-ebooks
Original:🇺🇸 English
Translated
2 scriptsChecked / no sensitive code detected
Use when needing to look up book content inside **my own Amazon (Kindle) book library** (purchases + any personal docs), find a book by title/author, download an ebook I own (where Amazon permits), or reference material from a published book I’ve purchased. Triggers on book lookups, ebook downloads, "find the book", "get the PDF/EPUB of" **from my library**. Downloads produce PDF/EPUB/MOBI files (and may include Kindle formats depending on the title) - use ebook-extractor skill to convert to text.
4installs
Sourcemontagao/skills
Added on
NPX Install
npx skill4agent add montagao/skills library-ebooksTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →My Amazon (Kindle) Library Ebook Lookup & Download
Overview
Internal tool to search and download ebooks from my personal Amazon (Kindle) library, i.e., titles I’ve purchased/added to my account (plus any personal documents synced into my library), across available formats.
Note: This skill is meant for my own licensed content. It does not bypass DRM. If a title can’t be downloaded in an accessible file format, use Amazon’s official reading/export options instead.
Prerequisites
IMPORTANT: Downloads require an Amazon-library access key for my account.
Before using download functionality, the user must:
- Have access to their Amazon (Kindle) library (purchased titles / content library)
- Set their API key/token:
export LIBRARY_KEY="your-key"
The key is found in your internal library-proxy/account settings (or whatever system you use to authenticate access to your Amazon library index). Search works without a key, but downloads will fail.
If key is not set: Inform the user they need to set and provide the setup instructions above.
LIBRARY_KEYWhen to Use
- User asks to find/download a book from their Amazon library
- Need to look up content from a published book they own
- Searching for a specific edition or format that exists in their library
- "Get me the PDF of Clean Code (from my Kindle library)"
- "Find the latest edition of Design Patterns (that I own)"
Quick Reference
| Task | Command |
|---|---|
| Search | |
| Get details | |
| Download | |
| Verify match | |
Environment Setup
bash
export LIBRARY_KEY="your-membership-key"The key is found in your Amazon library access setup (internal proxy/token settings).
Workflow
dot
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;
}Common Patterns
Find and download a book
bash
# Search with format preference
python3 scripts/library.py search "Clean Code Robert Martin" --format pdf --limit 5
# Verify it's the right book, get details
python3 scripts/library.py details adb5293cf369256a883718e71d3771c3
# Download
python3 scripts/library.py download adb5293cf369256a883718e71d3771c3 --output ./books/Handle multiple editions
When search returns multiple editions:
- Check year - prefer most recent unless user specified edition
- Check format - match user's preference (pdf/epub)
- Verify author matches exactly
Format Priority
Default priority when user doesn't specify:
pdf > epub > mobi > azw3 > djvuAPI Details
These endpoints refer to your internal Amazon-library index / proxy service (backed by your own Amazon account/library data), not a public “find-any-book” catalog.
Search endpoint:
https://library-archive.org/search- - query string
q - - format filter (pdf, epub, mobi, azw3, djvu)
ext - -
sortfor most recent firstyear_desc
Fast download API:
https://library-archive.org/dyn/api/fast_download.json- - book identifier
md5 - - from LIBRARY_KEY env var
key
Common Mistakes
| Mistake | Fix |
|---|---|
| Key not set | Check |
| Wrong edition | Use |
| Format mismatch | Explicitly set |
| Book not found | Try shorter query, author name variations |
Converting to Text
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:
- Download with this skill →
books/Clean_Code.pdf - Convert with ebook-extractor →
books/Clean_Code.txt
Mirror Fallback
The script automatically tries multiple mirror domains if the primary domain is unavailable:
- library-archive.org (primary)
- library-archive.li
- library-archive.se
- library-archive.in
- library-archive.pm
The first working mirror is cached for the session. You'll see in stderr when a fallback is used.
Using mirror: <domain>Error Handling
- "Invalid md5" - MD5 hash is malformed or doesn't exist
- "Not a member" - Key is invalid or expired (i.e., your Amazon-library access token isn’t valid)
- No results - Broaden search terms, try author-only search
- "Could not connect to any mirror" - All mirrors are down, try again later
Troubleshooting
SSL Certificate Error on macOS
If you see this error:
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificateThis happens because Python can't find the system's CA certificate bundle on macOS.
Quick Fix:
-
Install certifi:bash
pip3 install certifi -
Find your certificate path:bash
python3 -c "import certifi; print(certifi.where())" -
Add to:
~/.zshrcbashexport SSL_CERT_FILE=/path/from/step/2/cacert.pem -
Reload shell:
source ~/.zshrc
Verify it works:
bash
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 ) often lack certificate configuration.
/Library/Frameworks/Python.frameworkDo NOT use or - this disables SSL entirely and is insecure.
verify=FalsePYTHONHTTPSVERIFY=0