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
|
@@ -1,182 +1,254 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
|
|
3
1
|
import { type ExtractorContext, type ISource, type IVideo, type IVideoExtractor, type ISubtitle } from '../models';
|
|
4
2
|
import type { PolyURL } from '../utils/url-polyfill';
|
|
5
3
|
|
|
4
|
+
const MEGA_KEY_STR = 'i?LMTAx0Q6,:}50U';
|
|
5
|
+
const MEGA_IV_STR = "W0;27ToaUpl_P%'c";
|
|
6
|
+
|
|
7
|
+
/** Matches the encrypted segment token inside a URL: `/segment/<base64url-token>` */
|
|
8
|
+
const SEGMENT_RE = /\/segment\/([A-Za-z0-9_-]+)/;
|
|
9
|
+
|
|
6
10
|
/**
|
|
7
11
|
* MegaPlay extractor factory that relies on the shared extractor context
|
|
8
|
-
* @param ctx ExtractorContext containing axios, load, USER_AGENT, PolyURL
|
|
12
|
+
* @param ctx ExtractorContext containing axios, load, CryptoJS, USER_AGENT, PolyURL
|
|
9
13
|
* @returns Object with extract method implementing IVideoExtractor interface
|
|
10
14
|
*/
|
|
11
15
|
export function MegaPlay(ctx: ExtractorContext): IVideoExtractor {
|
|
12
16
|
const serverName = 'MegaPlay';
|
|
13
17
|
const sources: IVideo[] = [];
|
|
14
|
-
const client = ctx.axios
|
|
18
|
+
const client = ctx.axios;
|
|
15
19
|
const load = ctx.load;
|
|
20
|
+
const CryptoJS = ctx.CryptoJS;
|
|
16
21
|
const userAgent =
|
|
17
22
|
ctx.USER_AGENT ||
|
|
18
23
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36';
|
|
19
24
|
|
|
20
|
-
|
|
25
|
+
function megaPlayDecrypt(encB64Url: string): string {
|
|
26
|
+
// base64url → base64 (with padding)
|
|
27
|
+
const b64 = encB64Url.replace(/-/g, '+').replace(/_/g, '/');
|
|
28
|
+
const padded = b64 + '='.repeat((4 - (b64.length % 4)) % 4);
|
|
29
|
+
|
|
30
|
+
// AES-256 key: 16-char string + 16 null bytes (Latin1 = 1 byte per char for ASCII)
|
|
31
|
+
const key = CryptoJS.enc.Latin1.parse(MEGA_KEY_STR + '\0'.repeat(16));
|
|
32
|
+
|
|
33
|
+
// IV: raw bytes of the 16-char IV string
|
|
34
|
+
const iv = CryptoJS.enc.Latin1.parse(MEGA_IV_STR);
|
|
35
|
+
|
|
36
|
+
const ciphertext = CryptoJS.enc.Base64.parse(padded);
|
|
37
|
+
const cipherParams = CryptoJS.lib.CipherParams.create({ ciphertext });
|
|
38
|
+
|
|
39
|
+
const decrypted = CryptoJS.AES.decrypt(cipherParams, key, {
|
|
40
|
+
iv,
|
|
41
|
+
mode: CryptoJS.mode.CBC,
|
|
42
|
+
padding: CryptoJS.pad.Pkcs7,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return decrypted.toString(CryptoJS.enc.Utf8);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function resolveSegmentUrl(raw: string): string {
|
|
49
|
+
const m = raw.match(SEGMENT_RE);
|
|
50
|
+
if (!m || !m[1]) return raw;
|
|
21
51
|
try {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
52
|
+
const decrypted = megaPlayDecrypt(m[1]);
|
|
53
|
+
return decrypted || raw;
|
|
54
|
+
} catch {
|
|
55
|
+
return raw;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function extractStreamUrl(data: any): string | null {
|
|
60
|
+
if (!data || typeof data !== 'object') return null;
|
|
26
61
|
|
|
27
|
-
|
|
62
|
+
// ── Case 1: encrypted payload { enc: "base64url…" } ──────────────────
|
|
63
|
+
if (typeof data.enc === 'string' && data.enc.length > 0) {
|
|
64
|
+
try {
|
|
65
|
+
const plain = megaPlayDecrypt(data.enc);
|
|
66
|
+
if (plain) {
|
|
67
|
+
// Decrypted value might be JSON: { sources: [{ file: "..." }] }
|
|
68
|
+
try {
|
|
69
|
+
const parsed = JSON.parse(plain);
|
|
70
|
+
const url =
|
|
71
|
+
(typeof parsed?.sources?.file === 'string' ? parsed.sources.file : null) ||
|
|
72
|
+
(Array.isArray(parsed?.sources) && parsed.sources[0]?.file ? String(parsed.sources[0].file) : null) ||
|
|
73
|
+
(typeof parsed?.file === 'string' ? parsed.file : null);
|
|
74
|
+
if (url) return resolveSegmentUrl(url);
|
|
75
|
+
} catch {
|
|
76
|
+
// not JSON — fall through and treat as raw URL
|
|
77
|
+
}
|
|
78
|
+
if (/^https?:\/\//i.test(plain) || plain.includes('.m3u8')) {
|
|
79
|
+
return plain.trim();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
} catch {
|
|
83
|
+
// decrypt failed — fall through to plain sources
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ── Case 2: plain / segment-token sources ──────────────────────────────
|
|
88
|
+
const rawUrl: string | null =
|
|
89
|
+
(typeof data?.sources?.file === 'string' ? data.sources.file : null) ||
|
|
90
|
+
(Array.isArray(data?.sources) && data.sources[0]?.file ? String(data.sources[0].file) : null);
|
|
91
|
+
|
|
92
|
+
if (rawUrl) return resolveSegmentUrl(rawUrl);
|
|
93
|
+
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const extract = async (videoUrl: PolyURL, referer?: string): Promise<ISource> => {
|
|
98
|
+
const embedHref = typeof videoUrl === 'string' ? videoUrl : videoUrl.href;
|
|
99
|
+
const urlObj = typeof videoUrl === 'object' && videoUrl.origin ? videoUrl : new (ctx.PolyURL || URL)(embedHref);
|
|
100
|
+
const origin = urlObj.origin || 'https://megaplay.buzz';
|
|
101
|
+
const pageReferer = referer || embedHref;
|
|
102
|
+
|
|
103
|
+
// ── Collect cookies across requests so the video player can send them ────
|
|
104
|
+
const cookieJar: string[] = [];
|
|
105
|
+
|
|
106
|
+
const parseCookies = (headers: any): string[] => {
|
|
107
|
+
const raw = headers?.['set-cookie'];
|
|
108
|
+
if (!raw) return [];
|
|
109
|
+
const arr = Array.isArray(raw) ? raw : [raw];
|
|
110
|
+
// Keep only the name=value part (strip path/domain/etc.)
|
|
111
|
+
return arr.map((c: string) => c.split(';')[0] ?? '').filter(Boolean);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const pageRes = await client.get(embedHref, {
|
|
115
|
+
headers: {
|
|
28
116
|
'User-Agent': userAgent,
|
|
29
117
|
'Referer': pageReferer,
|
|
30
118
|
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
31
|
-
}
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
cookieJar.push(...parseCookies(pageRes.headers));
|
|
32
122
|
|
|
33
|
-
|
|
123
|
+
const $ = load(pageRes.data);
|
|
124
|
+
const playerDiv = $('#megaplay-player');
|
|
34
125
|
|
|
35
|
-
|
|
36
|
-
|
|
126
|
+
if (!playerDiv.length) {
|
|
127
|
+
throw new Error('[MegaPlay] Could not find player element (#megaplay-player)');
|
|
128
|
+
}
|
|
37
129
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
130
|
+
const mediaId = playerDiv.attr('data-id');
|
|
131
|
+
if (!mediaId) {
|
|
132
|
+
throw new Error('[MegaPlay] Could not find data-id on player element');
|
|
133
|
+
}
|
|
41
134
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
throw new Error('[MegaPlay] Could not find data-id on player element');
|
|
45
|
-
}
|
|
135
|
+
const sParam = urlObj.searchParams?.get('s');
|
|
136
|
+
const sQuery = sParam ? `&s=${encodeURIComponent(sParam)}` : '';
|
|
46
137
|
|
|
47
|
-
|
|
48
|
-
const sQuery = sParam ? `&s=${encodeURIComponent(sParam)}` : '';
|
|
138
|
+
const cookieHeader = () => cookieJar.join('; ');
|
|
49
139
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
140
|
+
const ajaxHeaders = (): Record<string, string> => ({
|
|
141
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
142
|
+
'Referer': `${origin}/`,
|
|
143
|
+
'Origin': origin,
|
|
144
|
+
'User-Agent': userAgent,
|
|
145
|
+
'Accept': 'application/json, text/javascript, */*; q=0.01',
|
|
146
|
+
...(cookieJar.length ? { Cookie: cookieHeader() } : {}),
|
|
147
|
+
});
|
|
56
148
|
|
|
57
|
-
|
|
58
|
-
let defStreamUrl: string | null = null;
|
|
149
|
+
const fetchJson = async (url: string): Promise<any | null> => {
|
|
59
150
|
try {
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
defStreamUrl =
|
|
65
|
-
defSourcesJson?.sources?.file ||
|
|
66
|
-
(Array.isArray(defSourcesJson?.sources) ? defSourcesJson.sources[0]?.file : null);
|
|
151
|
+
const res = await client.get(url, { headers: ajaxHeaders() });
|
|
152
|
+
cookieJar.push(...parseCookies(res.headers));
|
|
153
|
+
const data = res.data;
|
|
154
|
+
return typeof data === 'string' ? JSON.parse(data) : data;
|
|
67
155
|
} catch {
|
|
68
|
-
|
|
156
|
+
return null;
|
|
69
157
|
}
|
|
158
|
+
};
|
|
70
159
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
headers: ajaxHeaders,
|
|
76
|
-
});
|
|
77
|
-
newSourcesJson = typeof newResData === 'string' ? JSON.parse(newResData) : newResData;
|
|
78
|
-
newStreamUrl =
|
|
79
|
-
newSourcesJson?.sources?.file ||
|
|
80
|
-
(Array.isArray(newSourcesJson?.sources) ? newSourcesJson.sources[0]?.file : null);
|
|
81
|
-
} catch {
|
|
82
|
-
// Ignore if defStreamUrl succeeded
|
|
83
|
-
}
|
|
160
|
+
const [defSourcesJson, newSourcesJson] = await Promise.all([
|
|
161
|
+
fetchJson(`${origin}/stream/getSources?id=${mediaId}${sQuery}`),
|
|
162
|
+
fetchJson(`${origin}/stream/getSourcesNew?id=${mediaId}${sQuery}`),
|
|
163
|
+
]);
|
|
84
164
|
|
|
85
|
-
|
|
86
|
-
if (!streamUrl) {
|
|
87
|
-
throw new Error('[MegaPlay] No video stream URL found from /getSources or /getSourcesNew');
|
|
88
|
-
}
|
|
165
|
+
const streamUrl = extractStreamUrl(defSourcesJson) || extractStreamUrl(newSourcesJson);
|
|
89
166
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
isM3U8,
|
|
97
|
-
quality: 'auto',
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
if (isM3U8) {
|
|
101
|
-
try {
|
|
102
|
-
const { data: m3u8Data } = await client.get(cleanStreamUrl, {
|
|
103
|
-
headers: {
|
|
104
|
-
'Referer': `${origin}/`,
|
|
105
|
-
'User-Agent': userAgent,
|
|
106
|
-
},
|
|
107
|
-
});
|
|
167
|
+
if (!streamUrl) {
|
|
168
|
+
throw new Error('[MegaPlay] No video stream URL found from /getSources or /getSourcesNew');
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const cleanStreamUrl = streamUrl.replace(/\\/g, '').trim();
|
|
172
|
+
const isM3U8 = cleanStreamUrl.includes('.m3u8');
|
|
108
173
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
174
|
+
const extractedSources: IVideo[] = [];
|
|
175
|
+
const defaultSource: IVideo = { url: cleanStreamUrl, isM3U8, quality: 'auto' };
|
|
176
|
+
|
|
177
|
+
if (isM3U8) {
|
|
178
|
+
try {
|
|
179
|
+
const { data: m3u8Data } = await client.get(cleanStreamUrl, {
|
|
180
|
+
headers: { 'Referer': `${origin}/`, 'User-Agent': userAgent },
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
if (typeof m3u8Data === 'string' && m3u8Data.includes('#EXT-X-STREAM-INF')) {
|
|
184
|
+
const lines = m3u8Data.split('\n');
|
|
185
|
+
const streamBasePath = cleanStreamUrl.substring(0, cleanStreamUrl.lastIndexOf('/'));
|
|
186
|
+
const streamOrigin = new (ctx.PolyURL || URL)(cleanStreamUrl).origin;
|
|
187
|
+
|
|
188
|
+
for (let i = 0; i < lines.length; i++) {
|
|
189
|
+
const line = lines[i]?.trim();
|
|
190
|
+
if (line?.startsWith('#EXT-X-STREAM-INF')) {
|
|
191
|
+
const resMatch = line.match(/RESOLUTION=\d+x(\d+)/);
|
|
192
|
+
const quality = resMatch ? `${resMatch[1]}p` : `quality_${extractedSources.length + 1}`;
|
|
193
|
+
const next = lines[i + 1]?.trim();
|
|
194
|
+
if (next && !next.startsWith('#')) {
|
|
195
|
+
const variantUrl =
|
|
196
|
+
next.startsWith('http://') || next.startsWith('https://')
|
|
197
|
+
? next
|
|
198
|
+
: next.startsWith('/')
|
|
199
|
+
? `${streamOrigin}${next}`
|
|
200
|
+
: `${streamBasePath}/${next}`;
|
|
201
|
+
extractedSources.push({ url: variantUrl, isM3U8: true, quality });
|
|
134
202
|
}
|
|
135
203
|
}
|
|
136
204
|
}
|
|
137
|
-
} catch {
|
|
138
|
-
// If fetching variants fails, defaultSource will be returned
|
|
139
205
|
}
|
|
206
|
+
} catch {
|
|
207
|
+
// variants fetch failed — defaultSource will be used
|
|
140
208
|
}
|
|
209
|
+
}
|
|
141
210
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
211
|
+
const finalSources = extractedSources.length > 0 ? [...extractedSources, defaultSource] : [defaultSource];
|
|
212
|
+
|
|
213
|
+
const tracks = defSourcesJson?.tracks ?? newSourcesJson?.tracks ?? [];
|
|
214
|
+
const subtitles: ISubtitle[] = [];
|
|
215
|
+
if (Array.isArray(tracks)) {
|
|
216
|
+
for (const track of tracks) {
|
|
217
|
+
if (track?.file) {
|
|
218
|
+
subtitles.push({
|
|
219
|
+
url: String(track.file).replace(/\\/g, ''),
|
|
220
|
+
lang: track.label || track.kind || 'English',
|
|
221
|
+
});
|
|
154
222
|
}
|
|
155
223
|
}
|
|
224
|
+
}
|
|
156
225
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
} catch (error) {
|
|
171
|
-
throw new Error((error as Error).message);
|
|
226
|
+
const intro = defSourcesJson?.intro ?? newSourcesJson?.intro;
|
|
227
|
+
const outro = defSourcesJson?.outro ?? newSourcesJson?.outro;
|
|
228
|
+
|
|
229
|
+
// Build player headers — these must be sent with every HLS request.
|
|
230
|
+
// The CDN (fetch.nexabloom.top) is IP-bound: the URL is generated for the
|
|
231
|
+
// requesting IP, so extraction and playback must share the same IP.
|
|
232
|
+
const playerHeaders: Record<string, string> = {
|
|
233
|
+
'Referer': `${origin}/`,
|
|
234
|
+
'Origin': origin,
|
|
235
|
+
'User-Agent': userAgent,
|
|
236
|
+
};
|
|
237
|
+
if (cookieJar.length) {
|
|
238
|
+
playerHeaders.Cookie = cookieHeader();
|
|
172
239
|
}
|
|
173
|
-
};
|
|
174
240
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
241
|
+
return {
|
|
242
|
+
sources: finalSources,
|
|
243
|
+
subtitles,
|
|
244
|
+
headers: playerHeaders,
|
|
245
|
+
intro: intro ? { start: intro.start, end: intro.end } : undefined,
|
|
246
|
+
outro: outro ? { start: outro.start, end: outro.end } : undefined,
|
|
247
|
+
embedURL: embedHref,
|
|
248
|
+
};
|
|
179
249
|
};
|
|
250
|
+
|
|
251
|
+
return { serverName, sources, extract };
|
|
180
252
|
}
|
|
181
253
|
|
|
182
254
|
export default MegaPlay;
|
|
@@ -9,7 +9,7 @@ import type { PolyURL } from '../utils/url-polyfill';
|
|
|
9
9
|
export function VidHide(ctx: ExtractorContext): IVideoExtractor {
|
|
10
10
|
const serverName = 'VidHide';
|
|
11
11
|
const sources: IVideo[] = [];
|
|
12
|
-
const { axios, USER_AGENT } = ctx;
|
|
12
|
+
const { axios, USER_AGENT, NativeConsumet } = ctx;
|
|
13
13
|
|
|
14
14
|
const extract = async (videoUrl: PolyURL): Promise<ISource> => {
|
|
15
15
|
try {
|
|
@@ -24,11 +24,17 @@ export function VidHide(ctx: ExtractorContext): IVideoExtractor {
|
|
|
24
24
|
throw new Error('Video not found');
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
);
|
|
27
|
+
const packedScript = /(eval)(\(f.*?)(\n<\/script>)/m.exec(data.replace(/\n/g, ' '))?.[2]?.replace('eval', '');
|
|
28
|
+
|
|
29
|
+
if (!packedScript) throw new Error('No packed script found');
|
|
30
|
+
|
|
31
|
+
const unpackedData = await NativeConsumet.deobfuscateScript(packedScript);
|
|
32
|
+
if (!unpackedData) throw new Error('Failed to deobfuscate script');
|
|
33
|
+
|
|
30
34
|
const links = unpackedData.match(/https?:\/\/[^"]+?\.m3u8[^"]*/g) ?? [];
|
|
31
35
|
const m3u8Link = links[0];
|
|
36
|
+
if (!m3u8Link) throw new Error('No m3u8 link found');
|
|
37
|
+
|
|
32
38
|
const m3u8Content = await axios.get(m3u8Link, {
|
|
33
39
|
headers: {
|
|
34
40
|
'Referer': m3u8Link,
|
|
@@ -76,3 +82,5 @@ export function VidHide(ctx: ExtractorContext): IVideoExtractor {
|
|
|
76
82
|
extract,
|
|
77
83
|
};
|
|
78
84
|
}
|
|
85
|
+
|
|
86
|
+
export default VidHide;
|
|
@@ -9,6 +9,8 @@ export interface ExtractorInfo {
|
|
|
9
9
|
version: string;
|
|
10
10
|
/**github url path */
|
|
11
11
|
main: string;
|
|
12
|
+
/** SHA-256 hex digest of the compiled JS file for integrity verification */
|
|
13
|
+
sha256?: string;
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
14
16
|
* Extension manifest interface for defining extension metadata
|
|
@@ -42,6 +44,9 @@ export interface ExtensionManifest {
|
|
|
42
44
|
/** Factory function names exported by this extension */
|
|
43
45
|
factoryName: string;
|
|
44
46
|
|
|
47
|
+
/** SHA-256 hex digest of the compiled JS file for integrity verification */
|
|
48
|
+
sha256?: string;
|
|
49
|
+
|
|
45
50
|
/** Homepage URL */
|
|
46
51
|
baseUrl: string;
|
|
47
52
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AxiosInstance } from 'axios';
|
|
2
2
|
import type { CheerioAPI } from 'cheerio';
|
|
3
|
+
import type CryptoJS from 'crypto-js';
|
|
3
4
|
import type { PolyURL, PolyURLSearchParams } from '../utils/url-polyfill';
|
|
4
5
|
import type {
|
|
5
6
|
bypassDdosGuard,
|
|
@@ -18,6 +19,8 @@ import type {
|
|
|
18
19
|
export interface ExtractorContext {
|
|
19
20
|
axios: AxiosInstance;
|
|
20
21
|
load: (html: string) => CheerioAPI;
|
|
22
|
+
/** CryptoJS library — use instead of importing crypto-js directly */
|
|
23
|
+
CryptoJS: typeof CryptoJS;
|
|
21
24
|
USER_AGENT?: string;
|
|
22
25
|
PolyURL: typeof PolyURL;
|
|
23
26
|
PolyURLSearchParams: typeof PolyURLSearchParams;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AxiosInstance } from 'axios';
|
|
2
2
|
import type { CheerioAPI } from 'cheerio';
|
|
3
|
+
import type CryptoJS from 'crypto-js';
|
|
3
4
|
import type AnimeParser from './anime-parser';
|
|
4
5
|
import type MovieParser from './movie-parser';
|
|
5
6
|
import type { ExtractorContext, ExtractorContextConfig } from './extractor-context';
|
|
@@ -131,6 +132,9 @@ export interface ExtractorRegistry {
|
|
|
131
132
|
HubCloud: (ctx?: ExtractorContext) => {
|
|
132
133
|
extract: (url: PolyURL | string, ...args: any[]) => Promise<any>;
|
|
133
134
|
};
|
|
135
|
+
FlixCloud: (ctx?: ExtractorContext) => {
|
|
136
|
+
extract: (url: PolyURL, referer?: string) => Promise<any>;
|
|
137
|
+
};
|
|
134
138
|
}
|
|
135
139
|
|
|
136
140
|
export type ProviderConfig = {
|
|
@@ -151,6 +155,8 @@ export type ProviderConfig = {
|
|
|
151
155
|
export interface ProviderContext {
|
|
152
156
|
axios: AxiosInstance;
|
|
153
157
|
load: (html: string) => CheerioAPI;
|
|
158
|
+
/** CryptoJS library — use instead of importing crypto-js directly */
|
|
159
|
+
CryptoJS: typeof CryptoJS;
|
|
154
160
|
USER_AGENT: string;
|
|
155
161
|
AnimeParser: typeof AnimeParser;
|
|
156
162
|
MovieParser: typeof MovieParser;
|
package/src/models/types.ts
CHANGED
|
@@ -465,12 +465,16 @@ function createAniKoto(ctx: ProviderContext, customBaseURL?: string) {
|
|
|
465
465
|
const epHtml = epRes.data?.result || epRes.data;
|
|
466
466
|
const $ep = load(epHtml);
|
|
467
467
|
|
|
468
|
-
$ep('li
|
|
469
|
-
const
|
|
468
|
+
$ep('li').each((_, li) => {
|
|
469
|
+
const listItem = $ep(li);
|
|
470
|
+
const anchor = listItem.find('a').first();
|
|
470
471
|
const dataIds = anchor.attr('data-ids') || anchor.attr('data-id') || '';
|
|
471
472
|
const numAttr = anchor.attr('data-num') || anchor.attr('data-slug') || anchor.find('b').text().trim();
|
|
472
473
|
const num = parseInt(numAttr, 10) || 1;
|
|
473
|
-
const epTitle = anchor.find('.d-title').text().trim() || `Episode ${num}`;
|
|
474
|
+
const epTitle = listItem.attr('title') || anchor.find('.d-title').text().trim() || `Episode ${num}`;
|
|
475
|
+
const isFiller = anchor.hasClass('filler');
|
|
476
|
+
const isSubbed = anchor.attr('data-sub') === '1';
|
|
477
|
+
const isDubbed = anchor.attr('data-dub') === '1';
|
|
474
478
|
|
|
475
479
|
if (dataIds) {
|
|
476
480
|
episodes.push({
|
|
@@ -478,6 +482,9 @@ function createAniKoto(ctx: ProviderContext, customBaseURL?: string) {
|
|
|
478
482
|
number: num,
|
|
479
483
|
title: epTitle,
|
|
480
484
|
url: `${config.baseUrl}/watch/${animeSlug}/ep-${num}`,
|
|
485
|
+
isFiller,
|
|
486
|
+
isSubbed,
|
|
487
|
+
isDubbed,
|
|
481
488
|
});
|
|
482
489
|
}
|
|
483
490
|
});
|