tor-dl 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.
Files changed (145) hide show
  1. package/AGENTS.md +53 -0
  2. package/README.md +255 -0
  3. package/bin/tordl.js +5 -0
  4. package/dist/bin/tordl.js +5 -0
  5. package/dist/bin/torrent-cli.js +5 -0
  6. package/dist/cli/display.d.ts +7 -0
  7. package/dist/cli/display.d.ts.map +1 -0
  8. package/dist/cli/display.js +58 -0
  9. package/dist/cli/display.js.map +1 -0
  10. package/dist/cli/parser.d.ts +5 -0
  11. package/dist/cli/parser.d.ts.map +1 -0
  12. package/dist/cli/parser.js +122 -0
  13. package/dist/cli/parser.js.map +1 -0
  14. package/dist/cli/progress.d.ts +15 -0
  15. package/dist/cli/progress.d.ts.map +1 -0
  16. package/dist/cli/progress.js +76 -0
  17. package/dist/cli/progress.js.map +1 -0
  18. package/dist/commands/download.d.ts +2 -0
  19. package/dist/commands/download.d.ts.map +1 -0
  20. package/dist/commands/download.js +70 -0
  21. package/dist/commands/download.js.map +1 -0
  22. package/dist/commands/search.d.ts +3 -0
  23. package/dist/commands/search.d.ts.map +1 -0
  24. package/dist/commands/search.js +46 -0
  25. package/dist/commands/search.js.map +1 -0
  26. package/dist/commands/update.d.ts +2 -0
  27. package/dist/commands/update.d.ts.map +1 -0
  28. package/dist/commands/update.js +32 -0
  29. package/dist/commands/update.js.map +1 -0
  30. package/dist/download/engine.d.ts +6 -0
  31. package/dist/download/engine.d.ts.map +1 -0
  32. package/dist/download/engine.js +163 -0
  33. package/dist/download/engine.js.map +1 -0
  34. package/dist/filters/category.d.ts +3 -0
  35. package/dist/filters/category.d.ts.map +1 -0
  36. package/dist/filters/category.js +24 -0
  37. package/dist/filters/category.js.map +1 -0
  38. package/dist/filters/index.d.ts +5 -0
  39. package/dist/filters/index.d.ts.map +1 -0
  40. package/dist/filters/index.js +13 -0
  41. package/dist/filters/index.js.map +1 -0
  42. package/dist/filters/seeds.d.ts +3 -0
  43. package/dist/filters/seeds.d.ts.map +1 -0
  44. package/dist/filters/seeds.js +7 -0
  45. package/dist/filters/seeds.js.map +1 -0
  46. package/dist/filters/size.d.ts +4 -0
  47. package/dist/filters/size.d.ts.map +1 -0
  48. package/dist/filters/size.js +36 -0
  49. package/dist/filters/size.js.map +1 -0
  50. package/dist/filters/sort.d.ts +5 -0
  51. package/dist/filters/sort.d.ts.map +1 -0
  52. package/dist/filters/sort.js +25 -0
  53. package/dist/filters/sort.js.map +1 -0
  54. package/dist/index.d.ts +11 -0
  55. package/dist/index.d.ts.map +1 -0
  56. package/dist/index.js +30 -0
  57. package/dist/index.js.map +1 -0
  58. package/dist/sources/1337x.d.ts +11 -0
  59. package/dist/sources/1337x.d.ts.map +1 -0
  60. package/dist/sources/1337x.js +121 -0
  61. package/dist/sources/1337x.js.map +1 -0
  62. package/dist/sources/eztv.d.ts +11 -0
  63. package/dist/sources/eztv.d.ts.map +1 -0
  64. package/dist/sources/eztv.js +104 -0
  65. package/dist/sources/eztv.js.map +1 -0
  66. package/dist/sources/httpClient.d.ts +24 -0
  67. package/dist/sources/httpClient.d.ts.map +1 -0
  68. package/dist/sources/httpClient.js +42 -0
  69. package/dist/sources/httpClient.js.map +1 -0
  70. package/dist/sources/limetorrent.d.ts +11 -0
  71. package/dist/sources/limetorrent.d.ts.map +1 -0
  72. package/dist/sources/limetorrent.js +113 -0
  73. package/dist/sources/limetorrent.js.map +1 -0
  74. package/dist/sources/nyaa.d.ts +11 -0
  75. package/dist/sources/nyaa.d.ts.map +1 -0
  76. package/dist/sources/nyaa.js +119 -0
  77. package/dist/sources/nyaa.js.map +1 -0
  78. package/dist/sources/rarbg.d.ts +11 -0
  79. package/dist/sources/rarbg.d.ts.map +1 -0
  80. package/dist/sources/rarbg.js +122 -0
  81. package/dist/sources/rarbg.js.map +1 -0
  82. package/dist/sources/registry.d.ts +9 -0
  83. package/dist/sources/registry.d.ts.map +1 -0
  84. package/dist/sources/registry.js +70 -0
  85. package/dist/sources/registry.js.map +1 -0
  86. package/dist/sources/solidtorrents.d.ts +11 -0
  87. package/dist/sources/solidtorrents.d.ts.map +1 -0
  88. package/dist/sources/solidtorrents.js +105 -0
  89. package/dist/sources/solidtorrents.js.map +1 -0
  90. package/dist/sources/thepiratebay.d.ts +11 -0
  91. package/dist/sources/thepiratebay.d.ts.map +1 -0
  92. package/dist/sources/thepiratebay.js +67 -0
  93. package/dist/sources/thepiratebay.js.map +1 -0
  94. package/dist/sources/torlock.d.ts +11 -0
  95. package/dist/sources/torlock.d.ts.map +1 -0
  96. package/dist/sources/torlock.js +116 -0
  97. package/dist/sources/torlock.js.map +1 -0
  98. package/dist/sources/torrentproject.d.ts +11 -0
  99. package/dist/sources/torrentproject.d.ts.map +1 -0
  100. package/dist/sources/torrentproject.js +105 -0
  101. package/dist/sources/torrentproject.js.map +1 -0
  102. package/dist/sources/torrentscsv.d.ts +11 -0
  103. package/dist/sources/torrentscsv.d.ts.map +1 -0
  104. package/dist/sources/torrentscsv.js +62 -0
  105. package/dist/sources/torrentscsv.js.map +1 -0
  106. package/dist/sources/yts.d.ts +12 -0
  107. package/dist/sources/yts.d.ts.map +1 -0
  108. package/dist/sources/yts.js +88 -0
  109. package/dist/sources/yts.js.map +1 -0
  110. package/dist/types.d.ts +60 -0
  111. package/dist/types.d.ts.map +1 -0
  112. package/dist/types.js +3 -0
  113. package/dist/types.js.map +1 -0
  114. package/filters.json +9 -0
  115. package/package.json +37 -0
  116. package/sources.json +105 -0
  117. package/src/cli/display.ts +58 -0
  118. package/src/cli/parser.ts +96 -0
  119. package/src/cli/progress.ts +78 -0
  120. package/src/commands/download.ts +36 -0
  121. package/src/commands/search.ts +53 -0
  122. package/src/commands/update.ts +30 -0
  123. package/src/download/engine.ts +177 -0
  124. package/src/filters/category.ts +26 -0
  125. package/src/filters/index.ts +4 -0
  126. package/src/filters/seeds.ts +5 -0
  127. package/src/filters/size.ts +42 -0
  128. package/src/filters/sort.ts +34 -0
  129. package/src/index.ts +10 -0
  130. package/src/sources/1337x.ts +85 -0
  131. package/src/sources/eztv.ts +70 -0
  132. package/src/sources/httpClient.ts +39 -0
  133. package/src/sources/limetorrent.ts +78 -0
  134. package/src/sources/nyaa.ts +85 -0
  135. package/src/sources/rarbg.ts +86 -0
  136. package/src/sources/registry.ts +70 -0
  137. package/src/sources/solidtorrents.ts +70 -0
  138. package/src/sources/thepiratebay.ts +65 -0
  139. package/src/sources/torlock.ts +82 -0
  140. package/src/sources/torrentproject.ts +70 -0
  141. package/src/sources/torrentscsv.ts +58 -0
  142. package/src/sources/yts.ts +85 -0
  143. package/src/types.d.ts +86 -0
  144. package/src/types.ts +65 -0
  145. package/tsconfig.json +20 -0
package/AGENTS.md ADDED
@@ -0,0 +1,53 @@
1
+ # AGENTS.md - tordl
2
+
3
+ ## Project Type
4
+ Node.js CLI tool for torrent search and download using TypeScript.
5
+
6
+ ## Quick Start
7
+ ```bash
8
+ npm install
9
+ npm run build
10
+ node dist/bin/tordl.js --help
11
+ ```
12
+
13
+ ## Build Commands
14
+ - `npm run build` - Compile TypeScript to `dist/`
15
+ - `npm run start` or `node dist/bin/tordl.js` - Run CLI
16
+
17
+ ## Common Commands
18
+ ```bash
19
+ node dist/bin/tordl.js search "movie title"
20
+ node dist/bin/tordl.js 1 # Download result #1
21
+ node dist/bin/tordl.js -u # Update sources
22
+ node dist/bin/tordl.js -v # Version
23
+ ```
24
+
25
+ ## Critical Fixes (Do Not Remove)
26
+
27
+ ### 1. WebTorrent ESM Issue
28
+ - **Problem**: WebTorrent v2 is ESM-only, breaks with CommonJS require()
29
+ - **Fix**: Use webtorrent@1.9.7 (CommonJS compatible)
30
+ - **Command**: `npm install webtorrent@1.9.7`
31
+
32
+ ### 2. YTS Size Parsing Bug
33
+ - **Problem**: YTS API returns size as string ("1.05 GB"), not bytes
34
+ - **Fix**: Must use custom `parseSizeStr()` function - do NOT use `parseInt()` or `Number()`
35
+ - **Location**: `src/sources/yts.ts`
36
+
37
+ ## Key Files
38
+ - `sources.json` - Enable/disable torrent sources, contains updateUrl
39
+ - `filters.json` - Default search filters (category, minSeeds, minSize, maxSize, sortBy, order)
40
+ - `src/sources/` - Individual scraper implementations
41
+ - `src/download/engine.ts` - WebTorrent download engine
42
+
43
+ ## Architecture
44
+ - TypeScript compiled to CommonJS (`module: "commonjs"` in tsconfig.json)
45
+ - CLI built with Commander.js
46
+ - Scraper results cached in memory for download by number
47
+ - Multiple source scrapers (YTS, torrents-csv, EZTV, etc.)
48
+
49
+ ## Important Quirks
50
+ - Torrent sites frequently change HTML structure - scrapers may break
51
+ - Many sites block scrapers (403, Cloudflare, rate limiting)
52
+ - Only YTS and torrents-csv currently work reliably (API-based sources)
53
+ - Download shows magnet link but actual torrent download requires WebTorrent working
package/README.md ADDED
@@ -0,0 +1,255 @@
1
+ # tordl
2
+
3
+ <p align="center">
4
+ <img src="https://img.shields.io/npm/v/tordl" alt="npm version">
5
+ <img src="https://img.shields.io/node-version/tordl" alt="node version">
6
+ <img src="https://img.shields.io/github/license/tordl" alt="license">
7
+ </p>
8
+
9
+ > A powerful CLI torrent search and download tool. Search across multiple torrent sources, filter results, and download directly to your current directory - all from the terminal.
10
+
11
+ ## Features
12
+
13
+ - 🔍 **Multi-Source Search** - Search across 9 popular torrent sources simultaneously
14
+ - 🎯 **Smart Filters** - Filter by category, seeders, size with customizable defaults
15
+ - 📊 **Sort Options** - Sort by seeds, size, or date (ascending/descending)
16
+ - ⬇️ **Direct Downloads** - Download torrents directly using WebTorrent
17
+ - 📈 **Rich Progress** - Beautiful CLI progress bar with speed and ETA
18
+ - 🔄 **Easy Updates** - Update source configurations via `-u` flag
19
+ - ⚙️ **JSON Config** - Fully configurable via `filters.json` and `sources.json`
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ # Clone the repository
25
+ git clone https://github.com/eaeoz/tordl.git
26
+ cd tordl
27
+
28
+ # Install dependencies
29
+ npm install
30
+
31
+ # Build the project
32
+ npm run build
33
+
34
+ # Link for global use (optional)
35
+ npm link
36
+ ```
37
+
38
+ ## Quick Start
39
+
40
+ ```bash
41
+ # Search for torrents
42
+ tordl search "movie title"
43
+
44
+ # Download a specific result
45
+ tordl 3
46
+
47
+ # Update sources
48
+ tordl -u
49
+ ```
50
+
51
+ ## Supported Sources
52
+
53
+ | Source | Categories | Status |
54
+ |--------|------------|--------|
55
+ | 1337x | All | ✅ Enabled |
56
+ | EZTV | TV | ✅ Enabled |
57
+ | The Pirate Bay | All | ✅ Enabled |
58
+ | RarBG | Movie, TV | ✅ Enabled |
59
+ | Limetorrents | All | ✅ Enabled |
60
+ | TorLock | All | ✅ Enabled |
61
+ | TorrentProject | All | ✅ Enabled |
62
+ | SolidTorrents | All | ✅ Enabled |
63
+ | torrents-csv | All | ✅ Enabled |
64
+
65
+ ## Usage
66
+
67
+ ### Search Command
68
+
69
+ ```bash
70
+ tordl search <query> [options]
71
+ ```
72
+
73
+ **Options:**
74
+
75
+ | Flag | Description | Default |
76
+ |------|-------------|---------|
77
+ | `-c, --cat <category>` | Category: all, movie, tv | from filters.json |
78
+ | `-s, --min-seeds <number>` | Minimum seeders | from filters.json |
79
+ | `--min-size <size>` | Minimum size (e.g., 500MB, 1GB) | from filters.json |
80
+ | `--max-size <size>` | Maximum size (e.g., 5GB) | from filters.json |
81
+ | `-o, --sort <field>` | Sort by: seeds, size, date | seeds |
82
+ | `--order <order>` | Order: asc, desc | desc |
83
+ | `-l, --limit <number>` | Result limit | 50 |
84
+
85
+ **Examples:**
86
+
87
+ ```bash
88
+ # Basic search (uses filters.json defaults)
89
+ tordl search "Blade Runner 2049"
90
+
91
+ # Search with custom filters
92
+ tordl search "game of thrones" --cat tv --min-seeds 100 --min-size 500MB
93
+
94
+ # Sort by size (ascending)
95
+ tordl search "movie" --sort size --order asc
96
+
97
+ # Limit results to top 10
98
+ tordl search "linux" -l 10
99
+ ```
100
+
101
+ ### Download Command
102
+
103
+ ```bash
104
+ # Download by number (from previous search)
105
+ tordl <number>
106
+
107
+ # Or use explicit download command
108
+ tordl download <number> [options]
109
+ ```
110
+
111
+ **Options:**
112
+
113
+ | Flag | Description |
114
+ |------|-------------|
115
+ | `-p, --path <path>` | Custom download path |
116
+
117
+ **Example:**
118
+
119
+ ```bash
120
+ # Download result #3 from previous search
121
+ tordl 3
122
+ ```
123
+
124
+ ### Update Command
125
+
126
+ ```bash
127
+ tordl update
128
+ # or
129
+ tordl -u
130
+ ```
131
+
132
+ Updates source configurations from the remote URL specified in `sources.json`.
133
+
134
+ ### Version
135
+
136
+ ```bash
137
+ tordl --version
138
+ # or
139
+ tordl -v
140
+ ```
141
+
142
+ ## Configuration
143
+
144
+ ### filters.json
145
+
146
+ Default search filters (can be overridden via CLI):
147
+
148
+ ```json
149
+ {
150
+ "category": "all",
151
+ "minSeeds": 0,
152
+ "minSize": "0",
153
+ "maxSize": "50GB",
154
+ "sortBy": "seeds",
155
+ "order": "desc",
156
+ "limit": 50
157
+ }
158
+ ```
159
+
160
+ ### sources.json
161
+
162
+ Source configurations with remote update URL:
163
+
164
+ ```json
165
+ {
166
+ "updateUrl": "https://raw.githubusercontent.com/eaeoz/tordl/main/sources.json",
167
+ "version": "1.0.0",
168
+ "sources": {
169
+ "1337x": {
170
+ "enabled": true,
171
+ "name": "1337x",
172
+ "baseUrl": "https://1337x.to",
173
+ "searchUrl": "https://1337x.to/category-search",
174
+ "categories": ["all", "movie", "tv", "music", "games", "apps"],
175
+ "searchParam": "search",
176
+ "hasMagnet": true
177
+ }
178
+ }
179
+ }
180
+ ```
181
+
182
+ ## CLI Output Example
183
+
184
+ ```
185
+ ┌─────┬─────────────────────────────────────────┬───────────┬────────┬──────────┐
186
+ │ Num │ Name │ Size │ Seeds │ Source │
187
+ ├─────┼─────────────────────────────────────────┼───────────┼────────┼──────────┤
188
+ │ 1 │ Blade.Runner.2049.2017.720p.BluRay │ 1.2GB │ 5,000 │ 1337x │
189
+ │ 2 │ Blade.Runner.2049.2017.1080p.BluRay │ 2.1GB │ 3,200 │ limetorrent │
190
+ │ 3 │ Blade.Runner.2049.2017.4K.BluRay │ 4.5GB │ 1,800 │ rarbg │
191
+ └─────┴─────────────────────────────────────────┴───────────┴────────┴──────────┘
192
+
193
+ To download: tordl <number>
194
+ ```
195
+
196
+ ## Project Structure
197
+
198
+ ```
199
+ tordl/
200
+ ├── bin/
201
+ │ └── tordl.js # CLI entry point
202
+ ├── src/
203
+ │ ├── cli/
204
+ │ │ ├── parser.ts # Commander.js CLI parser
205
+ │ │ ├── display.ts # Terminal output formatting
206
+ │ │ └── progress.ts # Download progress bar
207
+ │ ├── commands/
208
+ │ │ ├── search.ts # Search command
209
+ │ │ ├── download.ts # Download command
210
+ │ │ └── update.ts # Update sources command
211
+ │ ├── sources/
212
+ │ │ ├── _1337x.ts # 1337x scraper
213
+ │ │ ├── eztv.ts # EZTV scraper
214
+ │ │ ├── limetorrent.ts # Limetorrents scraper
215
+ │ │ ├── rarbg.ts # RarBG scraper
216
+ │ │ └── ... # More source scrapers
217
+ │ ├── filters/
218
+ │ │ ├── category.ts # Category filter
219
+ │ │ ├── size.ts # Size filter
220
+ │ │ ├── seeds.ts # Seeds filter
221
+ │ │ └── sort.ts # Sort functionality
222
+ │ ├── download/
223
+ │ │ └── engine.ts # WebTorrent download engine
224
+ │ └── types.ts # TypeScript interfaces
225
+ ├── sources.json # Source configurations
226
+ ├── filters.json # Default filters
227
+ └── package.json
228
+ ```
229
+
230
+ ## Requirements
231
+
232
+ - Node.js >= 18.0.0
233
+ - npm or yarn
234
+
235
+ ## Tech Stack
236
+
237
+ - **TypeScript** - Type-safe code
238
+ - **Commander.js** - CLI argument parsing
239
+ - **Axios + Cheerio** - HTTP requests and HTML parsing
240
+ - **WebTorrent** - Torrent downloading
241
+ - **cli-progress** - Rich progress bars
242
+ - **Chalk** - Terminal colors
243
+ - **Ora** - Loading spinners
244
+
245
+ ## License
246
+
247
+ MIT License - See [LICENSE](LICENSE) for details.
248
+
249
+ ## Disclaimer
250
+
251
+ This tool is for educational purposes. Always respect copyright laws and the terms of service of torrent sites. Download only content you have the right to access.
252
+
253
+ ---
254
+
255
+ <p align="center">Made with ❤️ for the CLI community</p>
package/bin/tordl.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ const { createParser } = require('../dist/cli/parser');
3
+
4
+ const program = createParser();
5
+ program.parse(process.argv);
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ const { createParser } = require('../cli/parser');
3
+
4
+ const program = createParser();
5
+ program.parse(process.argv);
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ const { createParser } = require('../cli/parser');
3
+
4
+ const program = createParser();
5
+ program.parse(process.argv);
@@ -0,0 +1,7 @@
1
+ import { TorrentResult } from '../types';
2
+ export declare function displayResults(results: TorrentResult[]): void;
3
+ export declare function displayResultDetails(result: TorrentResult): void;
4
+ export declare function displayError(message: string): void;
5
+ export declare function displaySuccess(message: string): void;
6
+ export declare function displayInfo(message: string): void;
7
+ //# sourceMappingURL=display.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/cli/display.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,IAAI,CA4B7D;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAYhE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAElD;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEpD;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEjD"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.displayResults = displayResults;
7
+ exports.displayResultDetails = displayResultDetails;
8
+ exports.displayError = displayError;
9
+ exports.displaySuccess = displaySuccess;
10
+ exports.displayInfo = displayInfo;
11
+ const chalk_1 = __importDefault(require("chalk"));
12
+ function displayResults(results) {
13
+ if (results.length === 0) {
14
+ console.log(chalk_1.default.yellow('No results found.'));
15
+ return;
16
+ }
17
+ const out = (s) => process.stdout.write(s + '\n');
18
+ out('\n' + [
19
+ '┌─────┬───────────────────────────────────────┬────────┬───────┬───────┬────────┐',
20
+ '│ Num │ Name │ Size │ Seeds │ Leech │ Source │',
21
+ '├─────┼───────────────────────────────────────┼────────┼───────┼───────┼────────┤'
22
+ ].join('\n'));
23
+ for (const r of results) {
24
+ const name = r.name.length > 38 ? r.name.substring(0, 35) + '...' : r.name;
25
+ const size = r.size ? r.size.slice(0, 6).padEnd(6) : 'N/A ';
26
+ const seeds = r.seeds.toString().padStart(5);
27
+ const peers = r.peers.toString().padStart(5);
28
+ const source = (r.source || 'unknown').slice(0, 6).padEnd(6);
29
+ const num = r.num.toString().padStart(3);
30
+ out(`│ ${num} │ ${name.padEnd(38)} │ ${size} │ ${seeds} │ ${peers} │ ${source} │`);
31
+ }
32
+ out('└─────┴───────────────────────────────────────┴────────┴───────┴───────┴────────┘');
33
+ out('');
34
+ out('To download: tordl <number>');
35
+ }
36
+ function displayResultDetails(result) {
37
+ console.log(chalk_1.default.bold('\n--- Torrent Details ---'));
38
+ console.log(chalk_1.default.white('Name: ') + result.name);
39
+ console.log(chalk_1.default.white('Size: ') + result.size);
40
+ console.log(chalk_1.default.white('Seeds: ') + chalk_1.default.green(result.seeds.toString()));
41
+ console.log(chalk_1.default.white('Peers: ') + result.peers.toString());
42
+ console.log(chalk_1.default.white('Source: ') + result.source);
43
+ console.log(chalk_1.default.white('URL: ') + result.url);
44
+ if (result.magnet) {
45
+ console.log(chalk_1.default.white('Magnet: ') + chalk_1.default.cyan(result.magnet.substring(0, 60) + '...'));
46
+ }
47
+ console.log(chalk_1.default.bold('----------------------\n'));
48
+ }
49
+ function displayError(message) {
50
+ console.error(chalk_1.default.red('Error: ') + message);
51
+ }
52
+ function displaySuccess(message) {
53
+ console.log(chalk_1.default.green('✓ ') + message);
54
+ }
55
+ function displayInfo(message) {
56
+ console.log(chalk_1.default.blue('ℹ ') + message);
57
+ }
58
+ //# sourceMappingURL=display.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display.js","sourceRoot":"","sources":["../../src/cli/display.ts"],"names":[],"mappings":";;;;;AAGA,wCA4BC;AAED,oDAYC;AAED,oCAEC;AAED,wCAEC;AAED,kCAEC;AAzDD,kDAA0B;AAG1B,SAAgB,cAAc,CAAC,OAAwB;IACrD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC;QAC/C,OAAO;IACT,CAAC;IAED,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAE1D,GAAG,CAAC,IAAI,GAAG;QACT,mFAAmF;QACnF,mFAAmF;QACnF,mFAAmF;KACpF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAEd,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC3E,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,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C,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;IAChE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IACtD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACnD,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,eAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAC7F,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,SAAgB,YAAY,CAAC,OAAe;IAC1C,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,CAAC;AAChD,CAAC;AAED,SAAgB,cAAc,CAAC,OAAe;IAC5C,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;AAC3C,CAAC;AAED,SAAgB,WAAW,CAAC,OAAe;IACzC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Command } from 'commander';
2
+ import { FilterConfig } from '../types';
3
+ export declare function loadFilters(): FilterConfig;
4
+ export declare function createParser(): Command;
5
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/cli/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,YAAY,EAAiB,MAAM,UAAU,CAAC;AAEvD,wBAAgB,WAAW,IAAI,YAAY,CAc1C;AAED,wBAAgB,YAAY,IAAI,OAAO,CA0EtC"}
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.loadFilters = loadFilters;
37
+ exports.createParser = createParser;
38
+ const commander_1 = require("commander");
39
+ const fs_1 = require("fs");
40
+ const path_1 = require("path");
41
+ function loadFilters() {
42
+ const filtersPath = (0, path_1.join)(process.cwd(), 'filters.json');
43
+ if ((0, fs_1.existsSync)(filtersPath)) {
44
+ return JSON.parse((0, fs_1.readFileSync)(filtersPath, 'utf-8'));
45
+ }
46
+ return {
47
+ category: 'all',
48
+ minSeeds: 0,
49
+ minSize: '0',
50
+ maxSize: '50GB',
51
+ sortBy: 'seeds',
52
+ order: 'desc',
53
+ limit: 50
54
+ };
55
+ }
56
+ function createParser() {
57
+ const program = new commander_1.Command();
58
+ program
59
+ .name('tordl')
60
+ .description('CLI torrent search and download tool')
61
+ .version('1.0.0')
62
+ .hook('preAction', (thisCommand) => {
63
+ if (thisCommand.name() === 'update') {
64
+ return;
65
+ }
66
+ });
67
+ program
68
+ .command('search <query>')
69
+ .description('Search for torrents')
70
+ .option('-c, --cat <category>', 'Category: all, movie, tv')
71
+ .option('-s, --min-seeds <number>', 'Minimum seeds', parseInt)
72
+ .option('--min-size <size>', 'Minimum size (e.g., 500MB, 1GB)')
73
+ .option('--max-size <size>', 'Maximum size (e.g., 5GB)')
74
+ .option('-o, --sort <sortBy>', 'Sort by: seeds, size, date')
75
+ .option('--order <order>', 'Order: asc, desc')
76
+ .option('-l, --limit <limit>', 'Result limit', parseInt)
77
+ .option('--sources <sources>', 'Comma-separated source names')
78
+ .action(async (query, options) => {
79
+ const filters = loadFilters();
80
+ const searchOptions = {
81
+ query,
82
+ category: options.cat || filters.category,
83
+ minSeeds: options.minSeeds ?? filters.minSeeds,
84
+ minSize: options.minSize || filters.minSize,
85
+ maxSize: options.maxSize || filters.maxSize,
86
+ sortBy: options.sort || filters.sortBy,
87
+ order: options.order || filters.order,
88
+ limit: options.limit || filters.limit,
89
+ sources: options.sources ? options.sources.split(',') : undefined
90
+ };
91
+ const { searchCommand } = await Promise.resolve().then(() => __importStar(require('../commands/search')));
92
+ await searchCommand(searchOptions);
93
+ });
94
+ program
95
+ .command('download <number>')
96
+ .description('Download a torrent by number from previous search')
97
+ .option('-p, --path <path>', 'Download path')
98
+ .action(async (number, options) => {
99
+ const { downloadCommand } = await Promise.resolve().then(() => __importStar(require('../commands/download')));
100
+ await downloadCommand(parseInt(number), options.path);
101
+ });
102
+ program
103
+ .command('update')
104
+ .description('Update sources from remote config')
105
+ .alias('u')
106
+ .action(async () => {
107
+ const { updateCommand } = await Promise.resolve().then(() => __importStar(require('../commands/update')));
108
+ await updateCommand();
109
+ });
110
+ program
111
+ .argument('<number>', 'Torrent number to download')
112
+ .action(async (number) => {
113
+ const { downloadCommand } = await Promise.resolve().then(() => __importStar(require('../commands/download')));
114
+ await downloadCommand(parseInt(number));
115
+ });
116
+ program.on('command:*', () => {
117
+ console.error('Invalid command: %s\nSee --help for a list of available commands.', program.args[0]);
118
+ process.exit(1);
119
+ });
120
+ return program;
121
+ }
122
+ //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/cli/parser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,kCAcC;AAED,oCA0EC;AA/FD,yCAAoC;AACpC,2BAA8C;AAC9C,+BAA4B;AAG5B,SAAgB,WAAW;IACzB,MAAM,WAAW,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC;IACxD,IAAI,IAAA,eAAU,EAAC,WAAW,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;IACxD,CAAC;IACD,OAAO;QACL,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,CAAC;QACX,OAAO,EAAE,GAAG;QACZ,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,OAAO;QACf,KAAK,EAAE,MAAM;QACb,KAAK,EAAE,EAAE;KACV,CAAC;AACJ,CAAC;AAED,SAAgB,YAAY;IAC1B,MAAM,OAAO,GAAG,IAAI,mBAAO,EA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AC,CAAC;IAEL,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;QAC3B,OAAO,CAAC,KAAK,CAAC,mEAAmE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACpG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,15 @@
1
+ export declare class DownloadProgress {
2
+ private bar;
3
+ private startTime;
4
+ private totalBytes;
5
+ private downloadedBytes;
6
+ constructor();
7
+ start(total: number): void;
8
+ update(downloaded: number, total: number): void;
9
+ private calculateSpeed;
10
+ private calculateETA;
11
+ private formatBytes;
12
+ stop(): void;
13
+ getTotalDownloaded(): number;
14
+ }
15
+ //# sourceMappingURL=progress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/cli/progress.ts"],"names":[],"mappings":"AAGA,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,GAAG,CAAwB;IACnC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,eAAe,CAAa;;IAcpC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAQ1B,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAe/C,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,WAAW;IAOnB,IAAI,IAAI,IAAI;IAIZ,kBAAkB,IAAI,MAAM;CAG7B"}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DownloadProgress = void 0;
7
+ const cli_progress_1 = __importDefault(require("cli-progress"));
8
+ class DownloadProgress {
9
+ constructor() {
10
+ this.totalBytes = 0;
11
+ this.downloadedBytes = 0;
12
+ this.startTime = Date.now();
13
+ this.bar = new cli_progress_1.default.SingleBar({
14
+ format: '[{bar}] {percentage}% | {speed} | ETA: {eta} | {downloaded}',
15
+ barCompleteChar: '\u2588',
16
+ barIncompleteChar: '\u2591',
17
+ hideCursor: true,
18
+ fps: 10,
19
+ etaAsynchronous: true
20
+ });
21
+ }
22
+ start(total) {
23
+ this.totalBytes = total;
24
+ this.bar.start(total, 0, {
25
+ speed: '0 B/s',
26
+ downloaded: '0 MB'
27
+ });
28
+ }
29
+ update(downloaded, total) {
30
+ this.downloadedBytes = downloaded;
31
+ this.totalBytes = total || this.totalBytes;
32
+ const speed = this.calculateSpeed();
33
+ const eta = this.calculateETA();
34
+ const downloadedMB = (this.downloadedBytes / (1024 * 1024)).toFixed(2);
35
+ this.bar.update(this.downloadedBytes, {
36
+ speed,
37
+ downloaded: `${downloadedMB} MB`,
38
+ eta
39
+ });
40
+ }
41
+ calculateSpeed() {
42
+ const elapsed = (Date.now() - this.startTime) / 1000;
43
+ const bytesPerSecond = elapsed > 0 ? this.downloadedBytes / elapsed : 0;
44
+ return this.formatBytes(bytesPerSecond) + '/s';
45
+ }
46
+ calculateETA() {
47
+ const elapsed = (Date.now() - this.startTime) / 1000;
48
+ if (this.downloadedBytes === 0 || this.totalBytes === 0)
49
+ return 'N/A';
50
+ const speed = this.downloadedBytes / elapsed;
51
+ const remaining = this.totalBytes - this.downloadedBytes;
52
+ const seconds = remaining / speed;
53
+ if (seconds < 60)
54
+ return `${Math.round(seconds)}s`;
55
+ if (seconds < 3600)
56
+ return `${Math.floor(seconds / 60)}m ${Math.round(seconds % 60)}s`;
57
+ return `${Math.floor(seconds / 3600)}h ${Math.floor((seconds % 3600) / 60)}m`;
58
+ }
59
+ formatBytes(bytes) {
60
+ if (bytes < 1024)
61
+ return bytes + ' B';
62
+ if (bytes < 1024 * 1024)
63
+ return (bytes / 1024).toFixed(2) + ' KB';
64
+ if (bytes < 1024 * 1024 * 1024)
65
+ return (bytes / (1024 * 1024)).toFixed(2) + ' MB';
66
+ return (bytes / (1024 * 1024 * 1024)).toFixed(2) + ' GB';
67
+ }
68
+ stop() {
69
+ this.bar.stop();
70
+ }
71
+ getTotalDownloaded() {
72
+ return this.downloadedBytes;
73
+ }
74
+ }
75
+ exports.DownloadProgress = DownloadProgress;
76
+ //# sourceMappingURL=progress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress.js","sourceRoot":"","sources":["../../src/cli/progress.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAuC;AAGvC,MAAa,gBAAgB;IAM3B;QAHQ,eAAU,GAAW,CAAC,CAAC;QACvB,oBAAe,GAAW,CAAC,CAAC;QAGlC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC5B,IAAI,CAAC,GAAG,GAAG,IAAI,sBAAW,CAAC,SAAS,CAAC;YACnC,MAAM,EAAE,6DAA6D;YACrE,eAAe,EAAE,QAAQ;YACzB,iBAAiB,EAAE,QAAQ;YAC3B,UAAU,EAAE,IAAI;YAChB,GAAG,EAAE,EAAE;YACP,eAAe,EAAE,IAAI;SACtB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,KAAa;QACjB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE;YACvB,KAAK,EAAE,OAAO;YACd,UAAU,EAAE,MAAM;SACnB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,UAAkB,EAAE,KAAa;QACtC,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,KAAK,IAAI,IAAI,CAAC,UAAU,CAAC;QAE3C,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QACpC,MAAM,GAAG,GAAG,IAAI,CAAC,Y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,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC;QACvF,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC;IAChF,CAAC;IAEO,WAAW,CAAC,KAAa;QAC/B,IAAI,KAAK,GAAG,IAAI;YAAE,OAAO,KAAK,GAAG,IAAI,CAAC;QACtC,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI;YAAE,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;QAClE,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI;YAAE,OAAO,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;QAClF,OAAO,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IAC3D,CAAC;IAED,IAAI;QACF,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;IAClB,CAAC;IAED,kBAAkB;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;CACF;AA1ED,4CA0EC"}
@@ -0,0 +1,2 @@
1
+ export declare function downloadCommand(number: number, savePath?: string): Promise<void>;
2
+ //# sourceMappingURL=download.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../src/commands/download.ts"],"names":[],"mappings":"AAIA,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BtF"}