tor-dl 1.0.14 → 1.0.16

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 (131) hide show
  1. package/dist/cli/display.d.ts.map +1 -1
  2. package/dist/cli/display.js +68 -2
  3. package/dist/cli/display.js.map +1 -1
  4. package/dist/cli/parser.js +1 -1
  5. package/dist/cli/parser.js.map +1 -1
  6. package/dist/sources/torrentscsv.js +7 -7
  7. package/dist/sources/torrentscsv.js.map +1 -1
  8. package/dist/sources/yts.js +1 -1
  9. package/dist/sources/yts.js.map +1 -1
  10. package/dist/types.d.ts +1 -0
  11. package/dist/types.d.ts.map +1 -1
  12. package/filters.json +9 -8
  13. package/package.json +34 -34
  14. package/sources.json +104 -104
  15. package/src/cli/display.ts +59 -2
  16. package/src/cli/parser.ts +1 -1
  17. package/src/sources/torrentscsv.ts +57 -57
  18. package/src/sources/yts.ts +85 -85
  19. package/src/types.ts +67 -66
  20. package/dist/cli/progress.d.ts +0 -15
  21. package/dist/cli/progress.d.ts.map +0 -1
  22. package/dist/cli/progress.js +0 -76
  23. package/dist/cli/progress.js.map +0 -1
  24. package/dist/src/cli/display.d.ts +0 -7
  25. package/dist/src/cli/display.d.ts.map +0 -1
  26. package/dist/src/cli/display.js +0 -59
  27. package/dist/src/cli/display.js.map +0 -1
  28. package/dist/src/cli/parser.d.ts +0 -5
  29. package/dist/src/cli/parser.d.ts.map +0 -1
  30. package/dist/src/cli/parser.js +0 -122
  31. package/dist/src/cli/parser.js.map +0 -1
  32. package/dist/src/cli/progress.d.ts +0 -15
  33. package/dist/src/cli/progress.d.ts.map +0 -1
  34. package/dist/src/cli/progress.js +0 -76
  35. package/dist/src/cli/progress.js.map +0 -1
  36. package/dist/src/commands/download.d.ts +0 -2
  37. package/dist/src/commands/download.d.ts.map +0 -1
  38. package/dist/src/commands/download.js +0 -70
  39. package/dist/src/commands/download.js.map +0 -1
  40. package/dist/src/commands/search.d.ts +0 -3
  41. package/dist/src/commands/search.d.ts.map +0 -1
  42. package/dist/src/commands/search.js +0 -46
  43. package/dist/src/commands/search.js.map +0 -1
  44. package/dist/src/commands/update.d.ts +0 -2
  45. package/dist/src/commands/update.d.ts.map +0 -1
  46. package/dist/src/commands/update.js +0 -32
  47. package/dist/src/commands/update.js.map +0 -1
  48. package/dist/src/download/engine.d.ts +0 -6
  49. package/dist/src/download/engine.d.ts.map +0 -1
  50. package/dist/src/download/engine.js +0 -163
  51. package/dist/src/download/engine.js.map +0 -1
  52. package/dist/src/filters/category.d.ts +0 -3
  53. package/dist/src/filters/category.d.ts.map +0 -1
  54. package/dist/src/filters/category.js +0 -24
  55. package/dist/src/filters/category.js.map +0 -1
  56. package/dist/src/filters/index.d.ts +0 -5
  57. package/dist/src/filters/index.d.ts.map +0 -1
  58. package/dist/src/filters/index.js +0 -13
  59. package/dist/src/filters/index.js.map +0 -1
  60. package/dist/src/filters/seeds.d.ts +0 -3
  61. package/dist/src/filters/seeds.d.ts.map +0 -1
  62. package/dist/src/filters/seeds.js +0 -7
  63. package/dist/src/filters/seeds.js.map +0 -1
  64. package/dist/src/filters/size.d.ts +0 -4
  65. package/dist/src/filters/size.d.ts.map +0 -1
  66. package/dist/src/filters/size.js +0 -36
  67. package/dist/src/filters/size.js.map +0 -1
  68. package/dist/src/filters/sort.d.ts +0 -5
  69. package/dist/src/filters/sort.d.ts.map +0 -1
  70. package/dist/src/filters/sort.js +0 -25
  71. package/dist/src/filters/sort.js.map +0 -1
  72. package/dist/src/index.d.ts +0 -11
  73. package/dist/src/index.d.ts.map +0 -1
  74. package/dist/src/index.js +0 -30
  75. package/dist/src/index.js.map +0 -1
  76. package/dist/src/sources/1337x.d.ts +0 -11
  77. package/dist/src/sources/1337x.d.ts.map +0 -1
  78. package/dist/src/sources/1337x.js +0 -121
  79. package/dist/src/sources/1337x.js.map +0 -1
  80. package/dist/src/sources/eztv.d.ts +0 -11
  81. package/dist/src/sources/eztv.d.ts.map +0 -1
  82. package/dist/src/sources/eztv.js +0 -104
  83. package/dist/src/sources/eztv.js.map +0 -1
  84. package/dist/src/sources/httpClient.d.ts +0 -24
  85. package/dist/src/sources/httpClient.d.ts.map +0 -1
  86. package/dist/src/sources/httpClient.js +0 -42
  87. package/dist/src/sources/httpClient.js.map +0 -1
  88. package/dist/src/sources/limetorrent.d.ts +0 -11
  89. package/dist/src/sources/limetorrent.d.ts.map +0 -1
  90. package/dist/src/sources/limetorrent.js +0 -113
  91. package/dist/src/sources/limetorrent.js.map +0 -1
  92. package/dist/src/sources/nyaa.d.ts +0 -11
  93. package/dist/src/sources/nyaa.d.ts.map +0 -1
  94. package/dist/src/sources/nyaa.js +0 -119
  95. package/dist/src/sources/nyaa.js.map +0 -1
  96. package/dist/src/sources/rarbg.d.ts +0 -11
  97. package/dist/src/sources/rarbg.d.ts.map +0 -1
  98. package/dist/src/sources/rarbg.js +0 -122
  99. package/dist/src/sources/rarbg.js.map +0 -1
  100. package/dist/src/sources/registry.d.ts +0 -9
  101. package/dist/src/sources/registry.d.ts.map +0 -1
  102. package/dist/src/sources/registry.js +0 -70
  103. package/dist/src/sources/registry.js.map +0 -1
  104. package/dist/src/sources/solidtorrents.d.ts +0 -11
  105. package/dist/src/sources/solidtorrents.d.ts.map +0 -1
  106. package/dist/src/sources/solidtorrents.js +0 -105
  107. package/dist/src/sources/solidtorrents.js.map +0 -1
  108. package/dist/src/sources/thepiratebay.d.ts +0 -11
  109. package/dist/src/sources/thepiratebay.d.ts.map +0 -1
  110. package/dist/src/sources/thepiratebay.js +0 -67
  111. package/dist/src/sources/thepiratebay.js.map +0 -1
  112. package/dist/src/sources/torlock.d.ts +0 -11
  113. package/dist/src/sources/torlock.d.ts.map +0 -1
  114. package/dist/src/sources/torlock.js +0 -116
  115. package/dist/src/sources/torlock.js.map +0 -1
  116. package/dist/src/sources/torrentproject.d.ts +0 -11
  117. package/dist/src/sources/torrentproject.d.ts.map +0 -1
  118. package/dist/src/sources/torrentproject.js +0 -105
  119. package/dist/src/sources/torrentproject.js.map +0 -1
  120. package/dist/src/sources/torrentscsv.d.ts +0 -11
  121. package/dist/src/sources/torrentscsv.d.ts.map +0 -1
  122. package/dist/src/sources/torrentscsv.js +0 -62
  123. package/dist/src/sources/torrentscsv.js.map +0 -1
  124. package/dist/src/sources/yts.d.ts +0 -12
  125. package/dist/src/sources/yts.d.ts.map +0 -1
  126. package/dist/src/sources/yts.js +0 -88
  127. package/dist/src/sources/yts.js.map +0 -1
  128. package/dist/src/types.d.ts +0 -60
  129. package/dist/src/types.d.ts.map +0 -1
  130. package/dist/src/types.js +0 -3
  131. package/dist/src/types.js.map +0 -1
package/src/cli/parser.ts CHANGED
@@ -87,7 +87,7 @@ Sources:
87
87
  sortBy: (options.sort as 'seeds' | 'size' | 'date') || filters.sortBy,
88
88
  order: (options.order as 'asc' | 'desc') || filters.order,
89
89
  limit: options.limit || filters.limit,
90
- sources: options.sources ? options.sources.split(',') : undefined
90
+ sources: options.sources ? options.sources.split(',') : (filters as any).sources ? (filters as any).sources.split(',') : undefined
91
91
  };
92
92
 
93
93
  const { searchCommand } = await import('../commands/search');
@@ -1,58 +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 = 'torrentscsv';
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
-
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 = 'torrentscsv';
7
+
8
+ async search(query: string, category?: string): Promise<TorrentResult[]> {
9
+ try {
10
+ const url = `https://torrents-csv.com/service/search?q=${encodeURIComponent(query)}&after=0`;
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.size_bytes || t.length || t.size || 0),
24
+ sizeBytes: t.size_bytes || 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: `https://torrents-csv.com/#/search/torrent/${t.infohash}/1`,
29
+ magnet: `magnet:?xt=urn:btih:${t.infohash}`,
30
+ hash: t.infohash
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 '';
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
58
  export default new TorrentsCsvScraper();
@@ -1,86 +1,86 @@
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
- torrentUrl: movie.torrents?.[0]?.url || '',
38
- magnet: movie.torrents?.[0]?.hash ? `magnet:?xt=urn:btih:${movie.torrents[0].hash}` : '',
39
- hash: movie.torrents?.[0]?.hash
40
- });
41
- }
42
- }
43
-
44
- return results;
45
- } catch (error: unknown) {
46
- const message = error instanceof Error ? error.message : 'Unknown error';
47
- console.error(`YTS search error: ${message}`);
48
- return [];
49
- }
50
- }
51
-
52
- async getTorrentUrl(result: TorrentResult): Promise<string> {
53
- return result.url;
54
- }
55
-
56
- async getMagnet(result: TorrentResult): Promise<string> {
57
- return result.magnet || '';
58
- }
59
-
60
- private parseSizeStr(sizeStr: string): number {
61
- if (!sizeStr || typeof sizeStr !== 'string') return 0;
62
- const match = sizeStr.match(/([\d.]+)\s*(GB|MB|KB|TB)/i);
63
- if (!match) return 0;
64
- const value = parseFloat(match[1]);
65
- const unit = match[2].toUpperCase();
66
- const multipliers: Record<string, number> = {
67
- 'KB': 1024,
68
- 'MB': 1024 ** 2,
69
- 'GB': 1024 ** 3,
70
- 'TB': 1024 ** 4
71
- };
72
- return value * (multipliers[unit] || 0);
73
- }
74
-
75
- private formatSize(bytes: number): string {
76
- if (typeof bytes !== 'number' || isNaN(bytes) || bytes === 0) {
77
- return 'Unknown';
78
- }
79
- if (bytes < 1024) return (bytes / 1024).toFixed(2) + ' KB';
80
- if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(2) + ' KB';
81
- if (bytes < 1024 * 1024 * 1024) return (bytes / (1024 * 1024)).toFixed(2) + ' MB';
82
- return (bytes / (1024 * 1024 * 1024)).toFixed(2) + ' GB';
83
- }
84
- }
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.url || '',
37
+ torrentUrl: movie.torrents?.[0]?.url || '',
38
+ magnet: movie.torrents?.[0]?.hash ? `magnet:?xt=urn:btih:${movie.torrents[0].hash}` : '',
39
+ hash: movie.torrents?.[0]?.hash
40
+ });
41
+ }
42
+ }
43
+
44
+ return results;
45
+ } catch (error: unknown) {
46
+ const message = error instanceof Error ? error.message : 'Unknown error';
47
+ console.error(`YTS search error: ${message}`);
48
+ return [];
49
+ }
50
+ }
51
+
52
+ async getTorrentUrl(result: TorrentResult): Promise<string> {
53
+ return result.url;
54
+ }
55
+
56
+ async getMagnet(result: TorrentResult): Promise<string> {
57
+ return result.magnet || '';
58
+ }
59
+
60
+ private parseSizeStr(sizeStr: string): number {
61
+ if (!sizeStr || typeof sizeStr !== 'string') return 0;
62
+ const match = sizeStr.match(/([\d.]+)\s*(GB|MB|KB|TB)/i);
63
+ if (!match) return 0;
64
+ const value = parseFloat(match[1]);
65
+ const unit = match[2].toUpperCase();
66
+ const multipliers: Record<string, number> = {
67
+ 'KB': 1024,
68
+ 'MB': 1024 ** 2,
69
+ 'GB': 1024 ** 3,
70
+ 'TB': 1024 ** 4
71
+ };
72
+ return value * (multipliers[unit] || 0);
73
+ }
74
+
75
+ private formatSize(bytes: number): string {
76
+ if (typeof bytes !== 'number' || isNaN(bytes) || bytes === 0) {
77
+ return 'Unknown';
78
+ }
79
+ if (bytes < 1024) return (bytes / 1024).toFixed(2) + ' KB';
80
+ if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(2) + ' KB';
81
+ if (bytes < 1024 * 1024 * 1024) return (bytes / (1024 * 1024)).toFixed(2) + ' MB';
82
+ return (bytes / (1024 * 1024 * 1024)).toFixed(2) + ' GB';
83
+ }
84
+ }
85
+
86
86
  export default new YtsScraper();
package/src/types.ts CHANGED
@@ -1,67 +1,68 @@
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
- torrentUrl?: string;
15
- }
16
-
17
- export interface SourceConfig {
18
- enabled: boolean;
19
- name: string;
20
- baseUrl: string;
21
- searchUrl: string;
22
- categories: string[];
23
- searchParam: string;
24
- hasMagnet: boolean;
25
- }
26
-
27
- export interface SourcesJSON {
28
- updateUrl: string;
29
- version: string;
30
- sources: Record<string, SourceConfig>;
31
- }
32
-
33
- export interface FilterConfig {
34
- category: string;
35
- minSeeds: number;
36
- minSize: string;
37
- maxSize: string;
38
- sortBy: 'seeds' | 'size' | 'date';
39
- order: 'asc' | 'desc';
40
- limit: number;
41
- }
42
-
43
- export interface SearchOptions {
44
- query: string;
45
- category?: string;
46
- minSeeds?: number;
47
- maxSeeds?: number;
48
- minSize?: string;
49
- maxSize?: string;
50
- sortBy?: 'seeds' | 'size' | 'date';
51
- order?: 'asc' | 'desc';
52
- limit?: number;
53
- sources?: string[];
54
- }
55
-
56
- export interface DownloadOptions {
57
- torrentUrl?: string;
58
- magnet?: string;
59
- savePath?: string;
60
- }
61
-
62
- export interface SourceScraper {
63
- name: string;
64
- search(query: string, category?: string): Promise<TorrentResult[]>;
65
- getTorrentUrl(result: TorrentResult): Promise<string>;
66
- getMagnet(result: TorrentResult): Promise<string>;
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
+ torrentUrl?: string;
15
+ }
16
+
17
+ export interface SourceConfig {
18
+ enabled: boolean;
19
+ name: string;
20
+ baseUrl: string;
21
+ searchUrl: string;
22
+ categories: string[];
23
+ searchParam: string;
24
+ hasMagnet: boolean;
25
+ }
26
+
27
+ export interface SourcesJSON {
28
+ updateUrl: string;
29
+ version: string;
30
+ sources: Record<string, SourceConfig>;
31
+ }
32
+
33
+ export interface FilterConfig {
34
+ category: string;
35
+ sources?: string;
36
+ minSeeds: number;
37
+ minSize: string;
38
+ maxSize: string;
39
+ sortBy: 'seeds' | 'size' | 'date';
40
+ order: 'asc' | 'desc';
41
+ limit: number;
42
+ }
43
+
44
+ export interface SearchOptions {
45
+ query: string;
46
+ category?: string;
47
+ minSeeds?: number;
48
+ maxSeeds?: number;
49
+ minSize?: string;
50
+ maxSize?: string;
51
+ sortBy?: 'seeds' | 'size' | 'date';
52
+ order?: 'asc' | 'desc';
53
+ limit?: number;
54
+ sources?: string[];
55
+ }
56
+
57
+ export interface DownloadOptions {
58
+ torrentUrl?: string;
59
+ magnet?: string;
60
+ savePath?: string;
61
+ }
62
+
63
+ export interface SourceScraper {
64
+ name: string;
65
+ search(query: string, category?: string): Promise<TorrentResult[]>;
66
+ getTorrentUrl(result: TorrentResult): Promise<string>;
67
+ getMagnet(result: TorrentResult): Promise<string>;
67
68
  }
@@ -1,15 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,76 +0,0 @@
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
@@ -1 +0,0 @@
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,YAAY,EAAE,CAAC;QAChC,MAAM,YAAY,GAAG,CAAC,IAAI,CAAC,eAAe,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAEvE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE;YACpC,KAAK;YACL,UAAU,EAAE,GAAG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AAK,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"}
@@ -1,7 +0,0 @@
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
@@ -1 +0,0 @@
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,CA6B7D;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"}
@@ -1,59 +0,0 @@
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('');
35
- out('To download: tor-dl <number>');
36
- }
37
- function displayResultDetails(result) {
38
- console.log(chalk_1.default.bold('\n--- Torrent Details ---'));
39
- console.log(chalk_1.default.white('Name: ') + result.name);
40
- console.log(chalk_1.default.white('Size: ') + result.size);
41
- console.log(chalk_1.default.white('Seeds: ') + chalk_1.default.green(result.seeds.toString()));
42
- console.log(chalk_1.default.white('Peers: ') + result.peers.toString());
43
- console.log(chalk_1.default.white('Source: ') + result.source);
44
- console.log(chalk_1.default.white('URL: ') + result.url);
45
- if (result.magnet) {
46
- console.log(chalk_1.default.white('Magnet: ') + chalk_1.default.cyan(result.magnet.substring(0, 60) + '...'));
47
- }
48
- console.log(chalk_1.default.bold('----------------------\n'));
49
- }
50
- function displayError(message) {
51
- console.error(chalk_1.default.red('Error: ') + message);
52
- }
53
- function displaySuccess(message) {
54
- console.log(chalk_1.default.green('✓ ') + message);
55
- }
56
- function displayInfo(message) {
57
- console.log(chalk_1.default.blue('ℹ ') + message);
58
- }
59
- //# sourceMappingURL=display.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"display.js","sourceRoot":"","sources":["../../../src/cli/display.ts"],"names":[],"mappings":";;;;;AAGA,wCA6BC;AAED,oDAYC;AAED,oCAEC;AAED,wCAEC;AAED,kCAEC;AA1DD,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,oFAAoF;QACpF,oFAAoF;QACpF,oFAAoF;KACrF,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,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AAC,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;AAC1C,CAAC"}
@@ -1,5 +0,0 @@
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
@@ -1 +0,0 @@
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"}