anna-dl Documentation
anna-dl is an ultra-resilient, autonomous command-line tool and AI agent engine designed to discover, resolve, and stream academic literature and non-fiction books from Anna's Archive and Library Genesis (LibGen) with 100% free access and zero paid API keys.
Key Highlights
🔓 Zero Paid Keys
Operates freely over public mirrors without requiring donation tokens or membership accounts.
⚡ Pure Python Core
Ultra-lightweight (<150 KB). Starts instantly in milliseconds with requests and regex.
🛡️ DDoS-Guard Solver
Automatic headless Chromium fallback resolving &check=1 JavaScript challenges seamlessly.
🔄 10-MD5 Recovery Loop
Sequentially probes up to 10 candidate hashes until an active direct download stream succeeds.
Installation
# Clone repository
git clone https://github.com/nsozturk/anna-dl.git
cd anna-dl
# Install dependencies
pip install -r requirements.txt
# Install CLI globally
pip install -e .
Quick Start
Download any book directly to your current working directory without needing a queue:
# Download by Title and Author
anna-dl get --title "Atomic Habits" --author "James Clear"
# Download with custom query
anna-dl get --title "Thinking, Fast and Slow" --query "Kahneman Thinking Fast"
# Bypass regional DNS blocks
anna-dl get --title "Deep Work" --author "Cal Newport" --bypass-dns
CLI Command Reference
| Command | Flag / Argument | Description |
|---|---|---|
get |
--title, --author |
Searches and downloads a single book on the fly. |
download |
--parallel, --workers 4 |
Processes entire books_queue.json in batches. |
retry |
--bypass-dns |
Re-attempts only pending or failed items from the log. |
extract |
--docs-dir <path> |
Extracts book lists from markdown tables into a queue JSON. |
sync |
--output-dir <path> |
Reconciles files on disk with download_log.json. |
status |
None | Prints overall download statistics and completion ratios. |
AI Agent Integration
anna-dl was built specifically for autonomous AI agents like Claude Code, Cursor, Antigravity, and Gemini CLI.
Copy the following snippet into your global rules file (~/.claude/agents/anna-dl.md or ~/.config/agent-rules/anna-dl.md):
## Book & Literature Retrieval Tool (`anna-dl`)
When asked to find, retrieve, download, or read academic books or textbooks:
1. Run: `anna-dl get --title "<Title>" --author "<Author>"`
2. If connection times out or host is blocked, append `--bypass-dns`.
3. Output files are verified and saved into `./downloads/`.
DDoS-Guard JS Challenge Evasion
In mid-2026, official Anna's Archive endpoints deployed aggressive DDoS-Guard challenges resulting in HTTP 403 Forbidden for plain HTTP scrapers. anna-dl handles this via a dual-path architecture:
- Fast Path: Queries
libgen.lidirectly over HTTP for instant response. - Stealth Browser Path: If Anna's Archive returns 403,
anna-dltriggers headless Chromium with--disable-blink-features=AutomationControlledand deletesnavigator.webdriver, waiting for the&check=1redirect to finish.
License & Ethics
Distributed under the MIT License. anna-dl is intended for researchers, archivists, and educators accessing public-domain and open-access literature.