tor-dl 1.0.2 → 1.0.3
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 +22 -180
- package/dist/cli/display.d.ts.map +1 -1
- package/dist/cli/display.js +9 -7
- package/dist/cli/display.js.map +1 -1
- package/dist/cli/parser.d.ts.map +1 -1
- package/dist/cli/parser.js +21 -27
- package/dist/cli/parser.js.map +1 -1
- package/dist/commands/download.d.ts +1 -1
- package/dist/commands/download.d.ts.map +1 -1
- package/dist/commands/download.js +55 -49
- package/dist/commands/download.js.map +1 -1
- package/dist/download/engine.d.ts +1 -3
- package/dist/download/engine.d.ts.map +1 -1
- package/dist/download/engine.js +0 -129
- package/dist/download/engine.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/sources/nyaa.d.ts.map +1 -1
- package/dist/sources/nyaa.js +3 -0
- package/dist/sources/nyaa.js.map +1 -1
- package/dist/sources/thepiratebay.d.ts.map +1 -1
- package/dist/sources/thepiratebay.js +1 -0
- package/dist/sources/thepiratebay.js.map +1 -1
- package/dist/sources/yts.d.ts.map +1 -1
- package/dist/sources/yts.js +1 -0
- package/dist/sources/yts.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -5
- package/src/cli/display.ts +10 -7
- package/src/cli/parser.ts +23 -30
- package/src/commands/download.ts +48 -15
- package/src/commands/search.ts +52 -52
- package/src/download/engine.ts +1 -144
- package/src/index.ts +0 -1
- package/src/sources/nyaa.ts +3 -0
- package/src/sources/thepiratebay.ts +1 -0
- package/src/sources/yts.ts +1 -0
- package/src/types.ts +1 -0
- package/src/cli/progress.ts +0 -78
package/dist/download/engine.js
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.cacheResults = cacheResults;
|
|
7
4
|
exports.getCachedResults = getCachedResults;
|
|
8
|
-
exports.downloadTorrent = downloadTorrent;
|
|
9
|
-
exports.downloadByNumber = downloadByNumber;
|
|
10
|
-
const webtorrent_1 = __importDefault(require("webtorrent"));
|
|
11
|
-
const progress_1 = require("../cli/progress");
|
|
12
|
-
const axios_1 = __importDefault(require("axios"));
|
|
13
5
|
const fs_1 = require("fs");
|
|
14
6
|
const path_1 = require("path");
|
|
15
7
|
const CACHE_FILE = (0, path_1.join)(process.cwd(), '.torrent-cache.json');
|
|
@@ -39,125 +31,4 @@ function getCachedResults() {
|
|
|
39
31
|
}
|
|
40
32
|
return cachedResults;
|
|
41
33
|
}
|
|
42
|
-
async function downloadTorrent(result, options = {}) {
|
|
43
|
-
const client = new webtorrent_1.default();
|
|
44
|
-
const progress = new progress_1.DownloadProgress();
|
|
45
|
-
const savePath = options.savePath || process.cwd();
|
|
46
|
-
let torrentId;
|
|
47
|
-
if (result.magnet && result.magnet.startsWith('magnet:')) {
|
|
48
|
-
torrentId = result.magnet;
|
|
49
|
-
}
|
|
50
|
-
else if (result.url && result.url.includes('magnet:')) {
|
|
51
|
-
torrentId = result.url;
|
|
52
|
-
}
|
|
53
|
-
else if (result.url && result.url.includes('nyaa.si')) {
|
|
54
|
-
console.log('Fetching magnet link from Nyaa...');
|
|
55
|
-
const magnet = await getMagnetFromResult(result);
|
|
56
|
-
if (magnet) {
|
|
57
|
-
torrentId = magnet;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
throw new Error('Could not get magnet link from Nyaa page');
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
console.log('Fetching torrent file...');
|
|
65
|
-
const torrentUrl = await getTorrentUrl(result);
|
|
66
|
-
if (torrentUrl) {
|
|
67
|
-
const response = await axios_1.default.get(torrentUrl, { responseType: 'arraybuffer' });
|
|
68
|
-
const tempFile = (0, path_1.join)(savePath, 'temp.torrent');
|
|
69
|
-
(0, fs_1.writeFileSync)(tempFile, response.data);
|
|
70
|
-
torrentId = tempFile;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
throw new Error('Could not get torrent URL');
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
console.log(`\nDownloading: ${result.name}`);
|
|
77
|
-
console.log(`Saving to: ${savePath}\n`);
|
|
78
|
-
return new Promise((resolve, reject) => {
|
|
79
|
-
console.log('Adding torrent to client...');
|
|
80
|
-
console.log('Torrent ID:', torrentId.substring(0, 60) + '...');
|
|
81
|
-
const torrent = client.add(torrentId, {
|
|
82
|
-
path: savePath
|
|
83
|
-
});
|
|
84
|
-
torrent.on('warning', (warn) => {
|
|
85
|
-
console.log('Torrent warning:', warn.message);
|
|
86
|
-
});
|
|
87
|
-
torrent.on('peer', (peer) => {
|
|
88
|
-
console.log('New peer connected:', peer);
|
|
89
|
-
});
|
|
90
|
-
console.log('Torrent added, waiting for ready...');
|
|
91
|
-
torrent.on('ready', () => {
|
|
92
|
-
const total = torrent.length;
|
|
93
|
-
console.log(`✓ Torrent ready! Total size: ${(total / (1024 * 1024)).toFixed(2)} MB`);
|
|
94
|
-
console.log(` Files: ${torrent.files.map(f => f.name).join(', ')}`);
|
|
95
|
-
console.log(` Info hash: ${torrent.infoHash}`);
|
|
96
|
-
progress.start(total);
|
|
97
|
-
torrent.on('download', (bytes) => {
|
|
98
|
-
const percent = ((torrent.downloaded / total) * 100).toFixed(1);
|
|
99
|
-
process.stdout.write(`\rDownloading: ${percent}% (${(torrent.downloaded / 1024 / 1024).toFixed(1)} MB / ${(total / 1024 / 1024).toFixed(1)} MB) - ${torrent.peers.length} peers `);
|
|
100
|
-
progress.update(torrent.downloaded, total);
|
|
101
|
-
});
|
|
102
|
-
torrent.on('done', () => {
|
|
103
|
-
progress.stop();
|
|
104
|
-
console.log('\n\n✓ Download complete!');
|
|
105
|
-
console.log(`Downloaded to: ${savePath}`);
|
|
106
|
-
client.destroy();
|
|
107
|
-
resolve();
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
torrent.on('error', (err) => {
|
|
111
|
-
console.error('\nDownload error:', err.message);
|
|
112
|
-
client.destroy();
|
|
113
|
-
reject(err);
|
|
114
|
-
});
|
|
115
|
-
setTimeout(() => {
|
|
116
|
-
console.log('\n\nDebug:');
|
|
117
|
-
console.log(' Downloaded:', torrent.downloaded);
|
|
118
|
-
console.log(' Length:', torrent.length);
|
|
119
|
-
console.log(' Peers:', torrent.peers?.length || 0);
|
|
120
|
-
console.log(' Done:', torrent.done);
|
|
121
|
-
if (torrent.downloaded > 0) {
|
|
122
|
-
console.log('\nDownload in progress but taking long...');
|
|
123
|
-
console.log(`Progress: ${(torrent.downloaded / torrent.length * 100).toFixed(1)}%`);
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
console.log('\nNo progress after 60s - may be stuck or no peers');
|
|
127
|
-
}
|
|
128
|
-
}, 60000);
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
async function getTorrentUrl(result) {
|
|
132
|
-
if (result.magnet && result.magnet.startsWith('magnet:')) {
|
|
133
|
-
return result.magnet;
|
|
134
|
-
}
|
|
135
|
-
return result.url;
|
|
136
|
-
}
|
|
137
|
-
async function getMagnetFromResult(result) {
|
|
138
|
-
if (result.magnet)
|
|
139
|
-
return result.magnet;
|
|
140
|
-
if (!result.url)
|
|
141
|
-
return '';
|
|
142
|
-
try {
|
|
143
|
-
const { data } = await axios_1.default.get(result.url, { timeout: 15000 });
|
|
144
|
-
const cheerio = require('cheerio');
|
|
145
|
-
const $ = cheerio.load(data);
|
|
146
|
-
return $('a[href^="magnet:"]').attr('href') || '';
|
|
147
|
-
}
|
|
148
|
-
catch {
|
|
149
|
-
return '';
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
async function downloadByNumber(number, savePath) {
|
|
153
|
-
const results = getCachedResults();
|
|
154
|
-
if (results.length === 0) {
|
|
155
|
-
throw new Error('No search results. Run "tor-dl search" first.');
|
|
156
|
-
}
|
|
157
|
-
if (number < 1 || number > results.length) {
|
|
158
|
-
throw new Error(`Invalid number. Choose between 1 and ${results.length}`);
|
|
159
|
-
}
|
|
160
|
-
const result = results[number - 1];
|
|
161
|
-
await downloadTorrent(result, { savePath });
|
|
162
|
-
}
|
|
163
34
|
//# sourceMappingURL=engine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/download/engine.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/download/engine.ts"],"names":[],"mappings":";;AAuBA,oCAGC;AAED,4CAKC;AAhCD,2BAA6D;AAC7D,+BAA4B;AAE5B,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,qBAAqB,CAAC,CAAC;AAE9D,SAAS,SAAS,CAAC,OAAwB;IACzC,IAAI,CAAC;QACH,IAAA,kBAAa,EAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,SAAS;IAChB,IAAI,CAAC;QACH,IAAI,IAAA,eAAU,EAAC,UAAU,CAAC,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC;IAC5B,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,IAAI,aAAa,GAAoB,EAAE,CAAC;AAExC,SAAgB,YAAY,CAAC,OAAwB;IACnD,aAAa,GAAG,OAAO,CAAC;IACxB,SAAS,CAAC,OAAO,CAAC,CAAC;AACrB,CAAC;AAED,SAAgB,gBAAgB;IAC9B,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/B,aAAa,GAAG,SAAS,EAAE,CAAC;IAC9B,CAAC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACzD,cAAc,eAAe,CAAC;AAC9B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACzD,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,6 @@ var parser_1 = require("./cli/parser");
|
|
|
20
20
|
Object.defineProperty(exports, "createParser", { enumerable: true, get: function () { return parser_1.createParser; } });
|
|
21
21
|
Object.defineProperty(exports, "loadFilters", { enumerable: true, get: function () { return parser_1.loadFilters; } });
|
|
22
22
|
__exportStar(require("./cli/display"), exports);
|
|
23
|
-
__exportStar(require("./cli/progress"), exports);
|
|
24
23
|
__exportStar(require("./sources/registry"), exports);
|
|
25
24
|
__exportStar(require("./filters"), exports);
|
|
26
25
|
__exportStar(require("./download/engine"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,uCAAyD;AAAhD,sGAAA,YAAY,OAAA;AAAE,qGAAA,WAAW,OAAA;AAClC,gDAA8B;AAC9B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,uCAAyD;AAAhD,sGAAA,YAAY,OAAA;AAAE,qGAAA,WAAW,OAAA;AAClC,gDAA8B;AAC9B,qDAAmC;AACnC,4CAA0B;AAC1B,oDAAkC;AAClC,oDAAkC;AAClC,sDAAoC;AACpC,oDAAkC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nyaa.d.ts","sourceRoot":"","sources":["../../src/sources/nyaa.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGxD,qBAAa,WAAY,YAAW,aAAa;IAC/C,IAAI,SAAU;IAER,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"nyaa.d.ts","sourceRoot":"","sources":["../../src/sources/nyaa.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGxD,qBAAa,WAAY,YAAW,aAAa;IAC/C,IAAI,SAAU;IAER,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAuDlE,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAIrD,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAUvD,OAAO,CAAC,SAAS;CAQlB;;AAED,wBAAiC"}
|
package/dist/sources/nyaa.js
CHANGED
|
@@ -70,6 +70,8 @@ class NyaaScraper {
|
|
|
70
70
|
const seeds = parseInt($(el).find('td:nth-child(6)').text().trim()) || 0;
|
|
71
71
|
const peers = parseInt($(el).find('td:nth-child(7)').text().trim()) || 0;
|
|
72
72
|
if (title && title.length > 3) {
|
|
73
|
+
const idMatch = link.match(/\/view\/(\d+)/);
|
|
74
|
+
const torrentUrl = idMatch ? `https://nyaa.si/download/${idMatch[1]}.torrent` : '';
|
|
73
75
|
results.push({
|
|
74
76
|
num: results.length + 1,
|
|
75
77
|
name: title,
|
|
@@ -79,6 +81,7 @@ class NyaaScraper {
|
|
|
79
81
|
peers,
|
|
80
82
|
source: 'Nyaa',
|
|
81
83
|
url: link,
|
|
84
|
+
torrentUrl,
|
|
82
85
|
magnet: ''
|
|
83
86
|
});
|
|
84
87
|
}
|
package/dist/sources/nyaa.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nyaa.js","sourceRoot":"","sources":["../../src/sources/nyaa.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,iDAAmC;AAEnC,6CAAwD;AAExD,MAAa,WAAW;IAAxB;QACE,SAAI,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"nyaa.js","sourceRoot":"","sources":["../../src/sources/nyaa.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,iDAAmC;AAEnC,6CAAwD;AAExD,MAAa,WAAW;IAAxB;QACE,SAAI,GAAG,MAAM,CAAC;IA+EhB,CAAC;IA7EC,KAAK,CAAC,MAAM,CAAC,KAAa,EAAE,QAAiB;QAC3C,IAAI,CAAC;YACH,MAAM,MAAM,GAA2B;gBACrC,KAAK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a,EAAE,MAAM,UAAU,CAAC;AAOxD,qBAAa,mBAAoB,YAAW,aAAa;IACvD,IAAI,SAAkB;IAEhB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"thepiratebay.d.ts","sourceRoot":"","sources":["../../src/sources/thepiratebay.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAOxD,qBAAa,mBAAoB,YAAW,aAAa;IACvD,IAAI,SAAkB;IAEhB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAmClE,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAIrD,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAIvD,OAAO,CAAC,UAAU;CASnB;;AAED,wBAAyC"}
|
|
@@ -31,6 +31,7 @@ class ThePirateBayScraper {
|
|
|
31
31
|
peers: parseInt(item.leechers) || 0,
|
|
32
32
|
source: 'ThePirateBay',
|
|
33
33
|
url: `https://thepiratebay.org/torrent/${item.id}`,
|
|
34
|
+
torrentUrl: `magnet:?xt=urn:btih:${item.info_hash}`,
|
|
34
35
|
magnet: `magnet:?xt=urn:btih:${item.info_hash}`,
|
|
35
36
|
hash: item.info_hash
|
|
36
37
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thepiratebay.js","sourceRoot":"","sources":["../../src/sources/thepiratebay.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,6CAAwD;AAExD,MAAM,OAAO,GAAG,0BAA0B,CAAC;AAE3C,MAAM,OAAO,GAA2B,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,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AAI,EAAE,IAAI,CAAC;YAAE,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;QAC1C,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC,IAAI,IAAE,CAAC,CAAC,CAAC;QAC7B,IAAI,EAAE,IAAI,CAAC;YAAE,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;QAC1C,MAAM,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC;QACxB,IAAI,EAAE,IAAI,CAAC;YAAE,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;QAC1C,OAAO,GAAG,KAAK,IAAI,CAAC;IACtB,CAAC;CACF;AAvDD,kDAuDC;AAED,kBAAe,IAAI,mBAAmB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yts.d.ts","sourceRoot":"","sources":["../../src/sources/yts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGxD,qBAAa,UAAW,YAAW,aAAa;IAC9C,IAAI,SAAS;IAEP,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"yts.d.ts","sourceRoot":"","sources":["../../src/sources/yts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGxD,qBAAa,UAAW,YAAW,aAAa;IAC9C,IAAI,SAAS;IAEP,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IA2ClE,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAIrD,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAIvD,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,UAAU;CASnB;;AAED,wBAAgC"}
|
package/dist/sources/yts.js
CHANGED
|
@@ -35,6 +35,7 @@ class YtsScraper {
|
|
|
35
35
|
peers: movie.torrents?.[0]?.peers || 0,
|
|
36
36
|
source: 'YTS',
|
|
37
37
|
url: movie.torrents?.[0]?.url || '',
|
|
38
|
+
torrentUrl: movie.torrents?.[0]?.url || '',
|
|
38
39
|
magnet: movie.torrents?.[0]?.hash ? `magnet:?xt=urn:btih:${movie.torrents[0].hash}` : '',
|
|
39
40
|
hash: movie.torrents?.[0]?.hash
|
|
40
41
|
});
|
package/dist/sources/yts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yts.js","sourceRoot":"","sources":["../../src/sources/yts.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,6CAAmD;AAEnD,MAAa,UAAU;IAAvB;QACE,SAAI,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"yts.js","sourceRoot":"","sources":["../../src/sources/yts.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,6CAAmD;AAEnD,MAAa,UAAU;IAAvB;QACE,SAAI,GAAG,KAAK,CAAC;IA6Ef,CAAC;IA3EC,KAAK,CAAC,MAAM,CAAC,KAAa,EAAE,QAAiB;QAC3C,IAAI,QAAQ,IAAI,QAAQ,CAAC,WAAW,EAAE,KAAK,IAAI,EAAE,CAAC;YAChD,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,qDAAqD,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC;YACtG,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,GAAG,EAAE;gBACpC,OAAO,EAAE,IAAA,uBAAU,GAAE;gBACrB,OAAO,EAAE,oBAAO;aACjB,CAAC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,KAAK,GAAG,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACnC,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IACnE,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACtD,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACnD"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tor-dl",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "CLI torrent search
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "CLI torrent search tool - search, open in browser, copy magnet links",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"tor-dl": "dist/bin/tor-dl.js"
|
|
@@ -14,10 +14,8 @@
|
|
|
14
14
|
"axios": "^1.6.0",
|
|
15
15
|
"chalk": "^4.1.2",
|
|
16
16
|
"cheerio": "^1.0.0-rc.12",
|
|
17
|
-
"cli-progress": "^3.12.0",
|
|
18
17
|
"commander": "^11.1.0",
|
|
19
|
-
"ora": "^6.3.1"
|
|
20
|
-
"webtorrent": "^1.9.7"
|
|
18
|
+
"ora": "^6.3.1"
|
|
21
19
|
},
|
|
22
20
|
"devDependencies": {
|
|
23
21
|
"@types/node": "^20.10.0",
|
package/src/cli/display.ts
CHANGED
|
@@ -9,12 +9,14 @@ export function displayResults(results: TorrentResult[]): void {
|
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
console.log(chalk.gray('\nTip: "tor-dl o <number>" to open .torrent or copy magnet link\n'));
|
|
13
|
+
|
|
12
14
|
const out = (s: string) => process.stdout.write(s + '\n');
|
|
13
15
|
|
|
14
16
|
out('\n' + [
|
|
15
|
-
'
|
|
16
|
-
'│ Num │ Name │ Size │ Seeds │ Leech │ Source │',
|
|
17
|
-
'
|
|
17
|
+
'┌─────┬───┬────────────────────────────────────────┬────────┬───────┬───────┬────────┐',
|
|
18
|
+
'│ Num │ L │ Name │ Size │ Seeds │ Leech │ Source │',
|
|
19
|
+
'├─────┼───┼────────────────────────────────────────┼────────┼───────┼───────┼────────┤'
|
|
18
20
|
].join('\n'));
|
|
19
21
|
|
|
20
22
|
for (const r of results) {
|
|
@@ -24,14 +26,15 @@ export function displayResults(results: TorrentResult[]): void {
|
|
|
24
26
|
const peers = r.peers > 50 ? chalk.cyan(r.peers.toString().padStart(5)) : r.peers.toString().padStart(5);
|
|
25
27
|
const source = (r.source || 'unknown').slice(0, 6).padEnd(6);
|
|
26
28
|
const num = chalk.cyan(r.num.toString().padStart(3));
|
|
29
|
+
const link = r.torrentUrl || r.magnet ? chalk.green('✓') : ' ';
|
|
27
30
|
|
|
28
|
-
out(`│ ${num} │ ${name.padEnd(38)} │ ${size} │ ${seeds} │ ${peers} │ ${source} │`);
|
|
31
|
+
out(`│ ${num} │ ${link} │ ${name.padEnd(38)} │ ${size} │ ${seeds} │ ${peers} │ ${source} │`);
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
out('
|
|
32
|
-
out('
|
|
34
|
+
out('├─────┼───┼────────────────────────────────────────┼────────┼───────┼───────┼────────┤');
|
|
35
|
+
out('└─────┴───┴────────────────────────────────────────┴────────┴───────┴───────┴────────┘');
|
|
33
36
|
out('');
|
|
34
|
-
out('
|
|
37
|
+
out(chalk.gray('Use: tor-dl o <number> to open in browser or copy magnet link'));
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
export function displayResultDetails(result: TorrentResult): void {
|
package/src/cli/parser.ts
CHANGED
|
@@ -3,6 +3,15 @@ import { readFileSync, existsSync } from 'fs';
|
|
|
3
3
|
import { join } from 'path';
|
|
4
4
|
import { FilterConfig, SearchOptions } from '../types';
|
|
5
5
|
|
|
6
|
+
function getVersion(): string {
|
|
7
|
+
try {
|
|
8
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, '../../package.json'), 'utf-8'));
|
|
9
|
+
return pkg.version || '1.0.0';
|
|
10
|
+
} catch {
|
|
11
|
+
return '1.0.0';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
6
15
|
export function loadFilters(): FilterConfig {
|
|
7
16
|
const filtersPath = join(process.cwd(), 'filters.json');
|
|
8
17
|
if (existsSync(filtersPath)) {
|
|
@@ -24,13 +33,8 @@ export function createParser(): Command {
|
|
|
24
33
|
|
|
25
34
|
program
|
|
26
35
|
.name('tor-dl')
|
|
27
|
-
.description('CLI torrent search
|
|
28
|
-
.version('
|
|
29
|
-
.hook('preAction', (thisCommand) => {
|
|
30
|
-
if (thisCommand.name() === 'update') {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
36
|
+
.description('CLI torrent search tool - search, open in browser, copy magnet links')
|
|
37
|
+
.version(getVersion(), '-v, --version');
|
|
34
38
|
|
|
35
39
|
program
|
|
36
40
|
.command('search <query>')
|
|
@@ -62,30 +66,19 @@ export function createParser(): Command {
|
|
|
62
66
|
await searchCommand(searchOptions);
|
|
63
67
|
});
|
|
64
68
|
|
|
65
|
-
program
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
await downloadCommand(parseInt(number), options.path);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
program
|
|
75
|
-
.command('update')
|
|
76
|
-
.description('Update sources from remote config')
|
|
77
|
-
.alias('u')
|
|
78
|
-
.action(async () => {
|
|
79
|
-
const { updateCommand } = await import('../commands/update');
|
|
80
|
-
await updateCommand();
|
|
81
|
-
});
|
|
69
|
+
const openCmd = program.command('open <number>', { hidden: true });
|
|
70
|
+
openCmd.description('Open .torrent in browser or copy magnet to clipboard');
|
|
71
|
+
openCmd.action(async (number: string) => {
|
|
72
|
+
const { openInBrowser } = await import('../commands/download');
|
|
73
|
+
await openInBrowser(parseInt(number));
|
|
74
|
+
});
|
|
82
75
|
|
|
83
|
-
program
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
76
|
+
const oCmd = program.command('o <number>');
|
|
77
|
+
oCmd.description('Open .torrent in browser or copy magnet to clipboard');
|
|
78
|
+
oCmd.action(async (number: string) => {
|
|
79
|
+
const { openInBrowser } = await import('../commands/download');
|
|
80
|
+
await openInBrowser(parseInt(number));
|
|
81
|
+
});
|
|
89
82
|
|
|
90
83
|
program.on('command:*', () => {
|
|
91
84
|
console.error('Invalid command: %s\nSee --help for a list of available commands.', program.args[0]);
|
package/src/commands/download.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { displayError, displaySuccess, displayInfo } from '../cli/display';
|
|
2
2
|
import { getCachedResults } from '../download/engine';
|
|
3
|
-
import
|
|
3
|
+
import { exec, execSync } from 'child_process';
|
|
4
|
+
import chalk from 'chalk';
|
|
4
5
|
|
|
5
|
-
export async function
|
|
6
|
+
export async function openInBrowser(number: number): Promise<void> {
|
|
6
7
|
const results = getCachedResults();
|
|
7
8
|
|
|
8
9
|
if (results.length === 0) {
|
|
@@ -17,20 +18,52 @@ export async function downloadCommand(number: number, savePath?: string): Promis
|
|
|
17
18
|
|
|
18
19
|
const result = results[number - 1];
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
if (!result.torrentUrl && !result.magnet) {
|
|
22
|
+
displayError('No .torrent URL or magnet available for this result.');
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
24
25
|
|
|
25
|
-
const
|
|
26
|
+
const url = result.torrentUrl || result.magnet || '';
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
if (url.startsWith('magnet:')) {
|
|
29
|
+
try {
|
|
30
|
+
if (process.platform === 'win32') {
|
|
31
|
+
execSync(`echo ${url} | clip`, { stdio: 'ignore' });
|
|
32
|
+
} else if (process.platform === 'darwin') {
|
|
33
|
+
execSync(`echo "${url}" | pbcopy`, { stdio: 'ignore' });
|
|
34
|
+
} else {
|
|
35
|
+
execSync(`echo "${url}" | xclip -selection clipboard`, { stdio: 'ignore' });
|
|
36
|
+
}
|
|
37
|
+
displaySuccess('Magnet link copied to clipboard!');
|
|
38
|
+
console.log(chalk.gray(url));
|
|
39
|
+
} catch {
|
|
40
|
+
displayInfo('Magnet link:');
|
|
41
|
+
console.log(chalk.cyan(url));
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
displayInfo('Opening: ' + url);
|
|
45
|
+
const cmd = process.platform === 'win32' ? `start "" "${url}"` :
|
|
46
|
+
process.platform === 'darwin' ? `open "${url}"` :
|
|
47
|
+
`xdg-open "${url}"`;
|
|
48
|
+
|
|
49
|
+
exec(cmd, (err) => {
|
|
50
|
+
if (err) {
|
|
51
|
+
try {
|
|
52
|
+
if (process.platform === 'win32') {
|
|
53
|
+
execSync(`echo ${url} | clip`, { stdio: 'ignore' });
|
|
54
|
+
} else if (process.platform === 'darwin') {
|
|
55
|
+
execSync(`echo "${url}" | pbcopy`, { stdio: 'ignore' });
|
|
56
|
+
} else {
|
|
57
|
+
execSync(`echo "${url}" | xclip -selection clipboard`, { stdio: 'ignore' });
|
|
58
|
+
}
|
|
59
|
+
displaySuccess('URL copied to clipboard!');
|
|
60
|
+
} catch {
|
|
61
|
+
displayError('Failed to open. Copy this URL manually:');
|
|
62
|
+
console.log(chalk.cyan(url));
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
displaySuccess('Opened in browser');
|
|
66
|
+
}
|
|
67
|
+
});
|
|
35
68
|
}
|
|
36
69
|
}
|