@vyla-entertainment/sdk 1.20.0 → 1.21.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/package.json +3 -2
- package/src/config.js +10 -85
- package/src/sdk.d.ts +94 -121
- package/src/sdk.js +82 -78
- package/src/sources/111477.js +88 -100
- package/src/sources/123anime.js +120 -56
- package/src/sources/3eyedraven.js +82 -135
- package/src/sources/cinecat.js +37 -18
- package/src/sources/cinemaarmy.js +179 -180
- package/src/sources/cinesrc.js +401 -397
- package/src/sources/cno.js +101 -94
- package/src/sources/dulo.js +134 -149
- package/src/sources/flaxmovies.js +114 -105
- package/src/sources/frost.js +38 -29
- package/src/sources/fsonline.js +95 -47
- package/src/sources/hdhub.js +43 -36
- package/src/sources/hexa.js +60 -53
- package/src/sources/hyper.js +42 -35
- package/src/sources/kickassanime.js +117 -124
- package/src/sources/kisskh.js +114 -59
- package/src/sources/lmscript.js +72 -70
- package/src/sources/lookmovie.js +80 -79
- package/src/sources/movenerds.js +74 -124
- package/src/sources/movy.js +197 -209
- package/src/sources/net79.js +59 -55
- package/src/sources/peestream.js +126 -138
- package/src/sources/pengu.js +46 -49
- package/src/sources/pstream.js +73 -67
- package/src/sources/purstream.js +96 -104
- package/src/sources/rivestream.js +182 -176
- package/src/sources/rivo.js +58 -53
- package/src/sources/streamaggregator.js +114 -128
- package/src/sources/thugtv.js +70 -62
- package/src/sources/vidapi.js +122 -114
- package/src/sources/vidcore.js +14 -122
- package/src/sources/vidfast.js +14 -122
- package/src/sources/vidlink.js +78 -27
- package/src/sources/vidup.js +14 -122
- package/src/sources/vidvault.js +133 -187
- package/src/sources/vidy.js +192 -187
- package/src/sources/vidzee.js +189 -183
- package/src/sources/vixsrc.js +123 -113
- package/src/sources/watchout.js +60 -46
- package/src/sources/xdownloader.js +127 -128
- package/src/sources/yapgrid.js +68 -62
- package/src/sources/yastream.js +35 -29
- package/src/subtitles.js +105 -122
- package/src/utils/helpers.js +586 -247
- package/src/sources/bcine.js +0 -202
- package/src/sources/cinezo.js +0 -55
- package/src/sources/vidora.js +0 -62
- package/src/sources/vidrock.js +0 -145
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vyla-entertainment/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.0",
|
|
4
4
|
"scripts": {
|
|
5
|
-
"test": "node test/index.js"
|
|
5
|
+
"test": "node test/index.js",
|
|
6
|
+
"test:all": "node test/index.js all"
|
|
6
7
|
},
|
|
7
8
|
"author": "vyla-entertainment",
|
|
8
9
|
"contributors": [
|
package/src/config.js
CHANGED
|
@@ -56,24 +56,6 @@ export const SOURCES = [
|
|
|
56
56
|
}],
|
|
57
57
|
},
|
|
58
58
|
|
|
59
|
-
{
|
|
60
|
-
key: 'bcine',
|
|
61
|
-
label: 'Bcine',
|
|
62
|
-
sourceFile: 'bcine',
|
|
63
|
-
proxyParam: 'bc',
|
|
64
|
-
timeout: 25000,
|
|
65
|
-
jitter: 500,
|
|
66
|
-
retries: 2,
|
|
67
|
-
multiUrl: true,
|
|
68
|
-
cdnHeaders: [{
|
|
69
|
-
pattern: /1embed\.cc|videasy\.to/i,
|
|
70
|
-
headers: {
|
|
71
|
-
Referer: 'https://bcine.ru/',
|
|
72
|
-
Origin: 'https://bcine.ru',
|
|
73
|
-
},
|
|
74
|
-
}],
|
|
75
|
-
},
|
|
76
|
-
|
|
77
59
|
{
|
|
78
60
|
key: 'cinemaarmy',
|
|
79
61
|
label: 'CinemaArmy',
|
|
@@ -112,24 +94,6 @@ export const SOURCES = [
|
|
|
112
94
|
}],
|
|
113
95
|
},
|
|
114
96
|
|
|
115
|
-
{
|
|
116
|
-
key: 'cinezo',
|
|
117
|
-
label: 'Cinezo',
|
|
118
|
-
sourceFile: 'cinezo',
|
|
119
|
-
proxyParam: 'czo',
|
|
120
|
-
timeout: 25000,
|
|
121
|
-
jitter: 500,
|
|
122
|
-
retries: 2,
|
|
123
|
-
multiUrl: true,
|
|
124
|
-
cdnHeaders: [{
|
|
125
|
-
pattern: /yenime\.net|flikhub\.net|hakunaymatata\.com/i,
|
|
126
|
-
headers: {
|
|
127
|
-
Referer: 'https://player.cinezo.live/',
|
|
128
|
-
Origin: 'https://player.cinezo.live',
|
|
129
|
-
},
|
|
130
|
-
}],
|
|
131
|
-
},
|
|
132
|
-
|
|
133
97
|
{
|
|
134
98
|
key: 'cno',
|
|
135
99
|
label: 'Cno',
|
|
@@ -361,14 +325,6 @@ export const SOURCES = [
|
|
|
361
325
|
jitter: 500,
|
|
362
326
|
retries: 2,
|
|
363
327
|
multiUrl: true,
|
|
364
|
-
skipProxy: true,
|
|
365
|
-
cdnHeaders: [{
|
|
366
|
-
pattern: /hakunaymatata\.com/i,
|
|
367
|
-
headers: {
|
|
368
|
-
Referer: 'https://net79.cc/',
|
|
369
|
-
Origin: 'https://net79.cc',
|
|
370
|
-
},
|
|
371
|
-
}],
|
|
372
328
|
},
|
|
373
329
|
|
|
374
330
|
{
|
|
@@ -381,7 +337,7 @@ export const SOURCES = [
|
|
|
381
337
|
retries: 1,
|
|
382
338
|
multiUrl: true,
|
|
383
339
|
skipProxy: true,
|
|
384
|
-
disabled: false,
|
|
340
|
+
disabled: false,
|
|
385
341
|
},
|
|
386
342
|
|
|
387
343
|
{
|
|
@@ -493,7 +449,16 @@ export const SOURCES = [
|
|
|
493
449
|
jitter: 500,
|
|
494
450
|
retries: 1,
|
|
495
451
|
multiUrl: true,
|
|
452
|
+
skipProxy: true,
|
|
453
|
+
cdnHeaders: [{
|
|
454
|
+
pattern: /vidcore\.io/i,
|
|
455
|
+
headers: {
|
|
456
|
+
Referer: 'https://vidcore.io/',
|
|
457
|
+
Origin: 'https://vidcore.io',
|
|
458
|
+
},
|
|
459
|
+
}],
|
|
496
460
|
},
|
|
461
|
+
|
|
497
462
|
{
|
|
498
463
|
key: 'vidfast',
|
|
499
464
|
label: 'VidFast',
|
|
@@ -505,25 +470,6 @@ export const SOURCES = [
|
|
|
505
470
|
multiUrl: true,
|
|
506
471
|
},
|
|
507
472
|
|
|
508
|
-
{
|
|
509
|
-
key: 'vidora',
|
|
510
|
-
label: 'Vidora',
|
|
511
|
-
sourceFile: 'vidora',
|
|
512
|
-
proxyParam: 'vdra',
|
|
513
|
-
timeout: 25000,
|
|
514
|
-
jitter: 500,
|
|
515
|
-
retries: 2,
|
|
516
|
-
multiUrl: true,
|
|
517
|
-
skipProxy: true,
|
|
518
|
-
cdnHeaders: [{
|
|
519
|
-
pattern: /rousav\.tech|vidbolt\.xyz|vidrift\.in|goldenkite\.top|ravok\.buzz/i,
|
|
520
|
-
headers: {
|
|
521
|
-
Referer: 'https://vidora-3l2w.onrender.com/',
|
|
522
|
-
Origin: 'https://vidora-3l2w.onrender.com',
|
|
523
|
-
},
|
|
524
|
-
}],
|
|
525
|
-
},
|
|
526
|
-
|
|
527
473
|
{
|
|
528
474
|
key: 'vidlink',
|
|
529
475
|
label: 'Vidlink',
|
|
@@ -532,28 +478,7 @@ export const SOURCES = [
|
|
|
532
478
|
timeout: 20000,
|
|
533
479
|
jitter: 500,
|
|
534
480
|
retries: 2,
|
|
535
|
-
skipProxy: true,
|
|
536
|
-
multiUrl: true,
|
|
537
|
-
},
|
|
538
|
-
|
|
539
|
-
{
|
|
540
|
-
key: 'vidrock',
|
|
541
|
-
label: 'VidRock',
|
|
542
|
-
sourceFile: 'vidrock',
|
|
543
|
-
proxyParam: 'vr',
|
|
544
|
-
timeout: 20000,
|
|
545
|
-
jitter: 800,
|
|
546
|
-
retries: 3,
|
|
547
481
|
multiUrl: true,
|
|
548
|
-
cdnHeaders: [{
|
|
549
|
-
pattern: /./,
|
|
550
|
-
headers: {
|
|
551
|
-
Accept: '/',
|
|
552
|
-
'Accept-Language': 'en-US,en;q=0.9',
|
|
553
|
-
Referer: 'https://vidrock.ru/',
|
|
554
|
-
Origin: 'https://vidrock.ru',
|
|
555
|
-
},
|
|
556
|
-
},],
|
|
557
482
|
},
|
|
558
483
|
|
|
559
484
|
{
|
package/src/sdk.d.ts
CHANGED
|
@@ -1,122 +1,95 @@
|
|
|
1
|
-
export interface SourceConfig {
|
|
2
|
-
key: string;
|
|
3
|
-
label: string;
|
|
4
|
-
sourceFile: string;
|
|
5
|
-
proxyParam: string;
|
|
6
|
-
timeout: number;
|
|
7
|
-
jitter: number;
|
|
8
|
-
retries: number;
|
|
9
|
-
multiUrl: boolean;
|
|
10
|
-
skipProxy?: boolean;
|
|
11
|
-
cdnHeaders?: {
|
|
12
|
-
pattern: RegExp;
|
|
13
|
-
headers: {
|
|
14
|
-
Referer: string;
|
|
15
|
-
Origin: string;
|
|
16
|
-
};
|
|
17
|
-
}[];
|
|
18
|
-
skipVerify?: boolean;
|
|
19
|
-
verifyHeaders?: boolean;
|
|
20
|
-
disabled?: boolean;
|
|
21
|
-
sourcesTimeout?: number;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
e?: number | null,
|
|
96
|
-
clientIP?: string | null
|
|
97
|
-
): Promise<StreamResult | { allUrls: StreamResult[] }>;
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Get subtitles for a movie or TV episode.
|
|
101
|
-
* @param id Media id
|
|
102
|
-
* @param s Season number (for TV), or null for movies
|
|
103
|
-
* @param e Episode number (for TV), or null for movies
|
|
104
|
-
*/
|
|
105
|
-
getSubtitles(
|
|
106
|
-
id: string | number,
|
|
107
|
-
s?: number | null,
|
|
108
|
-
e?: number | null
|
|
109
|
-
): Promise<SubtitleResult[]>;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Get download links for a movie or TV episode.
|
|
113
|
-
* @param id Media id
|
|
114
|
-
* @param s Season number (for TV), or null for movies
|
|
115
|
-
* @param e Episode number (for TV), or null for movies
|
|
116
|
-
*/
|
|
117
|
-
getDownloads(
|
|
118
|
-
id: string | number,
|
|
119
|
-
s?: number | null,
|
|
120
|
-
e?: number | null
|
|
121
|
-
): Promise<DownloadResult[]>;
|
|
1
|
+
export interface SourceConfig {
|
|
2
|
+
key: string;
|
|
3
|
+
label: string;
|
|
4
|
+
sourceFile: string;
|
|
5
|
+
proxyParam: string;
|
|
6
|
+
timeout: number;
|
|
7
|
+
jitter: number;
|
|
8
|
+
retries: number;
|
|
9
|
+
multiUrl: boolean;
|
|
10
|
+
skipProxy?: boolean;
|
|
11
|
+
cdnHeaders?: {
|
|
12
|
+
pattern: RegExp;
|
|
13
|
+
headers: {
|
|
14
|
+
Referer: string;
|
|
15
|
+
Origin: string;
|
|
16
|
+
};
|
|
17
|
+
}[];
|
|
18
|
+
skipVerify?: boolean;
|
|
19
|
+
verifyHeaders?: boolean;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
sourcesTimeout?: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ProbeResult {
|
|
25
|
+
ok: boolean;
|
|
26
|
+
ms: number | null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface StreamResult {
|
|
30
|
+
url: string;
|
|
31
|
+
headers: {
|
|
32
|
+
"User-Agent": string;
|
|
33
|
+
Referer: string;
|
|
34
|
+
Origin: string;
|
|
35
|
+
[key: string]: string;
|
|
36
|
+
};
|
|
37
|
+
server: string;
|
|
38
|
+
quality: string;
|
|
39
|
+
type: "mp4" | "hls";
|
|
40
|
+
skipVerify?: boolean;
|
|
41
|
+
skipProxy?: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface DownloadResult {
|
|
45
|
+
url: string;
|
|
46
|
+
quality: string;
|
|
47
|
+
size: number | null;
|
|
48
|
+
type: "mkv";
|
|
49
|
+
active: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface SubtitleResult {
|
|
53
|
+
label: string;
|
|
54
|
+
file: string;
|
|
55
|
+
type: "vtt" | "srt";
|
|
56
|
+
source: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type ProbeAllResult = Record<string, ProbeResult>;
|
|
60
|
+
|
|
61
|
+
export interface VylaSDKOptions {
|
|
62
|
+
tmdbApiKey?: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default class VylaSDK {
|
|
66
|
+
tmdbApiKey?: string;
|
|
67
|
+
|
|
68
|
+
constructor(options?: VylaSDKOptions);
|
|
69
|
+
|
|
70
|
+
getSources(excludeDisabled?: boolean): SourceConfig[];
|
|
71
|
+
|
|
72
|
+
probeAllSources(): Promise<ProbeAllResult>;
|
|
73
|
+
|
|
74
|
+
probeSource(key: string): Promise<ProbeResult>;
|
|
75
|
+
|
|
76
|
+
getStream(
|
|
77
|
+
key: string,
|
|
78
|
+
id: string | number,
|
|
79
|
+
s?: number | null,
|
|
80
|
+
e?: number | null,
|
|
81
|
+
clientIP?: string | null
|
|
82
|
+
): Promise<StreamResult | { allUrls: StreamResult[] }>;
|
|
83
|
+
|
|
84
|
+
getSubtitles(
|
|
85
|
+
id: string | number,
|
|
86
|
+
s?: number | null,
|
|
87
|
+
e?: number | null
|
|
88
|
+
): Promise<SubtitleResult[]>;
|
|
89
|
+
|
|
90
|
+
getDownloads(
|
|
91
|
+
id: string | number,
|
|
92
|
+
s?: number | null,
|
|
93
|
+
e?: number | null
|
|
94
|
+
): Promise<DownloadResult[]>;
|
|
122
95
|
}
|
package/src/sdk.js
CHANGED
|
@@ -1,78 +1,82 @@
|
|
|
1
|
-
import SOURCES, { SOURCE_MAP } from "./config.js";
|
|
2
|
-
import { fetchDownloads } from "./downloads/downloads.js";
|
|
3
|
-
import { probeSource } from "./health.js";
|
|
4
|
-
import { getChapterPages, getMangaDetails, searchManga } from "./manga/atsu.js";
|
|
5
|
-
import { fetchSubtitles, getSubPathsMovie, getSubPathsTv } from "./subtitles.js";
|
|
6
|
-
import { createStreamArgs } from "./utils/helpers.js";
|
|
7
|
-
|
|
8
|
-
const ALL_SOURCE_MODULES = Object.fromEntries(
|
|
9
|
-
await Promise.all(SOURCES.map(async cfg => [cfg.key, await import(`./sources/${cfg.sourceFile}.js`)]))
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
const SOURCE_MODULES = Object.fromEntries(
|
|
13
|
-
Object.entries(ALL_SOURCE_MODULES).filter(([key]) => !SOURCE_MAP[key]?.disabled)
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
export default class VylaSDK {
|
|
17
|
-
tmdbApiKey = null;
|
|
18
|
-
penguManifest = null;
|
|
19
|
-
constructor({ tmdbApiKey, penguManifest } = {}) {
|
|
20
|
-
this.tmdbApiKey = tmdbApiKey || null;
|
|
21
|
-
this.penguManifest = penguManifest || null;
|
|
22
|
-
}
|
|
23
|
-
getSources(excludeDisabled = false) {
|
|
24
|
-
if (excludeDisabled) {
|
|
25
|
-
return SOURCES.filter(cfg => !cfg.disabled);
|
|
26
|
-
}
|
|
27
|
-
return SOURCES;
|
|
28
|
-
}
|
|
29
|
-
async probeAllSources() {
|
|
30
|
-
const active = SOURCES.filter(cfg => !cfg.disabled);
|
|
31
|
-
|
|
32
|
-
const results = await Promise.allSettled(
|
|
33
|
-
active.map(async cfg => await probeSource(cfg, SOURCE_MODULES[cfg.key]))
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const sources = Object.fromEntries(
|
|
37
|
-
active.map((cfg, i) => [
|
|
38
|
-
cfg.key,
|
|
39
|
-
results[i].status === 'fulfilled' ? results[i].value : { ok: false, ms: null },
|
|
40
|
-
])
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
return sources;
|
|
44
|
-
}
|
|
45
|
-
async probeSource(key) {
|
|
46
|
-
const cfg = SOURCES.find(cfg => cfg.key === key);
|
|
47
|
-
if (!cfg) throw new Error(`Source with key "${key}" not found`);
|
|
48
|
-
const mod = SOURCE_MODULES[key];
|
|
49
|
-
if (!mod) throw new Error(`Source module for key "${key}" not found`);
|
|
50
|
-
return await probeSource(this, cfg, mod);
|
|
51
|
-
}
|
|
52
|
-
async getStream(key, id, s = null, e = null, clientIP = null) {
|
|
53
|
-
const cfg = SOURCES.find(cfg => cfg.key === key);
|
|
54
|
-
if (!cfg) throw new Error(`Source with key "${key}" not found`);
|
|
55
|
-
const mod = SOURCE_MODULES[key];
|
|
56
|
-
if (!mod) throw new Error(`Source module for key "${key}" not found`);
|
|
57
|
-
const streamArgs = await createStreamArgs(cfg, this, id, s, e, clientIP);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
1
|
+
import SOURCES, { SOURCE_MAP } from "./config.js";
|
|
2
|
+
import { fetchDownloads } from "./downloads/downloads.js";
|
|
3
|
+
import { probeSource } from "./health.js";
|
|
4
|
+
import { getChapterPages, getMangaDetails, searchManga } from "./manga/atsu.js";
|
|
5
|
+
import { fetchSubtitles, getSubPathsMovie, getSubPathsTv } from "./subtitles.js";
|
|
6
|
+
import { createStreamArgs } from "./utils/helpers.js";
|
|
7
|
+
|
|
8
|
+
const ALL_SOURCE_MODULES = Object.fromEntries(
|
|
9
|
+
await Promise.all(SOURCES.map(async cfg => [cfg.key, await import(`./sources/${cfg.sourceFile}.js`)]))
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
const SOURCE_MODULES = Object.fromEntries(
|
|
13
|
+
Object.entries(ALL_SOURCE_MODULES).filter(([key]) => !SOURCE_MAP[key]?.disabled)
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export default class VylaSDK {
|
|
17
|
+
tmdbApiKey = null;
|
|
18
|
+
penguManifest = null;
|
|
19
|
+
constructor({ tmdbApiKey, penguManifest } = {}) {
|
|
20
|
+
this.tmdbApiKey = tmdbApiKey || null;
|
|
21
|
+
this.penguManifest = penguManifest || null;
|
|
22
|
+
}
|
|
23
|
+
getSources(excludeDisabled = false) {
|
|
24
|
+
if (excludeDisabled) {
|
|
25
|
+
return SOURCES.filter(cfg => !cfg.disabled);
|
|
26
|
+
}
|
|
27
|
+
return SOURCES;
|
|
28
|
+
}
|
|
29
|
+
async probeAllSources() {
|
|
30
|
+
const active = SOURCES.filter(cfg => !cfg.disabled);
|
|
31
|
+
|
|
32
|
+
const results = await Promise.allSettled(
|
|
33
|
+
active.map(async cfg => await probeSource(this, cfg, SOURCE_MODULES[cfg.key]))
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const sources = Object.fromEntries(
|
|
37
|
+
active.map((cfg, i) => [
|
|
38
|
+
cfg.key,
|
|
39
|
+
results[i].status === 'fulfilled' ? results[i].value : { ok: false, ms: null },
|
|
40
|
+
])
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return sources;
|
|
44
|
+
}
|
|
45
|
+
async probeSource(key) {
|
|
46
|
+
const cfg = SOURCES.find(cfg => cfg.key === key);
|
|
47
|
+
if (!cfg) throw new Error(`Source with key "${key}" not found`);
|
|
48
|
+
const mod = SOURCE_MODULES[key];
|
|
49
|
+
if (!mod) throw new Error(`Source module for key "${key}" not found`);
|
|
50
|
+
return await probeSource(this, cfg, mod);
|
|
51
|
+
}
|
|
52
|
+
async getStream(key, id, s = null, e = null, clientIP = null) {
|
|
53
|
+
const cfg = SOURCES.find(cfg => cfg.key === key);
|
|
54
|
+
if (!cfg) throw new Error(`Source with key "${key}" not found`);
|
|
55
|
+
const mod = SOURCE_MODULES[key];
|
|
56
|
+
if (!mod) throw new Error(`Source module for key "${key}" not found`);
|
|
57
|
+
const streamArgs = await createStreamArgs(cfg, this, id, s, e, clientIP);
|
|
58
|
+
const result = await mod.getStream(streamArgs);
|
|
59
|
+
if (result && typeof result === 'object') {
|
|
60
|
+
delete result.subtitles;
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
async getSubtitles(id, s = null, e = null) {
|
|
65
|
+
const paths = s != null && e != null
|
|
66
|
+
? await getSubPathsTv(id, s, e)
|
|
67
|
+
: await getSubPathsMovie(id);
|
|
68
|
+
return await fetchSubtitles(paths);
|
|
69
|
+
}
|
|
70
|
+
async getDownloads(id, s = null, e = null) {
|
|
71
|
+
return await fetchDownloads(this, id, s, e);
|
|
72
|
+
}
|
|
73
|
+
async searchManga(query, page = 1, perPage = 12) {
|
|
74
|
+
return await searchManga(query, page, perPage);
|
|
75
|
+
}
|
|
76
|
+
async getManga(id) {
|
|
77
|
+
return await getMangaDetails(id);
|
|
78
|
+
}
|
|
79
|
+
async getMangaChapter(mangaId, chapterId) {
|
|
80
|
+
return await getChapterPages(mangaId, chapterId);
|
|
81
|
+
}
|
|
82
|
+
}
|