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.
Files changed (203) hide show
  1. package/Consumet.podspec +9 -0
  2. package/README.md +7 -0
  3. package/android/generated/jni/CMakeLists.txt +1 -9
  4. package/android/generated/jni/react/renderer/components/RNConsumetSpec/RNConsumetSpecJSI.h +65 -92
  5. package/ios/Consumet.h +1 -1
  6. package/ios/Consumet.mm +681 -7
  7. package/ios/generated/Package.swift +66 -0
  8. package/ios/generated/ReactAppDependencyProvider/RCTAppDependencyProvider.h +25 -0
  9. package/ios/generated/ReactAppDependencyProvider/RCTAppDependencyProvider.mm +40 -0
  10. package/ios/generated/ReactAppDependencyProvider/ReactAppDependencyProvider.podspec +34 -0
  11. package/ios/generated/ReactCodegen/RCTModuleProviders.h +16 -0
  12. package/ios/generated/ReactCodegen/RCTModuleProviders.mm +51 -0
  13. package/ios/generated/ReactCodegen/RCTModulesConformingToProtocolsProvider.h +18 -0
  14. package/ios/generated/ReactCodegen/RCTModulesConformingToProtocolsProvider.mm +54 -0
  15. package/ios/generated/ReactCodegen/RCTThirdPartyComponentsProvider.h +16 -0
  16. package/ios/generated/ReactCodegen/RCTThirdPartyComponentsProvider.mm +30 -0
  17. package/ios/generated/ReactCodegen/RCTUnstableModulesRequiringMainQueueSetupProvider.h +14 -0
  18. package/ios/generated/ReactCodegen/RCTUnstableModulesRequiringMainQueueSetupProvider.mm +19 -0
  19. package/ios/generated/ReactCodegen/RNConsumetSpecJSI.h +98 -0
  20. package/ios/generated/ReactCodegen/ReactCodegen.podspec +114 -0
  21. package/lib/commonjs/extension-registry.json +106 -29
  22. package/lib/commonjs/extractors/flixcloud.js +179 -0
  23. package/lib/commonjs/extractors/flixcloud.js.map +1 -0
  24. package/lib/commonjs/extractors/index.js +7 -0
  25. package/lib/commonjs/extractors/index.js.map +1 -1
  26. package/lib/commonjs/extractors/kwik.js +59 -74
  27. package/lib/commonjs/extractors/kwik.js.map +1 -1
  28. package/lib/commonjs/extractors/megaplay.js +196 -124
  29. package/lib/commonjs/extractors/megaplay.js.map +1 -1
  30. package/lib/commonjs/extractors/vidhide.js +9 -2
  31. package/lib/commonjs/extractors/vidhide.js.map +1 -1
  32. package/lib/commonjs/models/types.js +1 -0
  33. package/lib/commonjs/models/types.js.map +1 -1
  34. package/lib/commonjs/providers/anime/anikoto/create-anikoto.js +11 -4
  35. package/lib/commonjs/providers/anime/anikoto/create-anikoto.js.map +1 -1
  36. package/lib/commonjs/providers/anime/animepahe/create-animepahe.js +107 -137
  37. package/lib/commonjs/providers/anime/animepahe/create-animepahe.js.map +1 -1
  38. package/lib/commonjs/providers/anime/anineko/anineko.js +31 -0
  39. package/lib/commonjs/providers/anime/anineko/anineko.js.map +1 -0
  40. package/lib/commonjs/providers/anime/anineko/create-anineko.js +447 -0
  41. package/lib/commonjs/providers/anime/anineko/create-anineko.js.map +1 -0
  42. package/lib/commonjs/providers/anime/index.js +9 -1
  43. package/lib/commonjs/providers/anime/index.js.map +1 -1
  44. package/lib/commonjs/providers/anime/reanime/create-reanime.js +255 -0
  45. package/lib/commonjs/providers/anime/reanime/create-reanime.js.map +1 -0
  46. package/lib/commonjs/providers/anime/reanime/reanime.js +31 -0
  47. package/lib/commonjs/providers/anime/reanime/reanime.js.map +1 -0
  48. package/lib/commonjs/providers/movies/vegamovies/create-vegamovies.js +11 -11
  49. package/lib/commonjs/providers/movies/vegamovies/create-vegamovies.js.map +1 -1
  50. package/lib/commonjs/utils/ExtractorManager.js +21 -28
  51. package/lib/commonjs/utils/ExtractorManager.js.map +1 -1
  52. package/lib/commonjs/utils/ProviderManager.js +31 -34
  53. package/lib/commonjs/utils/ProviderManager.js.map +1 -1
  54. package/lib/commonjs/utils/create-extractor-context.js +3 -0
  55. package/lib/commonjs/utils/create-extractor-context.js.map +1 -1
  56. package/lib/commonjs/utils/create-provider-context.js +2 -0
  57. package/lib/commonjs/utils/create-provider-context.js.map +1 -1
  58. package/lib/commonjs/utils/extension-utils.js +6 -2
  59. package/lib/commonjs/utils/extension-utils.js.map +1 -1
  60. package/lib/module/extension-registry.json +106 -29
  61. package/lib/module/extractors/flixcloud.js +174 -0
  62. package/lib/module/extractors/flixcloud.js.map +1 -0
  63. package/lib/module/extractors/index.js +2 -1
  64. package/lib/module/extractors/index.js.map +1 -1
  65. package/lib/module/extractors/kwik.js +58 -74
  66. package/lib/module/extractors/kwik.js.map +1 -1
  67. package/lib/module/extractors/megaplay.js +196 -123
  68. package/lib/module/extractors/megaplay.js.map +1 -1
  69. package/lib/module/extractors/vidhide.js +8 -2
  70. package/lib/module/extractors/vidhide.js.map +1 -1
  71. package/lib/module/models/types.js +1 -0
  72. package/lib/module/models/types.js.map +1 -1
  73. package/lib/module/providers/anime/anikoto/create-anikoto.js +11 -4
  74. package/lib/module/providers/anime/anikoto/create-anikoto.js.map +1 -1
  75. package/lib/module/providers/anime/animepahe/create-animepahe.js +107 -138
  76. package/lib/module/providers/anime/animepahe/create-animepahe.js.map +1 -1
  77. package/lib/module/providers/anime/anineko/anineko.js +25 -0
  78. package/lib/module/providers/anime/anineko/anineko.js.map +1 -0
  79. package/lib/module/providers/anime/anineko/create-anineko.js +443 -0
  80. package/lib/module/providers/anime/anineko/create-anineko.js.map +1 -0
  81. package/lib/module/providers/anime/index.js +9 -1
  82. package/lib/module/providers/anime/index.js.map +1 -1
  83. package/lib/module/providers/anime/reanime/create-reanime.js +251 -0
  84. package/lib/module/providers/anime/reanime/create-reanime.js.map +1 -0
  85. package/lib/module/providers/anime/reanime/reanime.js +25 -0
  86. package/lib/module/providers/anime/reanime/reanime.js.map +1 -0
  87. package/lib/module/providers/movies/vegamovies/create-vegamovies.js +11 -11
  88. package/lib/module/providers/movies/vegamovies/create-vegamovies.js.map +1 -1
  89. package/lib/module/utils/ExtractorManager.js +21 -28
  90. package/lib/module/utils/ExtractorManager.js.map +1 -1
  91. package/lib/module/utils/ProviderManager.js +31 -34
  92. package/lib/module/utils/ProviderManager.js.map +1 -1
  93. package/lib/module/utils/create-extractor-context.js +2 -0
  94. package/lib/module/utils/create-extractor-context.js.map +1 -1
  95. package/lib/module/utils/create-provider-context.js +2 -0
  96. package/lib/module/utils/create-provider-context.js.map +1 -1
  97. package/lib/module/utils/extension-utils.js +7 -3
  98. package/lib/module/utils/extension-utils.js.map +1 -1
  99. package/lib/typescript/commonjs/src/extractors/flixcloud.d.ts +18 -0
  100. package/lib/typescript/commonjs/src/extractors/flixcloud.d.ts.map +1 -0
  101. package/lib/typescript/commonjs/src/extractors/index.d.ts +2 -1
  102. package/lib/typescript/commonjs/src/extractors/index.d.ts.map +1 -1
  103. package/lib/typescript/commonjs/src/extractors/kwik.d.ts +1 -0
  104. package/lib/typescript/commonjs/src/extractors/kwik.d.ts.map +1 -1
  105. package/lib/typescript/commonjs/src/extractors/megaplay.d.ts +1 -1
  106. package/lib/typescript/commonjs/src/extractors/megaplay.d.ts.map +1 -1
  107. package/lib/typescript/commonjs/src/extractors/vidhide.d.ts +1 -0
  108. package/lib/typescript/commonjs/src/extractors/vidhide.d.ts.map +1 -1
  109. package/lib/typescript/commonjs/src/models/extension-manifest.d.ts +4 -0
  110. package/lib/typescript/commonjs/src/models/extension-manifest.d.ts.map +1 -1
  111. package/lib/typescript/commonjs/src/models/extractor-context.d.ts +3 -0
  112. package/lib/typescript/commonjs/src/models/extractor-context.d.ts.map +1 -1
  113. package/lib/typescript/commonjs/src/models/provider-context.d.ts +6 -0
  114. package/lib/typescript/commonjs/src/models/provider-context.d.ts.map +1 -1
  115. package/lib/typescript/commonjs/src/models/types.d.ts +2 -1
  116. package/lib/typescript/commonjs/src/models/types.d.ts.map +1 -1
  117. package/lib/typescript/commonjs/src/providers/anime/anikoto/create-anikoto.d.ts.map +1 -1
  118. package/lib/typescript/commonjs/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
  119. package/lib/typescript/commonjs/src/providers/anime/anineko/anineko.d.ts +23 -0
  120. package/lib/typescript/commonjs/src/providers/anime/anineko/anineko.d.ts.map +1 -0
  121. package/lib/typescript/commonjs/src/providers/anime/anineko/create-anineko.d.ts +52 -0
  122. package/lib/typescript/commonjs/src/providers/anime/anineko/create-anineko.d.ts.map +1 -0
  123. package/lib/typescript/commonjs/src/providers/anime/index.d.ts +8 -0
  124. package/lib/typescript/commonjs/src/providers/anime/index.d.ts.map +1 -1
  125. package/lib/typescript/commonjs/src/providers/anime/reanime/create-reanime.d.ts +18 -0
  126. package/lib/typescript/commonjs/src/providers/anime/reanime/create-reanime.d.ts.map +1 -0
  127. package/lib/typescript/commonjs/src/providers/anime/reanime/reanime.d.ts +19 -0
  128. package/lib/typescript/commonjs/src/providers/anime/reanime/reanime.d.ts.map +1 -0
  129. package/lib/typescript/commonjs/src/utils/ExtractorManager.d.ts +1 -0
  130. package/lib/typescript/commonjs/src/utils/ExtractorManager.d.ts.map +1 -1
  131. package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts +5 -4
  132. package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts.map +1 -1
  133. package/lib/typescript/commonjs/src/utils/create-extractor-context.d.ts.map +1 -1
  134. package/lib/typescript/commonjs/src/utils/create-provider-context.d.ts.map +1 -1
  135. package/lib/typescript/commonjs/src/utils/extension-utils.d.ts +2 -0
  136. package/lib/typescript/commonjs/src/utils/extension-utils.d.ts.map +1 -1
  137. package/lib/typescript/module/src/extractors/flixcloud.d.ts +18 -0
  138. package/lib/typescript/module/src/extractors/flixcloud.d.ts.map +1 -0
  139. package/lib/typescript/module/src/extractors/index.d.ts +2 -1
  140. package/lib/typescript/module/src/extractors/index.d.ts.map +1 -1
  141. package/lib/typescript/module/src/extractors/kwik.d.ts +1 -0
  142. package/lib/typescript/module/src/extractors/kwik.d.ts.map +1 -1
  143. package/lib/typescript/module/src/extractors/megaplay.d.ts +1 -1
  144. package/lib/typescript/module/src/extractors/megaplay.d.ts.map +1 -1
  145. package/lib/typescript/module/src/extractors/vidhide.d.ts +1 -0
  146. package/lib/typescript/module/src/extractors/vidhide.d.ts.map +1 -1
  147. package/lib/typescript/module/src/models/extension-manifest.d.ts +4 -0
  148. package/lib/typescript/module/src/models/extension-manifest.d.ts.map +1 -1
  149. package/lib/typescript/module/src/models/extractor-context.d.ts +3 -0
  150. package/lib/typescript/module/src/models/extractor-context.d.ts.map +1 -1
  151. package/lib/typescript/module/src/models/provider-context.d.ts +6 -0
  152. package/lib/typescript/module/src/models/provider-context.d.ts.map +1 -1
  153. package/lib/typescript/module/src/models/types.d.ts +2 -1
  154. package/lib/typescript/module/src/models/types.d.ts.map +1 -1
  155. package/lib/typescript/module/src/providers/anime/anikoto/create-anikoto.d.ts.map +1 -1
  156. package/lib/typescript/module/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
  157. package/lib/typescript/module/src/providers/anime/anineko/anineko.d.ts +23 -0
  158. package/lib/typescript/module/src/providers/anime/anineko/anineko.d.ts.map +1 -0
  159. package/lib/typescript/module/src/providers/anime/anineko/create-anineko.d.ts +52 -0
  160. package/lib/typescript/module/src/providers/anime/anineko/create-anineko.d.ts.map +1 -0
  161. package/lib/typescript/module/src/providers/anime/index.d.ts +8 -0
  162. package/lib/typescript/module/src/providers/anime/index.d.ts.map +1 -1
  163. package/lib/typescript/module/src/providers/anime/reanime/create-reanime.d.ts +18 -0
  164. package/lib/typescript/module/src/providers/anime/reanime/create-reanime.d.ts.map +1 -0
  165. package/lib/typescript/module/src/providers/anime/reanime/reanime.d.ts +19 -0
  166. package/lib/typescript/module/src/providers/anime/reanime/reanime.d.ts.map +1 -0
  167. package/lib/typescript/module/src/utils/ExtractorManager.d.ts +1 -0
  168. package/lib/typescript/module/src/utils/ExtractorManager.d.ts.map +1 -1
  169. package/lib/typescript/module/src/utils/ProviderManager.d.ts +5 -4
  170. package/lib/typescript/module/src/utils/ProviderManager.d.ts.map +1 -1
  171. package/lib/typescript/module/src/utils/create-extractor-context.d.ts.map +1 -1
  172. package/lib/typescript/module/src/utils/create-provider-context.d.ts.map +1 -1
  173. package/lib/typescript/module/src/utils/extension-utils.d.ts +2 -0
  174. package/lib/typescript/module/src/utils/extension-utils.d.ts.map +1 -1
  175. package/package.json +7 -7
  176. package/src/extension-registry.json +106 -29
  177. package/src/extractors/flixcloud.ts +139 -0
  178. package/src/extractors/index.ts +2 -0
  179. package/src/extractors/kwik.ts +74 -93
  180. package/src/extractors/megaplay.ts +205 -133
  181. package/src/extractors/vidhide.ts +12 -4
  182. package/src/models/extension-manifest.ts +5 -0
  183. package/src/models/extractor-context.ts +3 -0
  184. package/src/models/provider-context.ts +6 -0
  185. package/src/models/types.ts +1 -0
  186. package/src/providers/anime/anikoto/create-anikoto.ts +10 -3
  187. package/src/providers/anime/animepahe/create-animepahe.ts +118 -158
  188. package/src/providers/anime/anineko/anineko.ts +44 -0
  189. package/src/providers/anime/anineko/create-anineko.ts +489 -0
  190. package/src/providers/anime/index.ts +8 -0
  191. package/src/providers/anime/reanime/create-reanime.ts +283 -0
  192. package/src/providers/anime/reanime/reanime.ts +41 -0
  193. package/src/providers/movies/vegamovies/create-vegamovies.ts +11 -11
  194. package/src/utils/ExtractorManager.ts +23 -27
  195. package/src/utils/ProviderManager.ts +33 -33
  196. package/src/utils/create-extractor-context.ts +2 -0
  197. package/src/utils/create-provider-context.ts +2 -0
  198. package/src/utils/extension-utils.ts +5 -0
  199. package/android/generated/jni/react/renderer/components/RNConsumetSpec/RNConsumetSpecJSI-generated.cpp +0 -75
  200. package/ios/generated/RNConsumetSpecJSI-generated.cpp +0 -75
  201. package/ios/generated/RNConsumetSpecJSI.h +0 -125
  202. /package/ios/generated/{RNConsumetSpec → ReactCodegen/RNConsumetSpec}/RNConsumetSpec-generated.mm +0 -0
  203. /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 ?? 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
- const extract = async (videoUrl: PolyURL, referer?: string): Promise<ISource> => {
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 embedHref = typeof videoUrl === 'string' ? videoUrl : videoUrl.href;
23
- const urlObj = typeof videoUrl === 'object' && videoUrl.origin ? videoUrl : new (ctx.PolyURL || URL)(embedHref);
24
- const origin = urlObj.origin || 'https://megaplay.buzz';
25
- const pageReferer = referer || embedHref;
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
- const pageHeaders = {
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
- const { data: html } = await client.get(embedHref, { headers: pageHeaders });
123
+ const $ = load(pageRes.data);
124
+ const playerDiv = $('#megaplay-player');
34
125
 
35
- const $ = load(html);
36
- const playerDiv = $('#megaplay-player');
126
+ if (!playerDiv.length) {
127
+ throw new Error('[MegaPlay] Could not find player element (#megaplay-player)');
128
+ }
37
129
 
38
- if (!playerDiv.length) {
39
- throw new Error('[MegaPlay] Could not find player element (#megaplay-player)');
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
- const mediaId = playerDiv.attr('data-id');
43
- if (!mediaId) {
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
- const sParam = urlObj.searchParams?.get('s');
48
- const sQuery = sParam ? `&s=${encodeURIComponent(sParam)}` : '';
138
+ const cookieHeader = () => cookieJar.join('; ');
49
139
 
50
- const ajaxHeaders = {
51
- 'X-Requested-With': 'XMLHttpRequest',
52
- 'Referer': `${origin}/`,
53
- 'User-Agent': userAgent,
54
- 'Accept': 'application/json, text/javascript, */*; q=0.01',
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
- let defSourcesJson: any = null;
58
- let defStreamUrl: string | null = null;
149
+ const fetchJson = async (url: string): Promise<any | null> => {
59
150
  try {
60
- const { data: resData } = await client.get(`${origin}/stream/getSources?id=${mediaId}${sQuery}`, {
61
- headers: ajaxHeaders,
62
- });
63
- defSourcesJson = typeof resData === 'string' ? JSON.parse(resData) : resData;
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
- // Fallback to getSourcesNew
156
+ return null;
69
157
  }
158
+ };
70
159
 
71
- let newSourcesJson: any = null;
72
- let newStreamUrl: string | null = null;
73
- try {
74
- const { data: newResData } = await client.get(`${origin}/stream/getSourcesNew?id=${mediaId}${sQuery}`, {
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
- const streamUrl = defStreamUrl || newStreamUrl;
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
- const cleanStreamUrl = String(streamUrl).replace(/\\/g, '');
91
- const isM3U8 = cleanStreamUrl.includes('.m3u8');
92
-
93
- const extractedSources: IVideo[] = [];
94
- const defaultSource: IVideo = {
95
- url: cleanStreamUrl,
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
- if (typeof m3u8Data === 'string' && m3u8Data.includes('#EXT-X-STREAM-INF')) {
110
- const lines = m3u8Data.split('\n');
111
- const streamBasePath = cleanStreamUrl.substring(0, cleanStreamUrl.lastIndexOf('/'));
112
- const streamOrigin = new (ctx.PolyURL || URL)(cleanStreamUrl).origin;
113
-
114
- for (let i = 0; i < lines.length; i++) {
115
- const line = lines[i]?.trim();
116
- if (line && line.startsWith('#EXT-X-STREAM-INF')) {
117
- const resolutionMatch = line.match(/RESOLUTION=\d+x(\d+)/);
118
- const quality = resolutionMatch ? `${resolutionMatch[1]}p` : `quality_${extractedSources.length + 1}`;
119
- const nextLine = lines[i + 1]?.trim();
120
- if (nextLine && !nextLine.startsWith('#')) {
121
- const variantUrl =
122
- nextLine.startsWith('http://') || nextLine.startsWith('https://')
123
- ? nextLine
124
- : nextLine.startsWith('/')
125
- ? `${streamOrigin}${nextLine}`
126
- : `${streamBasePath}/${nextLine}`;
127
-
128
- extractedSources.push({
129
- url: variantUrl,
130
- isM3U8: true,
131
- quality,
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
- const finalSources = extractedSources.length > 0 ? [...extractedSources, defaultSource] : [defaultSource];
143
-
144
- const tracks = defSourcesJson?.tracks || newSourcesJson?.tracks || [];
145
- const subtitles: ISubtitle[] = [];
146
- if (Array.isArray(tracks)) {
147
- for (const track of tracks) {
148
- if (track?.file) {
149
- subtitles.push({
150
- url: String(track.file).replace(/\\/g, ''),
151
- lang: track.label || track.kind || 'English',
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
- const intro = defSourcesJson?.intro || newSourcesJson?.intro;
158
- const outro = defSourcesJson?.outro || newSourcesJson?.outro;
159
-
160
- return {
161
- sources: finalSources,
162
- subtitles,
163
- headers: {
164
- Referer: `${origin}/`,
165
- },
166
- intro: intro ? { start: intro.start, end: intro.end } : undefined,
167
- outro: outro ? { start: outro.start, end: outro.end } : undefined,
168
- embedURL: embedHref,
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
- return {
176
- serverName,
177
- sources,
178
- extract,
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 unpackedData = eval(
28
- /(eval)(\(f.*?)(\n<\/script>)/m.exec(data.replace(/\n/g, ' '))![2]!.replace('eval', '')
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;
@@ -221,6 +221,7 @@ export enum StreamingServers {
221
221
  GDFlix = 'gdflix',
222
222
  Gofile = 'gofile',
223
223
  HubCloud = 'hubcloud',
224
+ FlixCloud = 'flixcloud',
224
225
  }
225
226
 
226
227
  export enum MediaStatus {
@@ -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 a').each((_, a) => {
469
- const anchor = $ep(a);
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
  });