react-native-consumet 0.4.0 → 0.4.1
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 -0
- 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.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.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 +0 -3
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';
|