react-native-consumet 1.4.0 → 1.6.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/Consumet.podspec +9 -0
- package/README.md +7 -0
- package/android/generated/jni/CMakeLists.txt +1 -9
- package/android/generated/jni/react/renderer/components/RNConsumetSpec/RNConsumetSpecJSI.h +65 -92
- package/ios/Consumet.h +1 -1
- package/ios/Consumet.mm +681 -7
- package/ios/generated/Package.swift +66 -0
- package/ios/generated/ReactAppDependencyProvider/RCTAppDependencyProvider.h +25 -0
- package/ios/generated/ReactAppDependencyProvider/RCTAppDependencyProvider.mm +40 -0
- package/ios/generated/ReactAppDependencyProvider/ReactAppDependencyProvider.podspec +34 -0
- package/ios/generated/ReactCodegen/RCTModuleProviders.h +16 -0
- package/ios/generated/ReactCodegen/RCTModuleProviders.mm +51 -0
- package/ios/generated/ReactCodegen/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/ios/generated/ReactCodegen/RCTModulesConformingToProtocolsProvider.mm +54 -0
- package/ios/generated/ReactCodegen/RCTThirdPartyComponentsProvider.h +16 -0
- package/ios/generated/ReactCodegen/RCTThirdPartyComponentsProvider.mm +30 -0
- package/ios/generated/ReactCodegen/RCTUnstableModulesRequiringMainQueueSetupProvider.h +14 -0
- package/ios/generated/ReactCodegen/RCTUnstableModulesRequiringMainQueueSetupProvider.mm +19 -0
- package/ios/generated/ReactCodegen/RNConsumetSpecJSI.h +98 -0
- package/ios/generated/ReactCodegen/ReactCodegen.podspec +114 -0
- package/lib/commonjs/extension-registry.json +106 -29
- package/lib/commonjs/extractors/flixcloud.js +179 -0
- package/lib/commonjs/extractors/flixcloud.js.map +1 -0
- package/lib/commonjs/extractors/index.js +7 -0
- package/lib/commonjs/extractors/index.js.map +1 -1
- package/lib/commonjs/extractors/kwik.js +59 -74
- package/lib/commonjs/extractors/kwik.js.map +1 -1
- package/lib/commonjs/extractors/megaplay.js +196 -124
- package/lib/commonjs/extractors/megaplay.js.map +1 -1
- package/lib/commonjs/extractors/vidhide.js +9 -2
- package/lib/commonjs/extractors/vidhide.js.map +1 -1
- package/lib/commonjs/models/types.js +1 -0
- package/lib/commonjs/models/types.js.map +1 -1
- package/lib/commonjs/providers/anime/anikoto/create-anikoto.js +11 -4
- package/lib/commonjs/providers/anime/anikoto/create-anikoto.js.map +1 -1
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js +107 -137
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/commonjs/providers/anime/anineko/anineko.js +31 -0
- package/lib/commonjs/providers/anime/anineko/anineko.js.map +1 -0
- package/lib/commonjs/providers/anime/anineko/create-anineko.js +447 -0
- package/lib/commonjs/providers/anime/anineko/create-anineko.js.map +1 -0
- package/lib/commonjs/providers/anime/index.js +9 -1
- package/lib/commonjs/providers/anime/index.js.map +1 -1
- package/lib/commonjs/providers/anime/reanime/create-reanime.js +255 -0
- package/lib/commonjs/providers/anime/reanime/create-reanime.js.map +1 -0
- package/lib/commonjs/providers/anime/reanime/reanime.js +31 -0
- package/lib/commonjs/providers/anime/reanime/reanime.js.map +1 -0
- package/lib/commonjs/providers/movies/vegamovies/create-vegamovies.js +11 -11
- package/lib/commonjs/providers/movies/vegamovies/create-vegamovies.js.map +1 -1
- package/lib/commonjs/utils/ExtractorManager.js +21 -28
- package/lib/commonjs/utils/ExtractorManager.js.map +1 -1
- package/lib/commonjs/utils/ProviderManager.js +31 -34
- package/lib/commonjs/utils/ProviderManager.js.map +1 -1
- package/lib/commonjs/utils/create-extractor-context.js +3 -0
- package/lib/commonjs/utils/create-extractor-context.js.map +1 -1
- package/lib/commonjs/utils/create-provider-context.js +2 -0
- package/lib/commonjs/utils/create-provider-context.js.map +1 -1
- package/lib/commonjs/utils/extension-utils.js +6 -2
- package/lib/commonjs/utils/extension-utils.js.map +1 -1
- package/lib/module/extension-registry.json +106 -29
- package/lib/module/extractors/flixcloud.js +174 -0
- package/lib/module/extractors/flixcloud.js.map +1 -0
- package/lib/module/extractors/index.js +2 -1
- package/lib/module/extractors/index.js.map +1 -1
- package/lib/module/extractors/kwik.js +58 -74
- package/lib/module/extractors/kwik.js.map +1 -1
- package/lib/module/extractors/megaplay.js +196 -123
- package/lib/module/extractors/megaplay.js.map +1 -1
- package/lib/module/extractors/vidhide.js +8 -2
- package/lib/module/extractors/vidhide.js.map +1 -1
- package/lib/module/models/types.js +1 -0
- package/lib/module/models/types.js.map +1 -1
- package/lib/module/providers/anime/anikoto/create-anikoto.js +11 -4
- package/lib/module/providers/anime/anikoto/create-anikoto.js.map +1 -1
- package/lib/module/providers/anime/animepahe/create-animepahe.js +107 -138
- package/lib/module/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/module/providers/anime/anineko/anineko.js +25 -0
- package/lib/module/providers/anime/anineko/anineko.js.map +1 -0
- package/lib/module/providers/anime/anineko/create-anineko.js +443 -0
- package/lib/module/providers/anime/anineko/create-anineko.js.map +1 -0
- package/lib/module/providers/anime/index.js +9 -1
- package/lib/module/providers/anime/index.js.map +1 -1
- package/lib/module/providers/anime/reanime/create-reanime.js +251 -0
- package/lib/module/providers/anime/reanime/create-reanime.js.map +1 -0
- package/lib/module/providers/anime/reanime/reanime.js +25 -0
- package/lib/module/providers/anime/reanime/reanime.js.map +1 -0
- package/lib/module/providers/movies/vegamovies/create-vegamovies.js +11 -11
- package/lib/module/providers/movies/vegamovies/create-vegamovies.js.map +1 -1
- package/lib/module/utils/ExtractorManager.js +21 -28
- package/lib/module/utils/ExtractorManager.js.map +1 -1
- package/lib/module/utils/ProviderManager.js +31 -34
- package/lib/module/utils/ProviderManager.js.map +1 -1
- package/lib/module/utils/create-extractor-context.js +2 -0
- package/lib/module/utils/create-extractor-context.js.map +1 -1
- package/lib/module/utils/create-provider-context.js +2 -0
- package/lib/module/utils/create-provider-context.js.map +1 -1
- package/lib/module/utils/extension-utils.js +7 -3
- package/lib/module/utils/extension-utils.js.map +1 -1
- package/lib/typescript/commonjs/src/extractors/flixcloud.d.ts +18 -0
- package/lib/typescript/commonjs/src/extractors/flixcloud.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/extractors/index.d.ts +2 -1
- package/lib/typescript/commonjs/src/extractors/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/kwik.d.ts +1 -0
- package/lib/typescript/commonjs/src/extractors/kwik.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/megaplay.d.ts +1 -1
- package/lib/typescript/commonjs/src/extractors/megaplay.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/vidhide.d.ts +1 -0
- package/lib/typescript/commonjs/src/extractors/vidhide.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/extension-manifest.d.ts +4 -0
- package/lib/typescript/commonjs/src/models/extension-manifest.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/extractor-context.d.ts +3 -0
- package/lib/typescript/commonjs/src/models/extractor-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/provider-context.d.ts +6 -0
- package/lib/typescript/commonjs/src/models/provider-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/types.d.ts +2 -1
- package/lib/typescript/commonjs/src/models/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/anikoto/create-anikoto.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/anineko/anineko.d.ts +23 -0
- package/lib/typescript/commonjs/src/providers/anime/anineko/anineko.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/anime/anineko/create-anineko.d.ts +52 -0
- package/lib/typescript/commonjs/src/providers/anime/anineko/create-anineko.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/anime/index.d.ts +8 -0
- package/lib/typescript/commonjs/src/providers/anime/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/reanime/create-reanime.d.ts +18 -0
- package/lib/typescript/commonjs/src/providers/anime/reanime/create-reanime.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/anime/reanime/reanime.d.ts +19 -0
- package/lib/typescript/commonjs/src/providers/anime/reanime/reanime.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/ExtractorManager.d.ts +1 -0
- package/lib/typescript/commonjs/src/utils/ExtractorManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts +5 -4
- package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/create-extractor-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/create-provider-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/extension-utils.d.ts +2 -0
- package/lib/typescript/commonjs/src/utils/extension-utils.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/flixcloud.d.ts +18 -0
- package/lib/typescript/module/src/extractors/flixcloud.d.ts.map +1 -0
- package/lib/typescript/module/src/extractors/index.d.ts +2 -1
- package/lib/typescript/module/src/extractors/index.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/kwik.d.ts +1 -0
- package/lib/typescript/module/src/extractors/kwik.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/megaplay.d.ts +1 -1
- package/lib/typescript/module/src/extractors/megaplay.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/vidhide.d.ts +1 -0
- package/lib/typescript/module/src/extractors/vidhide.d.ts.map +1 -1
- package/lib/typescript/module/src/models/extension-manifest.d.ts +4 -0
- package/lib/typescript/module/src/models/extension-manifest.d.ts.map +1 -1
- package/lib/typescript/module/src/models/extractor-context.d.ts +3 -0
- package/lib/typescript/module/src/models/extractor-context.d.ts.map +1 -1
- package/lib/typescript/module/src/models/provider-context.d.ts +6 -0
- package/lib/typescript/module/src/models/provider-context.d.ts.map +1 -1
- package/lib/typescript/module/src/models/types.d.ts +2 -1
- package/lib/typescript/module/src/models/types.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/anikoto/create-anikoto.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/anineko/anineko.d.ts +23 -0
- package/lib/typescript/module/src/providers/anime/anineko/anineko.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/anime/anineko/create-anineko.d.ts +52 -0
- package/lib/typescript/module/src/providers/anime/anineko/create-anineko.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/anime/index.d.ts +8 -0
- package/lib/typescript/module/src/providers/anime/index.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/reanime/create-reanime.d.ts +18 -0
- package/lib/typescript/module/src/providers/anime/reanime/create-reanime.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/anime/reanime/reanime.d.ts +19 -0
- package/lib/typescript/module/src/providers/anime/reanime/reanime.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/ExtractorManager.d.ts +1 -0
- package/lib/typescript/module/src/utils/ExtractorManager.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/ProviderManager.d.ts +5 -4
- package/lib/typescript/module/src/utils/ProviderManager.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/create-extractor-context.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/create-provider-context.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/extension-utils.d.ts +2 -0
- package/lib/typescript/module/src/utils/extension-utils.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/extension-registry.json +106 -29
- package/src/extractors/flixcloud.ts +139 -0
- package/src/extractors/index.ts +2 -0
- package/src/extractors/kwik.ts +74 -93
- package/src/extractors/megaplay.ts +205 -133
- package/src/extractors/vidhide.ts +12 -4
- package/src/models/extension-manifest.ts +5 -0
- package/src/models/extractor-context.ts +3 -0
- package/src/models/provider-context.ts +6 -0
- package/src/models/types.ts +1 -0
- package/src/providers/anime/anikoto/create-anikoto.ts +10 -3
- package/src/providers/anime/animepahe/create-animepahe.ts +118 -158
- package/src/providers/anime/anineko/anineko.ts +44 -0
- package/src/providers/anime/anineko/create-anineko.ts +489 -0
- package/src/providers/anime/index.ts +8 -0
- package/src/providers/anime/reanime/create-reanime.ts +283 -0
- package/src/providers/anime/reanime/reanime.ts +41 -0
- package/src/providers/movies/vegamovies/create-vegamovies.ts +11 -11
- package/src/utils/ExtractorManager.ts +23 -27
- package/src/utils/ProviderManager.ts +33 -33
- package/src/utils/create-extractor-context.ts +2 -0
- package/src/utils/create-provider-context.ts +2 -0
- package/src/utils/extension-utils.ts +5 -0
- package/android/generated/jni/react/renderer/components/RNConsumetSpec/RNConsumetSpecJSI-generated.cpp +0 -75
- package/ios/generated/RNConsumetSpecJSI-generated.cpp +0 -75
- package/ios/generated/RNConsumetSpecJSI.h +0 -125
- /package/ios/generated/{RNConsumetSpec → ReactCodegen/RNConsumetSpec}/RNConsumetSpec-generated.mm +0 -0
- /package/ios/generated/{RNConsumetSpec → ReactCodegen/RNConsumetSpec}/RNConsumetSpec.h +0 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { type ExtractorContext, type IVideo, type ISource, type IVideoExtractor } from '../models';
|
|
2
|
+
import type { PolyURL } from '../utils/url-polyfill';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* FlixCloud extractor — uses enc-dec.app as the decryption relay.
|
|
6
|
+
*
|
|
7
|
+
* Pipeline:
|
|
8
|
+
* 1. Fetch the embed page; extract the inline SSR data object.
|
|
9
|
+
* 2. POST data to enc-dec.app/api/dec-flixcloud?type=token → {token, context}
|
|
10
|
+
* 3. GET flixcloud.cc/api/m3u8/{token} → encrypted blob
|
|
11
|
+
* 4. POST {context, stream_response} to enc-dec.app/api/dec-flixcloud?type=stream
|
|
12
|
+
* → {stream: encryptedM3u8Url, context: {w_payload, …}}
|
|
13
|
+
* 5. GET enc-dec.app/api/parse-flixcloud?url=…&w_payload=… → decrypted m3u8 text
|
|
14
|
+
* Return this URL as the HLS source — the player fetches it; enc-dec.app serves
|
|
15
|
+
* the plain manifest and the player's native HLS handles segment decryption via
|
|
16
|
+
* the #EXT-X-KEY lines embedded in the manifest.
|
|
17
|
+
*/
|
|
18
|
+
export function FlixCloud(ctx: ExtractorContext): IVideoExtractor {
|
|
19
|
+
const serverName = 'FlixCloud';
|
|
20
|
+
const sources: IVideo[] = [];
|
|
21
|
+
const { axios } = ctx;
|
|
22
|
+
|
|
23
|
+
const UA =
|
|
24
|
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36';
|
|
25
|
+
|
|
26
|
+
const ENC_DEC_API = 'https://enc-dec.app/api';
|
|
27
|
+
|
|
28
|
+
// ── JS-object → JSON ───────────────────────────────────────────────────────
|
|
29
|
+
// The SSR page embeds a JS object literal (unquoted keys, single-quoted strings).
|
|
30
|
+
// Convert it to valid JSON so we can JSON.parse without eval/json5.
|
|
31
|
+
|
|
32
|
+
const js2json = (raw: string): string =>
|
|
33
|
+
raw
|
|
34
|
+
// Quote unquoted identifier keys {foo: → {"foo":
|
|
35
|
+
.replace(/([{,]\s*)([a-zA-Z_$][a-zA-Z0-9_$]*)\s*:/g, '$1"$2":')
|
|
36
|
+
// Single-quoted string values → double-quoted
|
|
37
|
+
.replace(/'([^'\\]*(?:\\.[^'\\]*)*)'/g, '"$1"')
|
|
38
|
+
// Trailing commas before } or ]
|
|
39
|
+
.replace(/,(\s*[}\]])/g, '$1');
|
|
40
|
+
|
|
41
|
+
// ── extract ────────────────────────────────────────────────────────────────
|
|
42
|
+
|
|
43
|
+
// @ts-ignore – PolyURL accepted as-is
|
|
44
|
+
const extract = async (videoUrl: PolyURL, referer?: string): Promise<ISource> => {
|
|
45
|
+
const embedUrl = typeof videoUrl === 'string' ? videoUrl : (videoUrl as any).href;
|
|
46
|
+
const origin = embedUrl.match(/^https?:\/\/[^/]+/)?.[0] ?? 'https://flixcloud.cc';
|
|
47
|
+
|
|
48
|
+
// ── Step 1: fetch embed page ───────────────────────────────────────────
|
|
49
|
+
const { data: html } = await axios.get<string>(embedUrl, {
|
|
50
|
+
headers: { 'User-Agent': UA, 'Referer': referer ?? `${origin}/`, 'Accept': 'text/html' },
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// ── Step 2: extract inline data object ────────────────────────────────
|
|
54
|
+
// Pattern: type: "data", data: { … }, uses:
|
|
55
|
+
const objMatch = html.match(/type:\s*"data",\s*data:\s*(\{[\s\S]*?\})\s*,\s*uses:/);
|
|
56
|
+
if (!objMatch) throw new Error('[FlixCloud] Inline data object not found in embed page');
|
|
57
|
+
|
|
58
|
+
let dataObj: Record<string, any>;
|
|
59
|
+
try {
|
|
60
|
+
dataObj = JSON.parse(js2json(objMatch[1]!));
|
|
61
|
+
} catch (e) {
|
|
62
|
+
throw new Error(`[FlixCloud] Failed to parse inline data object: ${e}`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Separate subtitles so we don't send them to the token API
|
|
66
|
+
const { subtitles: rawSubs, ...payloadData } = dataObj;
|
|
67
|
+
|
|
68
|
+
// ── Step 3: resolve stream token via enc-dec.app ───────────────────────
|
|
69
|
+
const tokenResp = await axios.post<{ status: number; result?: { token: string; context: any }; error?: string }>(
|
|
70
|
+
`${ENC_DEC_API}/dec-flixcloud?type=token`,
|
|
71
|
+
{ data: payloadData },
|
|
72
|
+
{ headers: { 'Content-Type': 'application/json', 'User-Agent': UA } }
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
if (tokenResp.data.status !== 200 || !tokenResp.data.result) {
|
|
76
|
+
throw new Error(`[FlixCloud] Token API error: ${tokenResp.data.error ?? 'unknown'}`);
|
|
77
|
+
}
|
|
78
|
+
const { token, context } = tokenResp.data.result;
|
|
79
|
+
|
|
80
|
+
// ── Step 4: fetch encrypted stream from FlixCloud ─────────────────────
|
|
81
|
+
const { data: streamData } = await axios.get<Record<string, string>>(`${origin}/api/m3u8/${token}`, {
|
|
82
|
+
headers: { 'Referer': embedUrl, 'User-Agent': UA },
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// ── Step 5: decrypt via enc-dec.app ───────────────────────────────────
|
|
86
|
+
const decResp = await axios.post<{
|
|
87
|
+
status: number;
|
|
88
|
+
result?: { stream: string; context: { w_payload: string; [k: string]: any } };
|
|
89
|
+
error?: string;
|
|
90
|
+
}>(
|
|
91
|
+
`${ENC_DEC_API}/dec-flixcloud?type=stream`,
|
|
92
|
+
{ data: { context, stream_response: streamData } },
|
|
93
|
+
{ headers: { 'Content-Type': 'application/json', 'User-Agent': UA } }
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
if (decResp.data.status !== 200 || !decResp.data.result?.stream) {
|
|
97
|
+
throw new Error(`[FlixCloud] Stream API error: ${decResp.data.error ?? 'unknown'}`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const { stream: encryptedM3u8Url, context: streamContext } = decResp.data.result;
|
|
101
|
+
const wPayload = streamContext?.w_payload;
|
|
102
|
+
|
|
103
|
+
if (!wPayload) {
|
|
104
|
+
throw new Error('[FlixCloud] w_payload missing from stream context — cannot build parse URL');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// ── Step 6: build parse-flixcloud URL ─────────────────────────────────
|
|
108
|
+
// enc-dec.app fetches + decrypts the manifest and returns a plain m3u8.
|
|
109
|
+
// The player hits this URL directly; enc-dec.app acts as a transparent proxy.
|
|
110
|
+
const parseUrl =
|
|
111
|
+
`${ENC_DEC_API}/parse-flixcloud` +
|
|
112
|
+
`?url=${encodeURIComponent(encryptedM3u8Url)}` +
|
|
113
|
+
`&w_payload=${encodeURIComponent(wPayload)}`;
|
|
114
|
+
|
|
115
|
+
// ── Subtitles ──────────────────────────────────────────────────────────
|
|
116
|
+
const subtitles: Array<{ url: string; lang: string }> = [];
|
|
117
|
+
if (Array.isArray(rawSubs)) {
|
|
118
|
+
for (const s of rawSubs) {
|
|
119
|
+
if (s?.url && s?.language) subtitles.push({ url: s.url, lang: s.language });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// ── Intro / outro chapters (still in the raw HTML) ────────────────────
|
|
124
|
+
const introM = html.match(/intro_chapter:\{start:(\d+),end:(\d+)/);
|
|
125
|
+
const outroM = html.match(/outro_chapter:\{start:(\d+),end:(\d+)/);
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
sources: [{ url: parseUrl, isM3U8: true, quality: 'auto' }],
|
|
129
|
+
subtitles,
|
|
130
|
+
headers: { Referer: `${origin}/` },
|
|
131
|
+
...(introM ? { intro: { start: +introM[1]!, end: +introM[2]! } } : {}),
|
|
132
|
+
...(outroM ? { outro: { start: +outroM[1]!, end: +outroM[2]! } } : {}),
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
return { serverName, sources, extract };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export default FlixCloud;
|
package/src/extractors/index.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { MegaPlay } from './megaplay';
|
|
|
21
21
|
import { GDFlix } from './gdflix';
|
|
22
22
|
import { Gofile } from './gofile';
|
|
23
23
|
import { HubCloud } from './hubcloud';
|
|
24
|
+
import { FlixCloud } from './flixcloud';
|
|
24
25
|
|
|
25
26
|
export {
|
|
26
27
|
AsianLoad,
|
|
@@ -46,4 +47,5 @@ export {
|
|
|
46
47
|
GDFlix,
|
|
47
48
|
Gofile,
|
|
48
49
|
HubCloud,
|
|
50
|
+
FlixCloud,
|
|
49
51
|
};
|
package/src/extractors/kwik.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ExtractorContext, type IVideo, type ISource, type IVideoExtractor } from '../models';
|
|
2
|
+
import type { PolyURL } from '../utils/url-polyfill';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Kwik extractor function
|
|
@@ -8,106 +9,86 @@ import { type ExtractorContext, type IVideo, type ISource, type IVideoExtractor
|
|
|
8
9
|
export function Kwik(ctx: ExtractorContext): IVideoExtractor {
|
|
9
10
|
const serverName = 'kwik';
|
|
10
11
|
const sources: IVideo[] = [];
|
|
11
|
-
const {
|
|
12
|
-
function unPack(code: string) {
|
|
13
|
-
function indent(code: string[]) {
|
|
14
|
-
try {
|
|
15
|
-
let tabs = 0,
|
|
16
|
-
old = -1,
|
|
17
|
-
add = '';
|
|
18
|
-
for (let i = 0; i < code.length; i++) {
|
|
19
|
-
if (code[i]!.includes('{')) tabs++;
|
|
20
|
-
if (code[i]!.includes('}')) tabs--;
|
|
21
|
-
|
|
22
|
-
if (old !== tabs) {
|
|
23
|
-
old = tabs;
|
|
24
|
-
add = '';
|
|
25
|
-
while (old > 0) {
|
|
26
|
-
add += '\t';
|
|
27
|
-
old--;
|
|
28
|
-
}
|
|
29
|
-
old = tabs;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
code[i] = add + code[i];
|
|
33
|
-
}
|
|
34
|
-
} finally {
|
|
35
|
-
// let GC cleanup
|
|
36
|
-
}
|
|
37
|
-
return code;
|
|
38
|
-
}
|
|
12
|
+
const { load, USER_AGENT, NativeConsumet } = ctx;
|
|
39
13
|
|
|
40
|
-
|
|
14
|
+
const ua =
|
|
15
|
+
USER_AGENT ||
|
|
16
|
+
'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Mobile Safari/537.36';
|
|
41
17
|
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
18
|
+
function unpackPacked(packed: string): string | null {
|
|
19
|
+
const re =
|
|
20
|
+
/\beval\s*\(\s*function\s*\(\s*p\s*,\s*a\s*,\s*c\s*,\s*k\s*,\s*e\s*,\s*[dr]\s*\)\s*\{[\s\S]+?\}\s*\(\s*'([\s\S]+?)'\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*'([\s\S]+?)'\s*\.split\s*\(\s*'(.+?)'\s*\)/;
|
|
21
|
+
|
|
22
|
+
const m = packed.match(re);
|
|
23
|
+
if (!m) return null;
|
|
24
|
+
|
|
25
|
+
const encoded = m[1]!;
|
|
26
|
+
const base = parseInt(m[2]!, 10);
|
|
27
|
+
const count = parseInt(m[3]!, 10);
|
|
28
|
+
const words = m[4]!.split(m[5]!);
|
|
29
|
+
|
|
30
|
+
function decode(n: number): string {
|
|
31
|
+
const prefix = n < base ? '' : decode(Math.floor(n / base));
|
|
32
|
+
const rem = n % base;
|
|
33
|
+
return prefix + (rem > 35 ? String.fromCharCode(rem + 29) : rem.toString(36));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let result = encoded;
|
|
37
|
+
for (let i = count - 1; i >= 0; i--) {
|
|
38
|
+
const word = words[i];
|
|
39
|
+
if (word) result = result.replace(new RegExp(`\\b${decode(i)}\\b`, 'g'), word);
|
|
40
|
+
}
|
|
50
41
|
|
|
51
|
-
|
|
52
|
-
const runner = new Function(
|
|
53
|
-
'env',
|
|
54
|
-
`
|
|
55
|
-
const { eval, window, document } = env;
|
|
56
|
-
${code}
|
|
57
|
-
`
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
runner(env);
|
|
61
|
-
|
|
62
|
-
// prettify captured code
|
|
63
|
-
captured = (captured + '')
|
|
64
|
-
.replace(/;/g, ';\n')
|
|
65
|
-
.replace(/{/g, '\n{\n')
|
|
66
|
-
.replace(/}/g, '\n}\n')
|
|
67
|
-
.replace(/\n;\n/g, ';\n')
|
|
68
|
-
.replace(/\n\n/g, '\n');
|
|
69
|
-
|
|
70
|
-
let lines = captured.split('\n');
|
|
71
|
-
lines = indent(lines);
|
|
72
|
-
|
|
73
|
-
return lines.join('\n');
|
|
42
|
+
return result;
|
|
74
43
|
}
|
|
44
|
+
|
|
75
45
|
// @ts-ignore
|
|
76
|
-
const extract = async (videoUrl: PolyURL, referer = 'https://animepahe.
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
46
|
+
const extract = async (videoUrl: PolyURL, referer = 'https://animepahe.ru/'): Promise<ISource> => {
|
|
47
|
+
const kwikUrl = typeof videoUrl === 'string' ? videoUrl : (videoUrl as any).href;
|
|
48
|
+
const kwikHost = kwikUrl.match(/^https?:\/\/([^/]+)/)?.[1] ?? 'kwik.cx';
|
|
49
|
+
|
|
50
|
+
const { html } = await NativeConsumet.makeGetRequestWithWebView(kwikUrl, {
|
|
51
|
+
'Referer': referer,
|
|
52
|
+
'User-Agent': ua,
|
|
53
|
+
});
|
|
83
54
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
url: source,
|
|
99
|
-
isM3U8: source.includes('.m3u8'),
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
return extractedData;
|
|
103
|
-
} catch (err) {
|
|
104
|
-
throw new Error((err as Error).message);
|
|
55
|
+
const $ = load(html);
|
|
56
|
+
let packedScript: string | null = null;
|
|
57
|
+
|
|
58
|
+
$('script').each((_, el) => {
|
|
59
|
+
const text = $(el).html() ?? '';
|
|
60
|
+
if (text.includes('eval(function(p,a,c,k,e,')) {
|
|
61
|
+
packedScript = text;
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
if (!packedScript) {
|
|
67
|
+
const m = html.match(/eval\(function\(p,a,c,k,e,[dr]\)[\s\S]+?\.split\(['"]\|['"]\)[\s\S]+?\)/);
|
|
68
|
+
packedScript = m?.[0] ?? null;
|
|
105
69
|
}
|
|
106
|
-
};
|
|
107
70
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
71
|
+
if (!packedScript) throw new Error('[Kwik] No packed script found');
|
|
72
|
+
|
|
73
|
+
const unpacked = unpackPacked(packedScript);
|
|
74
|
+
if (!unpacked) throw new Error('[Kwik] Failed to unpack script');
|
|
75
|
+
|
|
76
|
+
const sourceMatch =
|
|
77
|
+
unpacked.match(/const\s+source\s*=\s*'([^']+)'/) ||
|
|
78
|
+
unpacked.match(/const\s+source\s*=\s*"([^"]+)"/) ||
|
|
79
|
+
unpacked.match(/['"]?(https?:\/\/[^'"]+\.m3u8[^'"]*)['"]/);
|
|
80
|
+
|
|
81
|
+
if (!sourceMatch?.[1]) throw new Error('[Kwik] No source URL found');
|
|
82
|
+
|
|
83
|
+
const m3u8 = sourceMatch[1];
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
sources: [{ url: m3u8, isM3U8: m3u8.includes('.m3u8') }],
|
|
87
|
+
headers: { Referer: `https://${kwikHost}/` },
|
|
88
|
+
};
|
|
112
89
|
};
|
|
90
|
+
|
|
91
|
+
return { serverName, sources, extract };
|
|
113
92
|
}
|
|
93
|
+
|
|
94
|
+
export default Kwik;
|