react-native-consumet 0.4.0 → 0.4.2
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 +4 -1
- package/lib/commonjs/extractors/megaup.js +51 -27
- package/lib/commonjs/extractors/megaup.js.map +1 -1
- package/lib/commonjs/providers/anime/animepahe.js.map +1 -1
- package/lib/commonjs/providers/meta/anilist.js +30 -14
- package/lib/commonjs/providers/meta/anilist.js.map +1 -1
- package/lib/module/extractors/megaup.js +51 -27
- package/lib/module/extractors/megaup.js.map +1 -1
- package/lib/module/providers/anime/animepahe.js.map +1 -1
- package/lib/module/providers/meta/anilist.js +30 -14
- package/lib/module/providers/meta/anilist.js.map +1 -1
- package/lib/typescript/commonjs/src/extractors/megaup.d.ts +8 -1
- package/lib/typescript/commonjs/src/extractors/megaup.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/animepahe.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/meta/anilist.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/megaup.d.ts +8 -1
- package/lib/typescript/module/src/extractors/megaup.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/animepahe.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/meta/anilist.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/extractors/megaup.ts +59 -103
- package/src/providers/anime/animepahe.ts +0 -1
- package/src/providers/meta/anilist.ts +31 -20
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { type ISource, type IVideo, VideoExtractor } from '../models';
|
|
2
|
+
import { type AxiosAdapter } from 'axios';
|
|
3
|
+
import { type ProxyConfig } from '../models/types';
|
|
2
4
|
export declare class MegaUp extends VideoExtractor {
|
|
3
|
-
|
|
5
|
+
protected proxyConfig?: ProxyConfig | undefined;
|
|
6
|
+
protected adapter?: AxiosAdapter | undefined;
|
|
4
7
|
protected serverName: string;
|
|
5
8
|
protected sources: IVideo[];
|
|
9
|
+
private KAICODEX;
|
|
10
|
+
private kaicodexReady;
|
|
11
|
+
constructor(proxyConfig?: ProxyConfig | undefined, adapter?: AxiosAdapter | undefined);
|
|
12
|
+
private loadKAICODEX;
|
|
6
13
|
GenerateToken: (n: string) => string;
|
|
7
14
|
DecodeIframeData: (n: string) => string;
|
|
8
15
|
Decode: (n: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"megaup.d.ts","sourceRoot":"","sources":["../../../../../src/extractors/megaup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"megaup.d.ts","sourceRoot":"","sources":["../../../../../src/extractors/megaup.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAanD,qBAAa,MAAO,SAAQ,cAAc;IAmDtC,SAAS,CAAC,WAAW,CAAC,EAAE,WAAW;IACnC,SAAS,CAAC,OAAO,CAAC,EAAE,YAAY;IAnDlC,SAAS,CAAC,UAAU,EAAE,MAAM,CAAY;IACxC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,CAAM;IACjC,OAAO,CAAC,QAAQ,CAAY;IAC5B,OAAO,CAAC,aAAa,CAAgB;gBA+CzB,WAAW,CAAC,EAAE,WAAW,YAAA,EACzB,OAAO,CAAC,EAAE,YAAY,YAAA;YAMpB,YAAY;IAiB1B,aAAa,GAAI,GAAG,MAAM,YAExB;IAEF,gBAAgB,GAAI,GAAG,MAAM,YAE3B;IAEF,MAAM,GAAI,GAAG,MAAM,YAEjB;IAEO,OAAO,GAAU,UAAU,GAAG,KAAG,OAAO,CAAC,OAAO,CAAC,CAuBxD;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animepahe.d.ts","sourceRoot":"","sources":["../../../../../../src/providers/anime/animepahe.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,KAAK,OAAO,EACZ,KAAK,UAAU,EAEf,KAAK,YAAY,EACjB,KAAK,OAAO,EAEZ,KAAK,cAAc,EAEpB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"animepahe.d.ts","sourceRoot":"","sources":["../../../../../../src/providers/anime/animepahe.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,KAAK,OAAO,EACZ,KAAK,UAAU,EAEf,KAAK,YAAY,EACjB,KAAK,OAAO,EAEZ,KAAK,cAAc,EAEpB,MAAM,cAAc,CAAC;AAGtB,cAAM,SAAU,SAAQ,WAAW;IACjC,SAAkB,IAAI,eAAe;IACrC,UAAmB,OAAO,SAA0B;IACpD,UAAmB,IAAI,SAAuC;IAC9D,UAAmB,SAAS,SAAqB;IAIjD;;OAEG;IACM,MAAM,GAAU,OAAO,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAqBrE;IAEF;;;OAGG;IACM,cAAc,GAAU,IAAI,MAAM,EAAE,cAAa,MAAW,KAAG,OAAO,CAAC,UAAU,CAAC,CAoGzF;IAEF;;;OAGG;IACM,mBAAmB,GAAU,WAAW,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC,CA+BxE;IAEF,OAAO,CAAC,aAAa,CAmBnB;IAEF;;;OAGG;IACM,mBAAmB,GAAI,aAAa,MAAM,KAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAE7E;IAEF,OAAO,CAAC,OAAO;CAkBhB;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anilist.d.ts","sourceRoot":"","sources":["../../../../../../src/providers/meta/anilist.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EACL,WAAW,EACX,KAAK,OAAO,EACZ,KAAK,UAAU,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library providing access to entertainment media information (anime, movies, manga, etc.) from multiple sources, adapting the Consumet API for mobile applications.",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|
package/src/extractors/megaup.ts
CHANGED
|
@@ -1,22 +1,44 @@
|
|
|
1
1
|
//extractor for https://animekai.to
|
|
2
2
|
|
|
3
|
+
// The code for this is now fetched from outside consumet:
|
|
4
|
+
// https://raw.githubusercontent.com/amarullz/kaicodex/refs/heads/main/generated/kai_codex.js
|
|
5
|
+
// as this repository auto-updates the extraction keys when they change.
|
|
6
|
+
// If something breaks in the future, blame this part.
|
|
7
|
+
|
|
3
8
|
import { type ISource, type IVideo, VideoExtractor } from '../models';
|
|
9
|
+
import { type AxiosAdapter } from 'axios';
|
|
10
|
+
import { type ProxyConfig } from '../models/types';
|
|
11
|
+
|
|
12
|
+
interface KaiCodex {
|
|
13
|
+
rc4: (key: string, str: string) => string;
|
|
14
|
+
safeBtoa: (s: string) => string;
|
|
15
|
+
safeAtob: (s: string) => string;
|
|
16
|
+
reverseString: (s: string) => string;
|
|
17
|
+
replaceChars: (s: string, f: string, r: string) => string;
|
|
18
|
+
enc: (n: string) => string;
|
|
19
|
+
dec: (n: string) => string;
|
|
20
|
+
decMega: (n: string) => string;
|
|
21
|
+
}
|
|
4
22
|
|
|
5
23
|
export class MegaUp extends VideoExtractor {
|
|
6
24
|
protected serverName: string = 'MegaUp';
|
|
7
25
|
protected sources: IVideo[] = [];
|
|
26
|
+
private KAICODEX!: KaiCodex;
|
|
27
|
+
private kaicodexReady: Promise<void>;
|
|
28
|
+
|
|
29
|
+
/* Old decrypting functions in case the new ones break
|
|
8
30
|
|
|
9
31
|
#reverseIt = (n: string) => {
|
|
10
32
|
return n.split('').reverse().join('');
|
|
11
33
|
};
|
|
12
34
|
#base64UrlEncode = (str: string) => {
|
|
13
|
-
return btoa(str).replace(/\+/g, '-').replace(/\//g, '_').replace(
|
|
35
|
+
return btoa(str).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
|
|
14
36
|
};
|
|
15
37
|
#substitute = (input: string, keys: string, values: string) => {
|
|
16
38
|
const map = Object.fromEntries(keys.split('').map((key, i) => [key, values[i] || '']));
|
|
17
39
|
const a = input
|
|
18
40
|
.split('')
|
|
19
|
-
.map(
|
|
41
|
+
.map(char => map[char] || char)
|
|
20
42
|
.join('');
|
|
21
43
|
return a;
|
|
22
44
|
};
|
|
@@ -26,18 +48,13 @@ export class MegaUp extends VideoExtractor {
|
|
|
26
48
|
f = '';
|
|
27
49
|
|
|
28
50
|
for (let w = 0; w < 256; w++) {
|
|
29
|
-
// @ts-ignore
|
|
30
51
|
c = (c + v[w] + n.charCodeAt(w % n.length)) % 256;
|
|
31
|
-
// @ts-ignore
|
|
32
52
|
[v[w], v[c]] = [v[c], v[w]];
|
|
33
53
|
}
|
|
34
54
|
for (let a = (c = 0), w = 0; a < t.length; a++) {
|
|
35
55
|
w = (w + 1) % 256;
|
|
36
|
-
// @ts-ignore
|
|
37
56
|
c = (c + v[w]) % 256;
|
|
38
|
-
// @ts-ignore
|
|
39
57
|
[v[w], v[c]] = [v[c], v[w]];
|
|
40
|
-
// @ts-ignore
|
|
41
58
|
f += String.fromCharCode(t.charCodeAt(a) ^ v[(v[w] + v[c]) % 256]);
|
|
42
59
|
}
|
|
43
60
|
|
|
@@ -50,115 +67,54 @@ export class MegaUp extends VideoExtractor {
|
|
|
50
67
|
.replace(/_/g, '/');
|
|
51
68
|
return atob(n);
|
|
52
69
|
};
|
|
70
|
+
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
constructor(
|
|
74
|
+
protected proxyConfig?: ProxyConfig,
|
|
75
|
+
protected adapter?: AxiosAdapter
|
|
76
|
+
) {
|
|
77
|
+
super(proxyConfig, adapter);
|
|
78
|
+
this.kaicodexReady = this.loadKAICODEX();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private async loadKAICODEX(): Promise<void> {
|
|
82
|
+
const extraction_code =
|
|
83
|
+
'https://raw.githubusercontent.com/amarullz/kaicodex/refs/heads/main/generated/kai_codex.js';
|
|
84
|
+
|
|
85
|
+
const response = await fetch(extraction_code);
|
|
86
|
+
const originalCode = await response.text();
|
|
87
|
+
|
|
88
|
+
const wrappedCode = `
|
|
89
|
+
${originalCode}
|
|
90
|
+
return KAICODEX;
|
|
91
|
+
`;
|
|
92
|
+
|
|
93
|
+
// eslint-disable-next-line no-new-func
|
|
94
|
+
const fn = new Function(wrappedCode);
|
|
95
|
+
this.KAICODEX = fn();
|
|
96
|
+
}
|
|
53
97
|
|
|
54
98
|
GenerateToken = (n: string) => {
|
|
55
|
-
|
|
56
|
-
return (n = this.#base64UrlEncode(
|
|
57
|
-
this.#substitute(
|
|
58
|
-
this.#base64UrlEncode(
|
|
59
|
-
this.#transform(
|
|
60
|
-
'sXmH96C4vhRrgi8',
|
|
61
|
-
this.#reverseIt(
|
|
62
|
-
this.#reverseIt(
|
|
63
|
-
this.#base64UrlEncode(
|
|
64
|
-
this.#transform(
|
|
65
|
-
'kOCJnByYmfI',
|
|
66
|
-
this.#substitute(
|
|
67
|
-
this.#substitute(
|
|
68
|
-
this.#reverseIt(this.#base64UrlEncode(this.#transform('0DU8ksIVlFcia2', n))),
|
|
69
|
-
'1wctXeHqb2',
|
|
70
|
-
'1tecHq2Xbw'
|
|
71
|
-
),
|
|
72
|
-
'48KbrZx1ml',
|
|
73
|
-
'Km8Zb4lxr1'
|
|
74
|
-
)
|
|
75
|
-
)
|
|
76
|
-
)
|
|
77
|
-
)
|
|
78
|
-
)
|
|
79
|
-
)
|
|
80
|
-
),
|
|
81
|
-
'hTn79AMjduR5',
|
|
82
|
-
'djn5uT7AMR9h'
|
|
83
|
-
)
|
|
84
|
-
));
|
|
99
|
+
return this.KAICODEX.enc(n);
|
|
85
100
|
};
|
|
101
|
+
|
|
86
102
|
DecodeIframeData = (n: string) => {
|
|
87
|
-
|
|
88
|
-
n = this.#transform(
|
|
89
|
-
'0DU8ksIVlFcia2',
|
|
90
|
-
this.#base64UrlDecode(
|
|
91
|
-
this.#reverseIt(
|
|
92
|
-
this.#substitute(
|
|
93
|
-
this.#substitute(
|
|
94
|
-
this.#transform(
|
|
95
|
-
'kOCJnByYmfI',
|
|
96
|
-
this.#base64UrlDecode(
|
|
97
|
-
this.#reverseIt(
|
|
98
|
-
this.#reverseIt(
|
|
99
|
-
this.#transform(
|
|
100
|
-
'sXmH96C4vhRrgi8',
|
|
101
|
-
this.#base64UrlDecode(
|
|
102
|
-
this.#substitute(this.#base64UrlDecode(n), 'djn5uT7AMR9h', 'hTn79AMjduR5')
|
|
103
|
-
)
|
|
104
|
-
)
|
|
105
|
-
)
|
|
106
|
-
)
|
|
107
|
-
)
|
|
108
|
-
),
|
|
109
|
-
'Km8Zb4lxr1',
|
|
110
|
-
'48KbrZx1ml'
|
|
111
|
-
),
|
|
112
|
-
'1tecHq2Xbw',
|
|
113
|
-
'1wctXeHqb2'
|
|
114
|
-
)
|
|
115
|
-
)
|
|
116
|
-
)
|
|
117
|
-
);
|
|
118
|
-
return decodeURIComponent(n);
|
|
103
|
+
return this.KAICODEX.dec(n);
|
|
119
104
|
};
|
|
105
|
+
|
|
120
106
|
Decode = (n: string) => {
|
|
121
|
-
|
|
122
|
-
this.#transform(
|
|
123
|
-
'XvxVdt4eTSnCyG',
|
|
124
|
-
this.#base64UrlDecode(
|
|
125
|
-
this.#reverseIt(
|
|
126
|
-
this.#transform(
|
|
127
|
-
'ENZqBfw54cgsJ',
|
|
128
|
-
this.#base64UrlDecode(
|
|
129
|
-
this.#reverseIt(
|
|
130
|
-
this.#substitute(
|
|
131
|
-
this.#transform(
|
|
132
|
-
'HCcYA9gQqxUD',
|
|
133
|
-
this.#base64UrlDecode(
|
|
134
|
-
this.#substitute(
|
|
135
|
-
this.#reverseIt(this.#base64UrlDecode(n)),
|
|
136
|
-
'OdilCbZWmrtUeYg',
|
|
137
|
-
'YirdmeZblOtgCWU'
|
|
138
|
-
)
|
|
139
|
-
)
|
|
140
|
-
),
|
|
141
|
-
'K9lQq2SsnjkObe',
|
|
142
|
-
'l9j2sSnekQOqKb'
|
|
143
|
-
)
|
|
144
|
-
)
|
|
145
|
-
)
|
|
146
|
-
)
|
|
147
|
-
)
|
|
148
|
-
)
|
|
149
|
-
),
|
|
150
|
-
'nMW7qCTpe6SQhco',
|
|
151
|
-
'nqce7WMQC6pSTho'
|
|
152
|
-
);
|
|
153
|
-
return decodeURIComponent(n);
|
|
107
|
+
return this.KAICODEX.decMega(n);
|
|
154
108
|
};
|
|
155
109
|
|
|
156
110
|
override extract = async (videoUrl: URL): Promise<ISource> => {
|
|
157
111
|
try {
|
|
112
|
+
await this.kaicodexReady;
|
|
113
|
+
|
|
158
114
|
const url = videoUrl.href.replace(/\/(e|e2)\//, '/media/');
|
|
159
115
|
const res = await this.client.get(url);
|
|
160
116
|
|
|
161
|
-
const decrypted = JSON.parse(this.
|
|
117
|
+
const decrypted = JSON.parse(this.KAICODEX.decMega(res.data.result).replace(/\\/g, ''));
|
|
162
118
|
const data: ISource = {
|
|
163
119
|
sources: decrypted.sources.map((s: { file: string }) => ({
|
|
164
120
|
url: s.file,
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
type IAnimeResult,
|
|
9
9
|
type ISource,
|
|
10
10
|
type IAnimeEpisode,
|
|
11
|
-
SubOrSub,
|
|
12
11
|
type IEpisodeServer,
|
|
13
12
|
Genres,
|
|
14
13
|
MangaParser,
|
|
@@ -23,7 +22,6 @@ import {
|
|
|
23
22
|
import {
|
|
24
23
|
anilistSearchQuery,
|
|
25
24
|
anilistMediaDetailQuery,
|
|
26
|
-
kitsuSearchQuery,
|
|
27
25
|
anilistTrendingQuery,
|
|
28
26
|
anilistPopularQuery,
|
|
29
27
|
anilistAiringScheduleQuery,
|
|
@@ -32,7 +30,6 @@ import {
|
|
|
32
30
|
anilistSiteStatisticsQuery,
|
|
33
31
|
anilistCharacterQuery,
|
|
34
32
|
anilistStaffInfoQuery,
|
|
35
|
-
range,
|
|
36
33
|
getDays,
|
|
37
34
|
capitalizeFirstLetter,
|
|
38
35
|
} from '../../utils';
|
|
@@ -718,10 +715,10 @@ class Anilist extends AnimeParser {
|
|
|
718
715
|
title.romaji = title.romaji.toLowerCase();
|
|
719
716
|
|
|
720
717
|
if (title.english === title.romaji) {
|
|
721
|
-
console.log(
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
);
|
|
718
|
+
// console.log(
|
|
719
|
+
// 'findAnime',
|
|
720
|
+
// await this.findAnimeSlug(title.english, season, startDate, malId, anilistId, externalLinks)
|
|
721
|
+
// );
|
|
725
722
|
return (await this.findAnimeSlug(title.english, season, startDate, malId, anilistId, externalLinks)) ?? [];
|
|
726
723
|
}
|
|
727
724
|
|
|
@@ -746,8 +743,8 @@ class Anilist extends AnimeParser {
|
|
|
746
743
|
anilistId,
|
|
747
744
|
externalLinks
|
|
748
745
|
);
|
|
749
|
-
console.log('romajiPossibleEpisodes', romajiPossibleEpisodes);
|
|
750
|
-
console.log('englishPossibleEpisodes', englishPossibleEpisodes);
|
|
746
|
+
// console.log('romajiPossibleEpisodes', romajiPossibleEpisodes);
|
|
747
|
+
// console.log('englishPossibleEpisodes', englishPossibleEpisodes);
|
|
751
748
|
return englishPossibleEpisodes ?? [];
|
|
752
749
|
};
|
|
753
750
|
|
|
@@ -838,7 +835,7 @@ class Anilist extends AnimeParser {
|
|
|
838
835
|
// }
|
|
839
836
|
|
|
840
837
|
const possibleProviderEpisodes = possibleAnime.episodes as IAnimeEpisode[];
|
|
841
|
-
console.log('possibleProviderEpisodes', possibleProviderEpisodes);
|
|
838
|
+
// console.log('possibleProviderEpisodes', possibleProviderEpisodes);
|
|
842
839
|
return possibleProviderEpisodes;
|
|
843
840
|
// if (
|
|
844
841
|
// typeof possibleProviderEpisodes[0]?.image !== 'undefined' &&
|
|
@@ -1372,7 +1369,7 @@ class Anilist extends AnimeParser {
|
|
|
1372
1369
|
id,
|
|
1373
1370
|
Media.externalLinks
|
|
1374
1371
|
);
|
|
1375
|
-
console.log('fetchDefaultEpisodeList', episodes);
|
|
1372
|
+
// console.log('fetchDefaultEpisodeList', episodes);
|
|
1376
1373
|
return episodes;
|
|
1377
1374
|
};
|
|
1378
1375
|
|
|
@@ -1420,17 +1417,31 @@ class Anilist extends AnimeParser {
|
|
|
1420
1417
|
createdAt: item.airDate ?? item.airdate ?? item.airDateUtc,
|
|
1421
1418
|
}))!;
|
|
1422
1419
|
|
|
1423
|
-
function mergeEpisodes(
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1420
|
+
function mergeEpisodes(normalizedEpisodes: any[], providerEpisodes: IAnimeEpisode[]): IAnimeEpisode[] {
|
|
1421
|
+
// Create a map using only episode numbers as keys
|
|
1422
|
+
const normalizedMap = new Map(normalizedEpisodes.map((item) => [item.number, item]));
|
|
1423
|
+
|
|
1424
|
+
// Merge the episodes
|
|
1425
|
+
return providerEpisodes.map((providerEp) => {
|
|
1426
|
+
const normalizedEp = normalizedMap.get(providerEp.number);
|
|
1427
|
+
if (!normalizedEp) return providerEp;
|
|
1428
|
+
|
|
1429
|
+
// Merge the episodes, prioritizing certain fields from each source
|
|
1430
|
+
return {
|
|
1431
|
+
...providerEp,
|
|
1432
|
+
title: normalizedEp.title || providerEp.title,
|
|
1433
|
+
description: normalizedEp.description || providerEp.description,
|
|
1434
|
+
image: normalizedEp.image || providerEp.image,
|
|
1435
|
+
imageHash: normalizedEp.imageHash || providerEp.imageHash,
|
|
1436
|
+
createdAt: normalizedEp.createdAt || providerEp.createdAt,
|
|
1437
|
+
};
|
|
1432
1438
|
});
|
|
1433
1439
|
}
|
|
1440
|
+
// console.log({
|
|
1441
|
+
// normalizedEpisodes,
|
|
1442
|
+
// providerEpisodes,
|
|
1443
|
+
// merged: mergeEpisodes(normalizedEpisodes, providerEpisodes),
|
|
1444
|
+
// });
|
|
1434
1445
|
possibleAnimeEpisodes = mergeEpisodes(normalizedEpisodes, providerEpisodes);
|
|
1435
1446
|
if (!possibleAnimeEpisodes.length) {
|
|
1436
1447
|
possibleAnimeEpisodes = await this.fetchDefaultEpisodeList(Media, id);
|