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.
- package/AGENTS.md +53 -0
- package/README.md +255 -0
- package/bin/tordl.js +5 -0
- package/dist/bin/tordl.js +5 -0
- package/dist/bin/torrent-cli.js +5 -0
- package/dist/cli/display.d.ts +7 -0
- package/dist/cli/display.d.ts.map +1 -0
- package/dist/cli/display.js +58 -0
- package/dist/cli/display.js.map +1 -0
- package/dist/cli/parser.d.ts +5 -0
- package/dist/cli/parser.d.ts.map +1 -0
- package/dist/cli/parser.js +122 -0
- package/dist/cli/parser.js.map +1 -0
- package/dist/cli/progress.d.ts +15 -0
- package/dist/cli/progress.d.ts.map +1 -0
- package/dist/cli/progress.js +76 -0
- package/dist/cli/progress.js.map +1 -0
- package/dist/commands/download.d.ts +2 -0
- package/dist/commands/download.d.ts.map +1 -0
- package/dist/commands/download.js +70 -0
- package/dist/commands/download.js.map +1 -0
- package/dist/commands/search.d.ts +3 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +46 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/update.d.ts +2 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +32 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/download/engine.d.ts +6 -0
- package/dist/download/engine.d.ts.map +1 -0
- package/dist/download/engine.js +163 -0
- package/dist/download/engine.js.map +1 -0
- package/dist/filters/category.d.ts +3 -0
- package/dist/filters/category.d.ts.map +1 -0
- package/dist/filters/category.js +24 -0
- package/dist/filters/category.js.map +1 -0
- package/dist/filters/index.d.ts +5 -0
- package/dist/filters/index.d.ts.map +1 -0
- package/dist/filters/index.js +13 -0
- package/dist/filters/index.js.map +1 -0
- package/dist/filters/seeds.d.ts +3 -0
- package/dist/filters/seeds.d.ts.map +1 -0
- package/dist/filters/seeds.js +7 -0
- package/dist/filters/seeds.js.map +1 -0
- package/dist/filters/size.d.ts +4 -0
- package/dist/filters/size.d.ts.map +1 -0
- package/dist/filters/size.js +36 -0
- package/dist/filters/size.js.map +1 -0
- package/dist/filters/sort.d.ts +5 -0
- package/dist/filters/sort.d.ts.map +1 -0
- package/dist/filters/sort.js +25 -0
- package/dist/filters/sort.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/sources/1337x.d.ts +11 -0
- package/dist/sources/1337x.d.ts.map +1 -0
- package/dist/sources/1337x.js +121 -0
- package/dist/sources/1337x.js.map +1 -0
- package/dist/sources/eztv.d.ts +11 -0
- package/dist/sources/eztv.d.ts.map +1 -0
- package/dist/sources/eztv.js +104 -0
- package/dist/sources/eztv.js.map +1 -0
- package/dist/sources/httpClient.d.ts +24 -0
- package/dist/sources/httpClient.d.ts.map +1 -0
- package/dist/sources/httpClient.js +42 -0
- package/dist/sources/httpClient.js.map +1 -0
- package/dist/sources/limetorrent.d.ts +11 -0
- package/dist/sources/limetorrent.d.ts.map +1 -0
- package/dist/sources/limetorrent.js +113 -0
- package/dist/sources/limetorrent.js.map +1 -0
- package/dist/sources/nyaa.d.ts +11 -0
- package/dist/sources/nyaa.d.ts.map +1 -0
- package/dist/sources/nyaa.js +119 -0
- package/dist/sources/nyaa.js.map +1 -0
- package/dist/sources/rarbg.d.ts +11 -0
- package/dist/sources/rarbg.d.ts.map +1 -0
- package/dist/sources/rarbg.js +122 -0
- package/dist/sources/rarbg.js.map +1 -0
- package/dist/sources/registry.d.ts +9 -0
- package/dist/sources/registry.d.ts.map +1 -0
- package/dist/sources/registry.js +70 -0
- package/dist/sources/registry.js.map +1 -0
- package/dist/sources/solidtorrents.d.ts +11 -0
- package/dist/sources/solidtorrents.d.ts.map +1 -0
- package/dist/sources/solidtorrents.js +105 -0
- package/dist/sources/solidtorrents.js.map +1 -0
- package/dist/sources/thepiratebay.d.ts +11 -0
- package/dist/sources/thepiratebay.d.ts.map +1 -0
- package/dist/sources/thepiratebay.js +67 -0
- package/dist/sources/thepiratebay.js.map +1 -0
- package/dist/sources/torlock.d.ts +11 -0
- package/dist/sources/torlock.d.ts.map +1 -0
- package/dist/sources/torlock.js +116 -0
- package/dist/sources/torlock.js.map +1 -0
- package/dist/sources/torrentproject.d.ts +11 -0
- package/dist/sources/torrentproject.d.ts.map +1 -0
- package/dist/sources/torrentproject.js +105 -0
- package/dist/sources/torrentproject.js.map +1 -0
- package/dist/sources/torrentscsv.d.ts +11 -0
- package/dist/sources/torrentscsv.d.ts.map +1 -0
- package/dist/sources/torrentscsv.js +62 -0
- package/dist/sources/torrentscsv.js.map +1 -0
- package/dist/sources/yts.d.ts +12 -0
- package/dist/sources/yts.d.ts.map +1 -0
- package/dist/sources/yts.js +88 -0
- package/dist/sources/yts.js.map +1 -0
- package/dist/types.d.ts +60 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/filters.json +9 -0
- package/package.json +37 -0
- package/sources.json +105 -0
- package/src/cli/display.ts +58 -0
- package/src/cli/parser.ts +96 -0
- package/src/cli/progress.ts +78 -0
- package/src/commands/download.ts +36 -0
- package/src/commands/search.ts +53 -0
- package/src/commands/update.ts +30 -0
- package/src/download/engine.ts +177 -0
- package/src/filters/category.ts +26 -0
- package/src/filters/index.ts +4 -0
- package/src/filters/seeds.ts +5 -0
- package/src/filters/size.ts +42 -0
- package/src/filters/sort.ts +34 -0
- package/src/index.ts +10 -0
- package/src/sources/1337x.ts +85 -0
- package/src/sources/eztv.ts +70 -0
- package/src/sources/httpClient.ts +39 -0
- package/src/sources/limetorrent.ts +78 -0
- package/src/sources/nyaa.ts +85 -0
- package/src/sources/rarbg.ts +86 -0
- package/src/sources/registry.ts +70 -0
- package/src/sources/solidtorrents.ts +70 -0
- package/src/sources/thepiratebay.ts +65 -0
- package/src/sources/torlock.ts +82 -0
- package/src/sources/torrentproject.ts +70 -0
- package/src/sources/torrentscsv.ts +58 -0
- package/src/sources/yts.ts +85 -0
- package/src/types.d.ts +86 -0
- package/src/types.ts +65 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import * as cheerio from 'cheerio';
|
|
3
|
+
import { TorrentResult, SourceScraper } from '../types';
|
|
4
|
+
import { DEFAULT_HEADERS, TIMEOUT } from './httpClient';
|
|
5
|
+
|
|
6
|
+
export class TorrentProjectScraper implements SourceScraper {
|
|
7
|
+
name = 'TorrentProject';
|
|
8
|
+
|
|
9
|
+
async search(query: string, category?: string): Promise<TorrentResult[]> {
|
|
10
|
+
try {
|
|
11
|
+
const url = `https://torrentproject.site/?s=${encodeURIComponent(query)}&p=1`;
|
|
12
|
+
const { data } = await axios.get(url, {
|
|
13
|
+
headers: DEFAULT_HEADERS,
|
|
14
|
+
timeout: TIMEOUT
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const $ = cheerio.load(data);
|
|
18
|
+
const results: TorrentResult[] = [];
|
|
19
|
+
|
|
20
|
+
$('div.torrent_row, div.torrents__torrent').each((i, el) => {
|
|
21
|
+
const title = $(el).find('a.title').text().trim() || $(el).find('a').first().text().trim();
|
|
22
|
+
const size = $(el).find('span.size, div.size').text().trim();
|
|
23
|
+
const seeds = parseInt($(el).find('span.seeders, div.seeds').text().trim()) || 0;
|
|
24
|
+
const peers = parseInt($(el).find('span.leechers, div.leechs').text().trim()) || 0;
|
|
25
|
+
const link = $(el).find('a.title').attr('href') || $(el).find('a').first().attr('href') || '';
|
|
26
|
+
const magnet = $(el).find('a[href^="magnet:"]').attr('href');
|
|
27
|
+
|
|
28
|
+
if (title && link) {
|
|
29
|
+
results.push({
|
|
30
|
+
num: results.length + 1,
|
|
31
|
+
name: title,
|
|
32
|
+
size: size || 'Unknown',
|
|
33
|
+
sizeBytes: this.parseSize(size),
|
|
34
|
+
seeds,
|
|
35
|
+
peers,
|
|
36
|
+
source: 'TorrentProject',
|
|
37
|
+
url: link.startsWith('http') ? link : `https://torrentproject.site${link}`,
|
|
38
|
+
magnet
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return results;
|
|
44
|
+
} catch (error: unknown) {
|
|
45
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
46
|
+
console.error(`TorrentProject search error: ${message}`);
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async getTorrentUrl(result: TorrentResult): Promise<string> {
|
|
52
|
+
return result.url;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async getMagnet(result: TorrentResult): Promise<string> {
|
|
56
|
+
return result.magnet || '';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private parseSize(size: string): number {
|
|
60
|
+
if (!size) return 0;
|
|
61
|
+
const match = size.toString().match(/([\d.]+)\s*(GB|MB|TB|KB)/i);
|
|
62
|
+
if (!match) return 0;
|
|
63
|
+
const value = parseFloat(match[1]);
|
|
64
|
+
const unit = match[2].toUpperCase();
|
|
65
|
+
const multipliers: Record<string, number> = { 'KB': 1024, 'MB': 1024**2, 'GB': 1024**3, 'TB': 1024**4 };
|
|
66
|
+
return value * (multipliers[unit] || 1);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export default new TorrentProjectScraper();
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { TorrentResult, SourceScraper } from '../types';
|
|
3
|
+
import { DEFAULT_HEADERS, TIMEOUT } from './httpClient';
|
|
4
|
+
|
|
5
|
+
export class TorrentsCsvScraper implements SourceScraper {
|
|
6
|
+
name = 'torrents-csv';
|
|
7
|
+
|
|
8
|
+
async search(query: string, category?: string): Promise<TorrentResult[]> {
|
|
9
|
+
try {
|
|
10
|
+
const url = `https://torrents-csv.ml/api/search?q=${encodeURIComponent(query)}`;
|
|
11
|
+
const { data } = await axios.get(url, {
|
|
12
|
+
headers: DEFAULT_HEADERS,
|
|
13
|
+
timeout: TIMEOUT
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const results: TorrentResult[] = [];
|
|
17
|
+
const torrents = Array.isArray(data) ? data : data.torrents || [];
|
|
18
|
+
|
|
19
|
+
for (const t of torrents.slice(0, 50)) {
|
|
20
|
+
results.push({
|
|
21
|
+
num: results.length + 1,
|
|
22
|
+
name: t.name || t.title || 'Unknown',
|
|
23
|
+
size: this.formatSize(t.length || t.size || 0),
|
|
24
|
+
sizeBytes: t.length || t.size || 0,
|
|
25
|
+
seeds: t.seeders || t.s || 0,
|
|
26
|
+
peers: t.leechers || t.l || 0,
|
|
27
|
+
source: 'torrents-csv',
|
|
28
|
+
url: t.link || t.info_hash ? `magnet:?xt=urn:btih:${t.info_hash}` : '',
|
|
29
|
+
magnet: t.link || t.magnet ? `magnet:?xt=urn:btih:${t.info_hash}` : '',
|
|
30
|
+
hash: t.info_hash
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return results;
|
|
35
|
+
} catch (error: unknown) {
|
|
36
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
37
|
+
console.error(`torrents-csv search error: ${message}`);
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async getTorrentUrl(result: TorrentResult): Promise<string> {
|
|
43
|
+
return result.url;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async getMagnet(result: TorrentResult): Promise<string> {
|
|
47
|
+
return result.magnet || `magnet:?xt=urn:btih:${result.hash}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private formatSize(bytes: number): string {
|
|
51
|
+
if (bytes < 1024) return bytes + ' B';
|
|
52
|
+
if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(2) + ' KB';
|
|
53
|
+
if (bytes < 1024 * 1024 * 1024) return (bytes / (1024 * 1024)).toFixed(2) + ' MB';
|
|
54
|
+
return (bytes / (1024 * 1024 * 1024)).toFixed(2) + ' GB';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export default new TorrentsCsvScraper();
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import * as cheerio from 'cheerio';
|
|
3
|
+
import { TorrentResult, SourceScraper } from '../types';
|
|
4
|
+
import { getHeaders, TIMEOUT } from './httpClient';
|
|
5
|
+
|
|
6
|
+
export class YtsScraper implements SourceScraper {
|
|
7
|
+
name = 'YTS';
|
|
8
|
+
|
|
9
|
+
async search(query: string, category?: string): Promise<TorrentResult[]> {
|
|
10
|
+
if (category && category.toLowerCase() === 'tv') {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
const url = `https://yts.lt/api/v2/list_movies.json?query_term=${encodeURIComponent(query)}&limit=50`;
|
|
16
|
+
const { data } = await axios.get(url, {
|
|
17
|
+
headers: getHeaders(),
|
|
18
|
+
timeout: TIMEOUT
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const results: TorrentResult[] = [];
|
|
22
|
+
|
|
23
|
+
if (data.data && data.data.movies) {
|
|
24
|
+
for (const movie of data.data.movies) {
|
|
25
|
+
const quality = movie.torrents?.[0]?.quality || 'Unknown';
|
|
26
|
+
const sizeStr = movie.torrents?.[0]?.size || '0';
|
|
27
|
+
const sizeBytes = this.parseSizeStr(sizeStr);
|
|
28
|
+
results.push({
|
|
29
|
+
num: results.length + 1,
|
|
30
|
+
name: `${movie.title} (${movie.year}) ${quality}`,
|
|
31
|
+
size: this.formatSize(sizeBytes),
|
|
32
|
+
sizeBytes: sizeBytes,
|
|
33
|
+
seeds: movie.torrents?.[0]?.seeds || 0,
|
|
34
|
+
peers: movie.torrents?.[0]?.peers || 0,
|
|
35
|
+
source: 'YTS',
|
|
36
|
+
url: movie.torrents?.[0]?.url || '',
|
|
37
|
+
magnet: movie.torrents?.[0]?.hash ? `magnet:?xt=urn:btih:${movie.torrents[0].hash}` : '',
|
|
38
|
+
hash: movie.torrents?.[0]?.hash
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return results;
|
|
44
|
+
} catch (error: unknown) {
|
|
45
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
46
|
+
console.error(`YTS search error: ${message}`);
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async getTorrentUrl(result: TorrentResult): Promise<string> {
|
|
52
|
+
return result.url;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async getMagnet(result: TorrentResult): Promise<string> {
|
|
56
|
+
return result.magnet || '';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private parseSizeStr(sizeStr: string): number {
|
|
60
|
+
if (!sizeStr || typeof sizeStr !== 'string') return 0;
|
|
61
|
+
const match = sizeStr.match(/([\d.]+)\s*(GB|MB|KB|TB)/i);
|
|
62
|
+
if (!match) return 0;
|
|
63
|
+
const value = parseFloat(match[1]);
|
|
64
|
+
const unit = match[2].toUpperCase();
|
|
65
|
+
const multipliers: Record<string, number> = {
|
|
66
|
+
'KB': 1024,
|
|
67
|
+
'MB': 1024 ** 2,
|
|
68
|
+
'GB': 1024 ** 3,
|
|
69
|
+
'TB': 1024 ** 4
|
|
70
|
+
};
|
|
71
|
+
return value * (multipliers[unit] || 0);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private formatSize(bytes: number): string {
|
|
75
|
+
if (typeof bytes !== 'number' || isNaN(bytes) || bytes === 0) {
|
|
76
|
+
return 'Unknown';
|
|
77
|
+
}
|
|
78
|
+
if (bytes < 1024) return (bytes / 1024).toFixed(2) + ' KB';
|
|
79
|
+
if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(2) + ' KB';
|
|
80
|
+
if (bytes < 1024 * 1024 * 1024) return (bytes / (1024 * 1024)).toFixed(2) + ' MB';
|
|
81
|
+
return (bytes / (1024 * 1024 * 1024)).toFixed(2) + ' GB';
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default new YtsScraper();
|
package/src/types.d.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
declare module 'cli-progress' {
|
|
2
|
+
interface ProgressBarOptions {
|
|
3
|
+
format?: string;
|
|
4
|
+
barCompleteChar?: string;
|
|
5
|
+
barIncompleteChar?: string;
|
|
6
|
+
hideCursor?: boolean;
|
|
7
|
+
fps?: number;
|
|
8
|
+
etaAsynchronous?: boolean;
|
|
9
|
+
etaBuffer?: number;
|
|
10
|
+
stream?: any;
|
|
11
|
+
terminateOnComplete?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface ProgressBar {
|
|
15
|
+
start(total: number, startValue: number, payload?: any): void;
|
|
16
|
+
update(current: number, payload?: any): void;
|
|
17
|
+
stop(): void;
|
|
18
|
+
increment(delta?: number): void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function create(options?: ProgressBarOptions, preset?: any): ProgressBar;
|
|
22
|
+
|
|
23
|
+
export = { create };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare module 'webtorrent' {
|
|
27
|
+
interface TorrentOptions {
|
|
28
|
+
path?: string;
|
|
29
|
+
auto?: boolean;
|
|
30
|
+
maxWebConns?: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface Torrent {
|
|
34
|
+
ready: boolean;
|
|
35
|
+
length: number;
|
|
36
|
+
downloaded: number;
|
|
37
|
+
name: string;
|
|
38
|
+
files: any[];
|
|
39
|
+
on(event: 'ready' | 'download' | 'done' | 'error', callback: (...args: any[]) => void): void;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface Client {
|
|
43
|
+
add(torrentId: string | Buffer, opts?: TorrentOptions): Torrent;
|
|
44
|
+
destroy(callback?: () => void): void;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function (): Client;
|
|
48
|
+
|
|
49
|
+
export = WebTorrent;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
declare module 'ora' {
|
|
53
|
+
interface Ora {
|
|
54
|
+
start(text?: string): Ora;
|
|
55
|
+
stop(): Ora;
|
|
56
|
+
succeed(text?: string): Ora;
|
|
57
|
+
fail(text?: string): Ora;
|
|
58
|
+
warn(text?: string): Ora;
|
|
59
|
+
info(text?: string): Ora;
|
|
60
|
+
text: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface OraOptions {
|
|
64
|
+
text?: string;
|
|
65
|
+
color?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function ora(options?: OraOptions): Ora;
|
|
69
|
+
|
|
70
|
+
export = ora;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
declare module 'chalk' {
|
|
74
|
+
const chalk: {
|
|
75
|
+
red: (s: string) => string;
|
|
76
|
+
green: (s: string) => string;
|
|
77
|
+
blue: (s: string) => string;
|
|
78
|
+
yellow: (s: string) => string;
|
|
79
|
+
cyan: (s: string) => string;
|
|
80
|
+
white: (s: string) => string;
|
|
81
|
+
gray: (s: string) => string;
|
|
82
|
+
bold: (s: string) => string;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export = chalk;
|
|
86
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export interface TorrentResult {
|
|
2
|
+
num: number;
|
|
3
|
+
name: string;
|
|
4
|
+
size: string;
|
|
5
|
+
sizeBytes: number;
|
|
6
|
+
seeds: number;
|
|
7
|
+
peers: number;
|
|
8
|
+
source: string;
|
|
9
|
+
url: string;
|
|
10
|
+
magnet?: string;
|
|
11
|
+
hash?: string;
|
|
12
|
+
category?: string;
|
|
13
|
+
date?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface SourceConfig {
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
name: string;
|
|
19
|
+
baseUrl: string;
|
|
20
|
+
searchUrl: string;
|
|
21
|
+
categories: string[];
|
|
22
|
+
searchParam: string;
|
|
23
|
+
hasMagnet: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface SourcesJSON {
|
|
27
|
+
updateUrl: string;
|
|
28
|
+
version: string;
|
|
29
|
+
sources: Record<string, SourceConfig>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface FilterConfig {
|
|
33
|
+
category: string;
|
|
34
|
+
minSeeds: number;
|
|
35
|
+
minSize: string;
|
|
36
|
+
maxSize: string;
|
|
37
|
+
sortBy: 'seeds' | 'size' | 'date';
|
|
38
|
+
order: 'asc' | 'desc';
|
|
39
|
+
limit: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface SearchOptions {
|
|
43
|
+
query: string;
|
|
44
|
+
category?: string;
|
|
45
|
+
minSeeds?: number;
|
|
46
|
+
minSize?: string;
|
|
47
|
+
maxSize?: string;
|
|
48
|
+
sortBy?: 'seeds' | 'size' | 'date';
|
|
49
|
+
order?: 'asc' | 'desc';
|
|
50
|
+
limit?: number;
|
|
51
|
+
sources?: string[];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface DownloadOptions {
|
|
55
|
+
torrentUrl?: string;
|
|
56
|
+
magnet?: string;
|
|
57
|
+
savePath?: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface SourceScraper {
|
|
61
|
+
name: string;
|
|
62
|
+
search(query: string, category?: string): Promise<TorrentResult[]>;
|
|
63
|
+
getTorrentUrl(result: TorrentResult): Promise<string>;
|
|
64
|
+
getMagnet(result: TorrentResult): Promise<string>;
|
|
65
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["ES2020"],
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"declarationMap": true,
|
|
15
|
+
"sourceMap": true,
|
|
16
|
+
"noImplicitAny": false
|
|
17
|
+
},
|
|
18
|
+
"include": ["src/**/*", "bin/**/*"],
|
|
19
|
+
"exclude": ["node_modules", "dist"]
|
|
20
|
+
}
|