@adbjs/cli 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 +318 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1384 -0
- package/package.json +62 -0
package/README.md
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
# @adbjs/cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for AllDebrid API v4.1 - manage your torrents, links, and account from the terminal.
|
|
4
|
+
|
|
5
|
+
## ✨ Features
|
|
6
|
+
|
|
7
|
+
- 🔥 **Complete API Coverage** - Magnets, links, user management, hosts, and vouchers
|
|
8
|
+
- 🎨 **Interactive Mode** - User-friendly prompts with beautiful TUI
|
|
9
|
+
- 📊 **Real-time Monitoring** - Watch torrent progress with live updates
|
|
10
|
+
- 🔧 **JSON Output** - `--json` flag for shell scripting and automation
|
|
11
|
+
- ⚡ **Delta Sync** - Efficient polling with session-based updates
|
|
12
|
+
- 🔐 **Secure Auth** - PIN-based authentication with local config storage
|
|
13
|
+
- 💻 **Cross-platform** - Works on Windows, macOS, and Linux
|
|
14
|
+
|
|
15
|
+
## 📦 Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g @adbjs/cli
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Or with other package managers:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add -g @adbjs/cli
|
|
25
|
+
yarn global add @adbjs/cli
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 🚀 Quick Start
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Authenticate with AllDebrid
|
|
32
|
+
adb auth login
|
|
33
|
+
|
|
34
|
+
# Upload a magnet link
|
|
35
|
+
adb magnet upload "magnet:?xt=urn:btih:..."
|
|
36
|
+
|
|
37
|
+
# Check magnet status
|
|
38
|
+
adb magnet list
|
|
39
|
+
|
|
40
|
+
# Get download links
|
|
41
|
+
adb magnet files 12345
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 🔐 Authentication
|
|
45
|
+
|
|
46
|
+
The CLI uses PIN-based authentication. Run the login command and follow the instructions:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
adb auth login
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This will:
|
|
53
|
+
|
|
54
|
+
1. Generate a PIN code
|
|
55
|
+
2. Display a URL to visit
|
|
56
|
+
3. Wait for you to authorize the application
|
|
57
|
+
4. Save the API key securely
|
|
58
|
+
|
|
59
|
+
You can also use an environment variable:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
export ALLDEBRID_API_KEY=your-api-key
|
|
63
|
+
adb user info
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Or pass it directly:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
adb --api-key your-api-key user info
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Priority order:** CLI flag > Environment variable > Saved config
|
|
73
|
+
|
|
74
|
+
### Auth Commands
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
adb auth login # Interactive PIN-based login
|
|
78
|
+
adb auth logout # Clear saved credentials
|
|
79
|
+
adb auth status # Check authentication status
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## 📖 Commands
|
|
83
|
+
|
|
84
|
+
### Magnet Commands
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Upload magnet or torrent file
|
|
88
|
+
adb magnet upload <magnet-link>
|
|
89
|
+
adb magnet upload ./file.torrent
|
|
90
|
+
|
|
91
|
+
# List all magnets
|
|
92
|
+
adb magnet list
|
|
93
|
+
adb magnet list --status active # Filter by status: active, ready, expired, error
|
|
94
|
+
|
|
95
|
+
# Get status of a specific magnet
|
|
96
|
+
adb magnet status <id>
|
|
97
|
+
|
|
98
|
+
# Monitor all magnets with delta sync (for scripting)
|
|
99
|
+
adb magnet status --live
|
|
100
|
+
adb magnet status --live --session 123 --counter 5
|
|
101
|
+
|
|
102
|
+
# Watch magnet progress in real-time
|
|
103
|
+
adb magnet watch <id>
|
|
104
|
+
|
|
105
|
+
# Get download links for completed magnet
|
|
106
|
+
adb magnet files <id>
|
|
107
|
+
|
|
108
|
+
# Delete a magnet
|
|
109
|
+
adb magnet delete <id>
|
|
110
|
+
|
|
111
|
+
# Restart a failed magnet
|
|
112
|
+
adb magnet restart <id>
|
|
113
|
+
|
|
114
|
+
# Interactive mode
|
|
115
|
+
adb magnet
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Link Commands
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Unlock a premium link
|
|
122
|
+
adb link unlock <url>
|
|
123
|
+
adb link unlock <url> --password secret
|
|
124
|
+
|
|
125
|
+
# Get link information
|
|
126
|
+
adb link info <url>
|
|
127
|
+
|
|
128
|
+
# Get streaming link
|
|
129
|
+
adb link stream <id> <quality>
|
|
130
|
+
|
|
131
|
+
# Extract links from redirector
|
|
132
|
+
adb link redirector <url>
|
|
133
|
+
|
|
134
|
+
# Interactive mode
|
|
135
|
+
adb link
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### User Commands
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Display account information
|
|
142
|
+
adb user info
|
|
143
|
+
|
|
144
|
+
# List saved links
|
|
145
|
+
adb user saved list
|
|
146
|
+
|
|
147
|
+
# Save a link
|
|
148
|
+
adb user saved add <url>
|
|
149
|
+
|
|
150
|
+
# Delete saved link(s)
|
|
151
|
+
adb user saved delete <url>
|
|
152
|
+
|
|
153
|
+
# View download history
|
|
154
|
+
adb user history
|
|
155
|
+
|
|
156
|
+
# Clear download history
|
|
157
|
+
adb user history clear
|
|
158
|
+
|
|
159
|
+
# Interactive mode
|
|
160
|
+
adb user
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Host Commands
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# List all supported hosts
|
|
167
|
+
adb host list
|
|
168
|
+
adb host list --hosts-only # Only show hosts (no streams/redirectors)
|
|
169
|
+
|
|
170
|
+
# List all supported domains
|
|
171
|
+
adb host domains
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Voucher Commands (Reseller)
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
# Check voucher balance
|
|
178
|
+
adb voucher balance
|
|
179
|
+
|
|
180
|
+
# List vouchers
|
|
181
|
+
adb voucher list
|
|
182
|
+
adb voucher list --quantity 10
|
|
183
|
+
|
|
184
|
+
# Generate vouchers
|
|
185
|
+
adb voucher generate <quantity> <days>
|
|
186
|
+
|
|
187
|
+
# Interactive mode
|
|
188
|
+
adb voucher
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## ⚙️ Global Options
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
--api-key <key> # Override API key
|
|
195
|
+
--json # Output in JSON format (for scripting)
|
|
196
|
+
--help # Show help
|
|
197
|
+
--version # Show version
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## 🔧 JSON Output
|
|
201
|
+
|
|
202
|
+
Use the `--json` flag for machine-readable output, perfect for shell scripting:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# Get magnet list as JSON
|
|
206
|
+
adb --json magnet list
|
|
207
|
+
|
|
208
|
+
# Parse with jq
|
|
209
|
+
adb --json magnet status 12345 | jq '.status'
|
|
210
|
+
|
|
211
|
+
# Use in scripts
|
|
212
|
+
STATUS=$(adb --json magnet status 12345 | jq -r '.status')
|
|
213
|
+
if [ "$STATUS" = "Ready" ]; then
|
|
214
|
+
echo "Download complete!"
|
|
215
|
+
fi
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
JSON mode:
|
|
219
|
+
|
|
220
|
+
- Outputs raw API responses as formatted JSON
|
|
221
|
+
- Disables spinners and colored output
|
|
222
|
+
- Skips confirmation prompts (for delete operations)
|
|
223
|
+
- Outputs errors as `{"error": "message"}`
|
|
224
|
+
|
|
225
|
+
## ⚡ Delta Sync for Monitoring
|
|
226
|
+
|
|
227
|
+
The `--live` flag uses AllDebrid's delta sync API for efficient polling:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
# First call - gets full list
|
|
231
|
+
adb --json magnet status --live
|
|
232
|
+
# Returns: { "magnets": [...], "session": 123456, "counter": 1, "fullsync": true }
|
|
233
|
+
|
|
234
|
+
# Subsequent calls - only changed magnets
|
|
235
|
+
adb --json magnet status --live --session 123456 --counter 1
|
|
236
|
+
# Returns: { "magnets": [...], "counter": 2, "fullsync": false }
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
This is more bandwidth-efficient than polling the full list repeatedly.
|
|
240
|
+
|
|
241
|
+
## 🎨 Interactive Mode
|
|
242
|
+
|
|
243
|
+
Run any command group without arguments to enter interactive mode:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
adb magnet # Interactive magnet management
|
|
247
|
+
adb link # Interactive link management
|
|
248
|
+
adb user # Interactive user management
|
|
249
|
+
adb voucher # Interactive voucher management
|
|
250
|
+
adb auth # Interactive authentication
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## 🗂️ Configuration
|
|
254
|
+
|
|
255
|
+
The CLI stores its configuration in:
|
|
256
|
+
|
|
257
|
+
- **Linux/macOS:** `~/.config/alldebrid/config.json`
|
|
258
|
+
- **Windows:** `%APPDATA%\alldebrid\config.json`
|
|
259
|
+
|
|
260
|
+
## 💡 Examples
|
|
261
|
+
|
|
262
|
+
### Download a torrent
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# Upload magnet
|
|
266
|
+
adb magnet upload "magnet:?xt=urn:btih:..."
|
|
267
|
+
|
|
268
|
+
# Watch progress
|
|
269
|
+
adb magnet watch 12345
|
|
270
|
+
|
|
271
|
+
# Get download links when ready
|
|
272
|
+
adb magnet files 12345
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Batch unlock links
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
# Using a file with URLs
|
|
279
|
+
cat urls.txt | while read url; do
|
|
280
|
+
adb --json link unlock "$url" | jq -r '.link'
|
|
281
|
+
done
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Monitor all active downloads
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
#!/bin/bash
|
|
288
|
+
SESSION=""
|
|
289
|
+
COUNTER=0
|
|
290
|
+
|
|
291
|
+
while true; do
|
|
292
|
+
if [ -z "$SESSION" ]; then
|
|
293
|
+
RESULT=$(adb --json magnet status --live)
|
|
294
|
+
else
|
|
295
|
+
RESULT=$(adb --json magnet status --live --session $SESSION --counter $COUNTER)
|
|
296
|
+
fi
|
|
297
|
+
|
|
298
|
+
SESSION=$(echo $RESULT | jq -r '.session')
|
|
299
|
+
COUNTER=$(echo $RESULT | jq -r '.counter')
|
|
300
|
+
|
|
301
|
+
echo $RESULT | jq '.magnets[] | "\(.id): \(.status)"'
|
|
302
|
+
|
|
303
|
+
sleep 5
|
|
304
|
+
done
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## 📋 Requirements
|
|
308
|
+
|
|
309
|
+
- Node.js >= 20.0.0
|
|
310
|
+
- AllDebrid account with API access
|
|
311
|
+
|
|
312
|
+
## 🔗 Related
|
|
313
|
+
|
|
314
|
+
- [@adbjs/sdk](https://www.npmjs.com/package/@adbjs/sdk) - TypeScript SDK for AllDebrid API
|
|
315
|
+
|
|
316
|
+
## 📝 License
|
|
317
|
+
|
|
318
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|