annas-downloader 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +200 -0
- package/assets/NWC/350/231/232/346/213/237/345/233/276/344/271/246/351/246/206.xlsx +0 -0
- package/assets/skills/anna-downloader/SKILL.md +236 -0
- package/assets/skills/anna-downloader/evals/evals.json +23 -0
- package/assets//345/223/262/345/255/246/344/270/216/347/224/237/345/221/275/346/204/217/344/271/211-/346/235/245/350/207/252/345/233/276/347/211/207.xlsx +0 -0
- package/assets//345/267/262/346/234/211/344/275/206/346/234/252/346/211/276/345/210/260-/345/220/253/346/234/211/345/206/222/345/217/267.xlsx +0 -0
- package/bin/annas-download.js +2 -0
- package/dist/commands/batch.d.ts +9 -0
- package/dist/commands/batch.js +254 -0
- package/dist/commands/cli.d.ts +10 -0
- package/dist/commands/cli.js +474 -0
- package/dist/commands/config-command.d.ts +5 -0
- package/dist/commands/config-command.js +83 -0
- package/dist/commands/convert.d.ts +6 -0
- package/dist/commands/convert.js +47 -0
- package/dist/commands/download.d.ts +13 -0
- package/dist/commands/download.js +243 -0
- package/dist/commands/install.d.ts +1 -0
- package/dist/commands/install.js +69 -0
- package/dist/commands/preview.d.ts +6 -0
- package/dist/commands/preview.js +47 -0
- package/dist/commands/search.d.ts +14 -0
- package/dist/commands/search.js +86 -0
- package/dist/src/config.d.ts +16 -0
- package/dist/src/config.js +127 -0
- package/dist/src/converter.d.ts +7 -0
- package/dist/src/converter.js +20 -0
- package/dist/src/downloader.d.ts +15 -0
- package/dist/src/downloader.js +234 -0
- package/dist/src/excel-reader.d.ts +31 -0
- package/dist/src/excel-reader.js +156 -0
- package/dist/src/http-client.d.ts +21 -0
- package/dist/src/http-client.js +178 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.js +7 -0
- package/dist/src/logger.d.ts +7 -0
- package/dist/src/logger.js +67 -0
- package/dist/src/previewer.d.ts +16 -0
- package/dist/src/previewer.js +72 -0
- package/dist/src/searcher.d.ts +42 -0
- package/dist/src/searcher.js +592 -0
- package/dist/src/types.d.ts +97 -0
- package/dist/src/types.js +1 -0
- package/dist/src/utils.d.ts +17 -0
- package/dist/src/utils.js +41 -0
- package/package.json +60 -0
package/README.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Anna's Archive Book Downloader
|
|
2
|
+
|
|
3
|
+
CLI tool to search and download books from Anna's Archive mirror sites.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🔍 **Search** — Search books without downloading
|
|
8
|
+
- 📥 **Download** — Interactive selection or MD5-based download
|
|
9
|
+
- 📊 **Batch** — Batch download from Excel files with JSON output
|
|
10
|
+
- 🔄 **Smart Matching** — Auto-select best match, with LLM-assisted fallback
|
|
11
|
+
- 🛡️ **Error Handling** — CAPTCHA detection, rate limiting, timeout retry
|
|
12
|
+
|
|
13
|
+
## Requirements
|
|
14
|
+
|
|
15
|
+
- Node.js 18+
|
|
16
|
+
- Anna's Archive API key
|
|
17
|
+
- `cookies.json` file (for downloads)
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install -g @zheyao/annas-book-downloader
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Install the Claude Code skill (optional but recommended):**
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
annas-download install
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This installs the `anna-downloader` skill to `~/.claude/skills/`, enabling Claude Code to help with book searches and downloads.
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
### 1. Initialize config
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
annas-download config init
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Edit `~/.annasbook/config.json` with your API key and mirror URL.
|
|
42
|
+
|
|
43
|
+
### 2. Search for a book
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
annas-download search --title "The Great Gatsby"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 3. Download a book
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
annas-download download --md5 <md5-hash>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Usage
|
|
56
|
+
|
|
57
|
+
### Search
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
annas-download search --title "Book Title" --author "Author"
|
|
61
|
+
annas-download search --title "Dune" --format pdf
|
|
62
|
+
annas-download search --title "1984" --format epub --lang en
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Options:**
|
|
66
|
+
| Option | Description |
|
|
67
|
+
|--------|-------------|
|
|
68
|
+
| `--title <string>` | Book title keywords (required) |
|
|
69
|
+
| `--author <string>` | Author name |
|
|
70
|
+
| `--format <pdf\|epub>` | Filter by format |
|
|
71
|
+
| `--lang <en\|zh>` | Language preference (default: en) |
|
|
72
|
+
| `--limit <number>` | Max results (default: 5) |
|
|
73
|
+
| `--json` | JSON output |
|
|
74
|
+
|
|
75
|
+
### Download
|
|
76
|
+
|
|
77
|
+
**Interactive (search first):**
|
|
78
|
+
```bash
|
|
79
|
+
annas-download download --title "The Great Gatsby"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**By MD5 directly:**
|
|
83
|
+
```bash
|
|
84
|
+
annas-download download --md5 a1b2c3d4e5f6...
|
|
85
|
+
annas-download download --md5 a1b2c3d4e5f6... --filename "My Book"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Options:**
|
|
89
|
+
| Option | Description |
|
|
90
|
+
|--------|-------------|
|
|
91
|
+
| `--md5 <string>` | Book MD5 hash (bypasses search) |
|
|
92
|
+
| `--title <string>` | Book title keywords (for search) |
|
|
93
|
+
| `--author <string>` | Author name |
|
|
94
|
+
| `--format <pdf\|epub>` | Filter by format |
|
|
95
|
+
| `--lang <en\|zh>` | Language preference |
|
|
96
|
+
| `--filename <string>` | Output filename (MD5 mode only) |
|
|
97
|
+
| `--output <dir>` | Output directory |
|
|
98
|
+
| `--json` | JSON output |
|
|
99
|
+
|
|
100
|
+
### Batch Download
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
annas-download batch --excel ./books.xlsx
|
|
104
|
+
annas-download batch --excel ./books.xlsx --output ./downloads --limit 10
|
|
105
|
+
annas-download batch --excel ./books.xlsx --json
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Options:**
|
|
109
|
+
| Option | Description |
|
|
110
|
+
|--------|-------------|
|
|
111
|
+
| `--excel <file>` | Excel file path (required) |
|
|
112
|
+
| `--output <dir>` | Output directory |
|
|
113
|
+
| `--limit <n>` | Max downloads |
|
|
114
|
+
| `--json` | JSON output |
|
|
115
|
+
|
|
116
|
+
**Excel Format:**
|
|
117
|
+
| Column | Description |
|
|
118
|
+
|--------|-------------|
|
|
119
|
+
| 语言 | "en" to use English title, otherwise Chinese |
|
|
120
|
+
| 书名 | Chinese title |
|
|
121
|
+
| Book title | English title |
|
|
122
|
+
| 作者 | Chinese author |
|
|
123
|
+
| Author | English author |
|
|
124
|
+
| 下载状态 | Status (updated automatically) |
|
|
125
|
+
| 书籍链接 | Optional MD5 link to skip search |
|
|
126
|
+
|
|
127
|
+
### Config Management
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
annas-download config list # Show config paths and values
|
|
131
|
+
annas-download config path # Show active config file path
|
|
132
|
+
annas-download config init # Create default config in ~/.annasbook/
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Convert EPUB to PDF
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
annas-download convert ./book.epub
|
|
139
|
+
annas-download convert ./book.epub --output ./pdfs
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Generate PDF Preview
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
annas-download preview ./book.pdf
|
|
146
|
+
annas-download preview ./book.pdf --output ./previews
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Requires `pdftoppm` from poppler (macOS: `brew install poppler`)
|
|
150
|
+
|
|
151
|
+
## Configuration
|
|
152
|
+
|
|
153
|
+
Edit `~/.annasbook/config.json`:
|
|
154
|
+
|
|
155
|
+
```json
|
|
156
|
+
{
|
|
157
|
+
"apiKey": "your-api-key",
|
|
158
|
+
"baseUrl": "https://annas-archive.gl",
|
|
159
|
+
"downloadDir": "./downloads",
|
|
160
|
+
"rateLimitMs": 10000,
|
|
161
|
+
"requestTimeoutMs": 30000,
|
|
162
|
+
"downloadTimeoutMs": 300000,
|
|
163
|
+
"maxRetries": 3,
|
|
164
|
+
"proxy": "http://127.0.0.1:7892",
|
|
165
|
+
"downloadLimit": 10,
|
|
166
|
+
"openai": {
|
|
167
|
+
"enable": true,
|
|
168
|
+
"apiKey": "sk-...",
|
|
169
|
+
"baseUrl": "https://api.openai.com/v1",
|
|
170
|
+
"model": "gpt-4o-mini"
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
| Field | Default | Description |
|
|
176
|
+
|-------|---------|-------------|
|
|
177
|
+
| `apiKey` | required | API key for Anna's Archive |
|
|
178
|
+
| `baseUrl` | required | Base URL for mirror |
|
|
179
|
+
| `downloadDir` | ./downloads | Download directory |
|
|
180
|
+
| `rateLimitMs` | 10000 | Delay between requests (ms) |
|
|
181
|
+
| `requestTimeoutMs` | 30000 | HTTP request timeout (ms) |
|
|
182
|
+
| `downloadTimeoutMs` | 300000 | Download timeout (ms) |
|
|
183
|
+
| `maxRetries` | 3 | Max retry attempts |
|
|
184
|
+
| `proxy` | - | Optional proxy URL |
|
|
185
|
+
| `downloadLimit` | unlimited | Max downloads per run |
|
|
186
|
+
| `openai.apiKey` | - | OpenAI API key for LLM matching |
|
|
187
|
+
| `openai.enable` | true | Enable LLM fallback |
|
|
188
|
+
|
|
189
|
+
## Error Handling
|
|
190
|
+
|
|
191
|
+
| Error | Meaning | Solution |
|
|
192
|
+
|-------|---------|----------|
|
|
193
|
+
| `CAPTCHA_DETECTED` | CAPTCHA challenge triggered | Visit search URL in browser, solve CAPTCHA, update `cookies.json` |
|
|
194
|
+
| `NO_DOWNLOADS_LEFT` | Account has no downloads remaining | Use a different account |
|
|
195
|
+
| `RATE_LIMITED` | Too many requests | Tool waits 60 seconds automatically |
|
|
196
|
+
| 502 Bad Gateway | Rate limit too aggressive | Increase `rateLimitMs` to 10000 or higher |
|
|
197
|
+
|
|
198
|
+
## License
|
|
199
|
+
|
|
200
|
+
ISC
|
|
Binary file
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: anna-downloader
|
|
3
|
+
description: |
|
|
4
|
+
Download, search, batch process, convert, and preview books from Anna's Archive using the CLI tool. Use this skill whenever the user wants to search for, download, batch download from Excel, convert ebook formats, or generate PDF previews from Anna's Archive. Triggers on requests like "download a book", "find a PDF of", "search for ebook", "get a book from Anna's Archive", "batch download books from Excel", "convert epub to pdf", "generate PDF preview", or any mention of downloading books/ebooks/PDFs/EPUBs. The skill provides complete CLI commands for searching, downloading, batch processing, format conversion, and PDF preview generation.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Anna's Archive Book Downloader
|
|
8
|
+
|
|
9
|
+
A CLI tool to search and download books from Anna's Archive mirror sites.
|
|
10
|
+
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
Before using this tool, you need a config file. The tool searches for config in this order:
|
|
14
|
+
|
|
15
|
+
1. `ANNASBOOK_CONFIG` environment variable
|
|
16
|
+
2. `~/.annasbook/config.json` (default location)
|
|
17
|
+
|
|
18
|
+
**Initialize config:**
|
|
19
|
+
```bash
|
|
20
|
+
annas-download config init
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Config file format:**
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"apiKey": "your-api-key",
|
|
27
|
+
"baseUrl": "https://annas-archive.gl",
|
|
28
|
+
"downloadDir": "./downloads",
|
|
29
|
+
"rateLimitMs": 10000,
|
|
30
|
+
"requestTimeoutMs": 30000,
|
|
31
|
+
"downloadTimeoutMs": 300000,
|
|
32
|
+
"maxRetries": 3,
|
|
33
|
+
"proxy": "http://127.0.0.1:7892",
|
|
34
|
+
"downloadLimit": 10,
|
|
35
|
+
"openai": {
|
|
36
|
+
"enable": true,
|
|
37
|
+
"apiKey": "sk-...",
|
|
38
|
+
"baseUrl": "https://api.openai.com/v1",
|
|
39
|
+
"model": "gpt-4o-mini"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Config fields:**
|
|
45
|
+
| Field | Type | Default | Description |
|
|
46
|
+
|-------|------|---------|-------------|
|
|
47
|
+
| `apiKey` | string | required | API key for Anna's Archive |
|
|
48
|
+
| `baseUrl` | string | required | Base URL for Anna's Archive mirror |
|
|
49
|
+
| `downloadDir` | string | ./downloads | Directory for downloaded files |
|
|
50
|
+
| `rateLimitMs` | number | 10000 | Delay between requests (ms) - **important: 10s default to avoid 502 errors** |
|
|
51
|
+
| `requestTimeoutMs` | number | 30000 | HTTP request timeout (ms) |
|
|
52
|
+
| `downloadTimeoutMs` | number | 300000 | Download timeout (ms) |
|
|
53
|
+
| `maxRetries` | number | 3 | Max retry attempts |
|
|
54
|
+
| `proxy` | string | - | Optional proxy URL |
|
|
55
|
+
| `downloadLimit` | number | - | Max downloads per run (0 = unlimited) |
|
|
56
|
+
| `openai.apiKey` | string | - | OpenAI API key for LLM-assisted matching |
|
|
57
|
+
| `openai.baseUrl` | string | https://api.openai.com/v1 | OpenAI API base URL |
|
|
58
|
+
| `openai.model` | string | gpt-4o-mini | OpenAI model for matching |
|
|
59
|
+
| `openai.enable` | boolean | true | Enable LLM fallback when traditional matching fails |
|
|
60
|
+
| `excelFile` | string | - | Path to Excel file for batch mode |
|
|
61
|
+
|
|
62
|
+
**Environment variables** (override config file):
|
|
63
|
+
- `ANNASBOOK_API_KEY` - API key
|
|
64
|
+
- `ANNASBOOK_BASE_URL` - Mirror URL
|
|
65
|
+
- `ANNASBOOK_DOWNLOAD_DIR` - Download directory
|
|
66
|
+
- `ANNASBOOK_PROXY` - Proxy URL
|
|
67
|
+
|
|
68
|
+
**cookies.json** (in project root or `~/.annasbook/`) - Authentication cookies:
|
|
69
|
+
```json
|
|
70
|
+
"name1=value1; name2=value2"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## CLI Commands
|
|
74
|
+
|
|
75
|
+
### Search for Books
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
annas-download search --title "Book Title"
|
|
79
|
+
annas-download search --title "Book Title" --author "Author Name"
|
|
80
|
+
annas-download search --title "Dune" --format epub
|
|
81
|
+
annas-download search --title "1984" --author "Orwell" --format pdf --lang en
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Options:**
|
|
85
|
+
| Option | Description |
|
|
86
|
+
|--------|-------------|
|
|
87
|
+
| `--title <string>` | Book title keywords (required) |
|
|
88
|
+
| `--author <string>` | Author name |
|
|
89
|
+
| `--format <pdf\|epub>` | Filter by format |
|
|
90
|
+
| `--lang <en\|zh>` | Language preference (default: en) |
|
|
91
|
+
| `--limit <number>` | Max results (default: 5) |
|
|
92
|
+
| `--json` | JSON output |
|
|
93
|
+
|
|
94
|
+
### Download Books
|
|
95
|
+
|
|
96
|
+
**Method 1: Search and Download Interactively**
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
annas-download download --title "The Great Gatsby"
|
|
100
|
+
annas-download download --title "1984" --author "Orwell" --format pdf
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Method 2: Download by MD5 Directly**
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
annas-download download --md5 a1b2c3d4e5f6...
|
|
107
|
+
annas-download download --md5 a1b2c3d4e5f6... --filename "My Book Title"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Download Options:**
|
|
111
|
+
| Option | Description |
|
|
112
|
+
|--------|-------------|
|
|
113
|
+
| `--md5 <string>` | Book MD5 hash (bypasses search) |
|
|
114
|
+
| `--title <string>` | Book title keywords (for search) |
|
|
115
|
+
| `--author <string>` | Author name |
|
|
116
|
+
| `--format <pdf\|epub>` | Filter by format |
|
|
117
|
+
| `--lang <en\|zh>` | Language preference |
|
|
118
|
+
| `--filename <string>` | Output filename (MD5 mode only) |
|
|
119
|
+
| `--output <dir>` | Output directory |
|
|
120
|
+
| `--json` | JSON output |
|
|
121
|
+
|
|
122
|
+
### Batch Download from Excel
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
annas-download batch --excel ./books.xlsx
|
|
126
|
+
annas-download batch --excel ./books.xlsx --output ./downloads --limit 10
|
|
127
|
+
annas-download batch --excel ./books.xlsx --json
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Batch Options:**
|
|
131
|
+
| Option | Description |
|
|
132
|
+
|--------|-------------|
|
|
133
|
+
| `--excel <file>` | Excel file path (required) |
|
|
134
|
+
| `--output <dir>` | Output directory |
|
|
135
|
+
| `--limit <n>` | Max downloads |
|
|
136
|
+
| `--json` | JSON output |
|
|
137
|
+
|
|
138
|
+
**Excel Format Requirements:**
|
|
139
|
+
| Column | Description |
|
|
140
|
+
|--------|-------------|
|
|
141
|
+
| 语言 | "en" to use English title, otherwise Chinese |
|
|
142
|
+
| 书名 | Chinese title |
|
|
143
|
+
| Book title | English title |
|
|
144
|
+
| 作者 | Chinese author |
|
|
145
|
+
| Author | English author |
|
|
146
|
+
| 下载状态 | Status (updated automatically) |
|
|
147
|
+
| 书籍链接 | Optional MD5 link to skip search |
|
|
148
|
+
|
|
149
|
+
### Config Management
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
annas-download config list # Show config paths and current values
|
|
153
|
+
annas-download config path # Show active config file path
|
|
154
|
+
annas-download config init # Create default config in ~/.annasbook/
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Convert EPUB to PDF
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
annas-download convert ./book.epub
|
|
161
|
+
annas-download convert ./book.epub --output ./pdfs
|
|
162
|
+
annas-download convert ./book.epub --output ./pdfs/mybook.pdf
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Convert Options:**
|
|
166
|
+
| Option | Description |
|
|
167
|
+
|--------|-------------|
|
|
168
|
+
| `<input.epub>` | Path to EPUB file (required, position arg) |
|
|
169
|
+
| `--output <path>` | Output path or directory for PDF |
|
|
170
|
+
|
|
171
|
+
### Generate PDF Preview
|
|
172
|
+
|
|
173
|
+
Generate a PNG preview of the first page of a PDF file.
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
annas-download preview ./book.pdf
|
|
177
|
+
annas-download preview ./book.pdf --output ./previews
|
|
178
|
+
annas-download preview ./book.pdf --output ./previews/cover.png
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Preview Options:**
|
|
182
|
+
| Option | Description |
|
|
183
|
+
|--------|-------------|
|
|
184
|
+
| `<input.pdf>` | Path to PDF file (required, positional arg) |
|
|
185
|
+
| `--input <path>` | Alternative way to specify input PDF |
|
|
186
|
+
| `--output <path>` | Output path or directory for PNG (default: same dir as input, .pdf → .png) |
|
|
187
|
+
|
|
188
|
+
**Requirements:** Requires `pdftoppm` from poppler (macOS: `brew install poppler`)
|
|
189
|
+
|
|
190
|
+
### Global Options
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
annas-download --config /path/to/config.json search --title "Book"
|
|
194
|
+
annas-download --output ./my-downloads download --md5 abc123
|
|
195
|
+
annas-download --json search --title "Book"
|
|
196
|
+
annas-download --help
|
|
197
|
+
annas-download --version
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Error Handling
|
|
201
|
+
|
|
202
|
+
| Error | Meaning | Solution |
|
|
203
|
+
|-------|---------|----------|
|
|
204
|
+
| `CAPTCHA_DETECTED` | CAPTCHA challenge triggered | Visit search URL in browser, solve CAPTCHA, update `cookies.json` |
|
|
205
|
+
| `NO_DOWNLOADS_LEFT` | Account has no downloads remaining | Use a different account |
|
|
206
|
+
| `RATE_LIMITED` | Too many requests | Tool waits 60 seconds automatically |
|
|
207
|
+
| 502 Bad Gateway | Rate limit too aggressive | Increase `rateLimitMs` to 10000 or higher (default is 10s) |
|
|
208
|
+
|
|
209
|
+
## Typical Workflow
|
|
210
|
+
|
|
211
|
+
1. **First, search to see available editions:**
|
|
212
|
+
```bash
|
|
213
|
+
annas-download search --title "Book Name" --author "Author" --format pdf
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
2. **Review results** - Note the MD5 of desired edition
|
|
217
|
+
|
|
218
|
+
3. **Download either interactively or by MD5:**
|
|
219
|
+
```bash
|
|
220
|
+
# Interactive
|
|
221
|
+
annas-download download --title "Book Name" --format pdf
|
|
222
|
+
|
|
223
|
+
# Direct by MD5
|
|
224
|
+
annas-download download --md5 <the-md5-hash>
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
4. **Files are saved to** `downloadDir` (default: `./downloads`)
|
|
228
|
+
|
|
229
|
+
## Notes
|
|
230
|
+
|
|
231
|
+
- The tool auto-detects actual file format from download header (may differ from search result)
|
|
232
|
+
- Downloaded files are named: `{ChineseTitle} - {EnglishTitle}.{extension}`
|
|
233
|
+
- For Chinese books, set `--lang zh` to use Chinese title for search
|
|
234
|
+
- The tool retries on timeout (up to `maxRetries` in config)
|
|
235
|
+
- When traditional title matching fails, the tool can use OpenAI LLM to find the best match (requires `openai.apiKey` in config)
|
|
236
|
+
- EPUB files are automatically converted to PDF after download if `openai` is configured
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"skill_name": "anna-downloader",
|
|
3
|
+
"evals": [
|
|
4
|
+
{
|
|
5
|
+
"id": 1,
|
|
6
|
+
"prompt": "帮我下载《了不起的盖茨比》这本书",
|
|
7
|
+
"expected_output": "应使用 annas-download download --title \"The Great Gatsby\" --lang en 命令搜索并下载",
|
|
8
|
+
"files": []
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"id": 2,
|
|
12
|
+
"prompt": "Search for a PDF of \"Designing Data-Intensive Applications\"",
|
|
13
|
+
"expected_output": "应使用 annas-download search --title \"Designing Data-Intensive Applications\" --format pdf 命令搜索",
|
|
14
|
+
"files": []
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": 3,
|
|
18
|
+
"prompt": "I have an MD5 hash a1b2c3d4e5f6g7h8, download that book for me",
|
|
19
|
+
"expected_output": "应使用 annas-download download --md5 a1b2c3d4e5f6g7h8 命令直接下载",
|
|
20
|
+
"files": []
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
Binary file
|
|
Binary file
|