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
@@ -0,0 +1,283 @@
1
+ import {
2
+ type ISearch,
3
+ type IAnimeInfo,
4
+ type IAnimeResult,
5
+ type ISource,
6
+ type IEpisodeServer,
7
+ type SubOrDub,
8
+ type ProviderContext,
9
+ type ProviderConfig,
10
+ type IAnimeEpisode,
11
+ type MediaFormat,
12
+ StreamingServers,
13
+ } from '../../../models';
14
+ import { PolyURL } from '../../../utils/url-polyfill';
15
+
16
+ function createReanime(ctx: ProviderContext, customBaseURL?: string) {
17
+ const { axios, load, enums, createCustomBaseUrl, extractors, NativeConsumet } = ctx;
18
+ const { makeGetRequestWithWebView } = NativeConsumet;
19
+ const { MediaStatus: MediaStatusEnum, SubOrDub: SubOrDubEnum } = enums;
20
+
21
+ const baseUrl = createCustomBaseUrl('https://reanime.to', customBaseURL);
22
+ const apiBase = `${baseUrl}/api/v1`;
23
+
24
+ const config: ProviderConfig = {
25
+ name: 'ReAnime',
26
+ languages: 'en',
27
+ classPath: 'ANIME.ReAnime',
28
+ logo: 'https://reanime.to/favicon-32x32.png',
29
+ baseUrl,
30
+ isNSFW: false,
31
+ isWorking: true,
32
+ isDubAvailableSeparately: true,
33
+ };
34
+
35
+ const UA =
36
+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36';
37
+
38
+ const extractorCtx = {
39
+ axios,
40
+ load,
41
+ CryptoJS: ctx.CryptoJS,
42
+ USER_AGENT: UA,
43
+ PolyURL: ctx.PolyURL,
44
+ PolyURLSearchParams: ctx.PolyURLSearchParams,
45
+ NativeConsumet: ctx.NativeConsumet,
46
+ };
47
+
48
+ const hdrs = (referer?: string): Record<string, string> => ({
49
+ 'User-Agent': UA,
50
+ 'Accept': 'application/json',
51
+ 'Referer': referer ?? `${baseUrl}/`,
52
+ });
53
+
54
+ const toMediaStatus = (s: string) => {
55
+ switch (s?.toLowerCase()) {
56
+ case 'releasing':
57
+ return MediaStatusEnum.ONGOING;
58
+ case 'finished':
59
+ return MediaStatusEnum.COMPLETED;
60
+ case 'not_yet_released':
61
+ return MediaStatusEnum.NOT_YET_AIRED;
62
+ case 'cancelled':
63
+ return MediaStatusEnum.CANCELLED;
64
+ default:
65
+ return MediaStatusEnum.UNKNOWN;
66
+ }
67
+ };
68
+
69
+ const pickTitle = (t: any): string => t?.english || t?.romaji || t?.native || '';
70
+ const pickCover = (c: any): string => c?.extra_large || c?.large || c?.medium || '';
71
+
72
+ const watchPageHtml = async (animeId: string, epNumber: number, lang: string): Promise<string> => {
73
+ const url = `${baseUrl}/watch/${animeId}?ep=${epNumber}&lang=${lang}`;
74
+ const res = await makeGetRequestWithWebView(url, { 'User-Agent': UA, 'Referer': `${baseUrl}/` });
75
+ return res.html ?? '';
76
+ };
77
+
78
+ const fetchEpisodeLinks = async (
79
+ animeId: string,
80
+ epNumber: number
81
+ ): Promise<Array<{ serverName: string; dataLink: string }>> => {
82
+ const tz = encodeURIComponent('America/New_York');
83
+ const apiUrl = `${apiBase}/watch/${animeId}?ep=${epNumber}&tz=${tz}`;
84
+ const res = await makeGetRequestWithWebView(apiUrl, {
85
+ 'User-Agent': UA,
86
+ 'Accept': 'application/json',
87
+ 'Referer': `${baseUrl}/watch/${animeId}?ep=${epNumber}`,
88
+ });
89
+ // Strip any HTML scaffolding the WebView adds around the JSON body
90
+ const jsonText = (res.html ?? '').replace(/<[^>]*>/g, '').trim();
91
+ if (!jsonText) return [];
92
+ try {
93
+ const parsed = JSON.parse(jsonText);
94
+ return Array.isArray(parsed.episode_links) ? parsed.episode_links : [];
95
+ } catch {
96
+ return [];
97
+ }
98
+ };
99
+
100
+ const parseServersWithUrls = (html: string, subOrDub: SubOrDub): IEpisodeServer[] => {
101
+ const $ = load(html);
102
+ const seen = new Set<string>();
103
+ const servers: IEpisodeServer[] = [];
104
+ const targetLabel = subOrDub === SubOrDubEnum.DUB ? 'DUB:' : 'SUB:';
105
+
106
+ // iframe src is decoded by cheerio (html entities → chars)
107
+ const iframeSrc = $('#video-player').attr('src') ?? '';
108
+
109
+ $('span').each((_, spanEl) => {
110
+ if ($(spanEl).text().trim() === targetLabel) {
111
+ $(spanEl)
112
+ .parent()
113
+ .find('button.server-btn-enhanced')
114
+ .each((_, btn) => {
115
+ const name = $(btn).text().trim();
116
+ if (!name || seen.has(name)) return;
117
+ seen.add(name);
118
+ // Active server has "bg-primary" class; its URL is already in the iframe
119
+ const url = $(btn).hasClass('bg-primary') ? iframeSrc : '';
120
+ // Normalise to "flixcloud-hd-2" / "flixcloud-hd-1" so server selection works
121
+ servers.push({ name: `flixcloud-${name.toLowerCase().replace(/\s+/g, '-')}`, url });
122
+ });
123
+ }
124
+ });
125
+
126
+ return servers;
127
+ };
128
+
129
+ const search = async (query: string, page: number = 1, limit: number = 20): Promise<ISearch<IAnimeResult>> => {
130
+ const offset = (page - 1) * limit;
131
+ const { data } = await axios.get(`${apiBase}/search`, {
132
+ params: { q: query, limit, offset },
133
+ headers: hdrs(),
134
+ });
135
+
136
+ const total: number = data.total ?? 0;
137
+ const results: IAnimeResult[] = (data.results ?? []).map(
138
+ (item: any): IAnimeResult => ({
139
+ id: item.anime_id,
140
+ title: pickTitle(item.title),
141
+ url: `${baseUrl}/anime/${item.anime_id}`,
142
+ image: pickCover(item.cover_image),
143
+ type: item.format as MediaFormat,
144
+ status: toMediaStatus(item.status),
145
+ genres: item.genres ?? [],
146
+ sub: item.subbed ?? 0,
147
+ dub: item.dubbed ?? 0,
148
+ })
149
+ );
150
+
151
+ return {
152
+ currentPage: page,
153
+ hasNextPage: offset + limit < total,
154
+ totalResults: total,
155
+ results,
156
+ };
157
+ };
158
+
159
+ const fetchEpisodes = async (animeId: string): Promise<IAnimeEpisode[]> => {
160
+ const episodes: IAnimeEpisode[] = [];
161
+ let page = 1;
162
+ const limit = 100;
163
+
164
+ while (true) {
165
+ const { data } = await axios.get(`${apiBase}/anime/${animeId}/episodes`, {
166
+ params: { page, limit },
167
+ headers: hdrs(`${baseUrl}/anime/${animeId}`),
168
+ });
169
+
170
+ const batch: any[] = data.data ?? [];
171
+ for (const ep of batch) {
172
+ episodes.push({
173
+ id: `${animeId}/${ep.episode_number}`,
174
+ number: ep.episode_number,
175
+ title: ep.title || `Episode ${ep.episode_number}`,
176
+ image: ep.thumbnail || undefined,
177
+ releaseDate: ep.aired || undefined,
178
+ isFiller: ep.is_filler ?? false,
179
+ isSubbed: ep.subbed ?? false,
180
+ isDubbed: ep.dubbed ?? false,
181
+ url: `${baseUrl}/watch/${animeId}?ep=${ep.episode_number}`,
182
+ });
183
+ }
184
+
185
+ if (batch.length < limit) break;
186
+ page++;
187
+ }
188
+
189
+ return episodes;
190
+ };
191
+
192
+ const fetchAnimeInfo = async (id: string): Promise<IAnimeInfo> => {
193
+ const { data: anime } = await axios.get(`${apiBase}/anime/${id}`, {
194
+ headers: hdrs(`${baseUrl}/anime/${id}`),
195
+ });
196
+
197
+ const info: IAnimeInfo = {
198
+ id: anime.anime_id ?? id,
199
+ title: pickTitle(anime.title),
200
+ url: `${baseUrl}/anime/${id}`,
201
+ image: pickCover(anime.cover_image),
202
+ cover: anime.banner_image || undefined,
203
+ description: anime.description?.replace(/<[^>]*>/g, '').trim(),
204
+ status: toMediaStatus(anime.status),
205
+ type: anime.format as MediaFormat,
206
+ releaseDate: anime.season_year ? String(anime.season_year) : undefined,
207
+ genres: anime.genres ?? [],
208
+ studios: (anime.studios ?? []).filter((s: any) => s.is_main).map((s: any) => s.name),
209
+ totalEpisodes: anime.episodes || anime.subbed || 0,
210
+ sub: anime.subbed ?? 0,
211
+ dub: anime.dubbed ?? 0,
212
+ hasSub: (anime.subbed ?? 0) > 0,
213
+ hasDub: (anime.dubbed ?? 0) > 0,
214
+ };
215
+
216
+ info.episodes = await fetchEpisodes(id);
217
+
218
+ return info;
219
+ };
220
+
221
+ const fetchEpisodeServers = async (
222
+ episodeId: string,
223
+ subOrDub: SubOrDub = SubOrDubEnum.SUB
224
+ ): Promise<IEpisodeServer[]> => {
225
+ const parts = episodeId.split('/');
226
+ const animeId = parts[0]!;
227
+ const epNumber = Number(parts[1]!);
228
+ const isDub = subOrDub === SubOrDubEnum.DUB;
229
+
230
+ const episodeLinks = await fetchEpisodeLinks(animeId, epNumber);
231
+ if (episodeLinks.length > 0) {
232
+ return episodeLinks
233
+ .filter((l) => l.serverName && l.dataLink)
234
+ .map((l) => ({
235
+ // e.g. "HD-2" → "flixcloud-hd-2", "HD-1" → "flixcloud-hd-1"
236
+ name: `flixcloud-${l.serverName.toLowerCase().replace(/\s+/g, '-')}`,
237
+ // Site appends &a=1 to the FlixCloud URL for dub
238
+ url: isDub ? `${l.dataLink}&a=1` : l.dataLink,
239
+ }));
240
+ }
241
+
242
+ const lang = isDub ? 'dub' : 'sub';
243
+ const html = await watchPageHtml(animeId, epNumber, lang);
244
+ const servers = parseServersWithUrls(html, subOrDub);
245
+
246
+ if (!servers.length) throw new Error('[ReAnime] No servers found — user may not be logged in');
247
+ return servers;
248
+ };
249
+
250
+ const fetchEpisodeSources = async (
251
+ episodeId: string,
252
+ server: StreamingServers = StreamingServers.FlixCloud,
253
+ subOrDub: SubOrDub = SubOrDubEnum.SUB
254
+ ): Promise<ISource> => {
255
+ const parts = episodeId.split('/');
256
+ const animeId = parts[0]!;
257
+ const epNumber = parts[1]!;
258
+ const lang = subOrDub === SubOrDubEnum.DUB ? 'dub' : 'sub';
259
+ const watchUrl = `${baseUrl}/watch/${animeId}?ep=${epNumber}&lang=${lang}`;
260
+
261
+ const servers = await fetchEpisodeServers(episodeId, subOrDub);
262
+ const idx = servers.findIndex((s) => s.name.includes(server.toLowerCase()));
263
+ if (idx === -1) {
264
+ throw new Error(`[ReAnime] Server "${server}" not found. Available: ${servers.map((s) => s.name).join(', ')}`);
265
+ }
266
+
267
+ const picked = servers[idx]!;
268
+ if (!picked.url) throw new Error(`[ReAnime] No embed URL for server "${picked.name}" — user may not be logged in`);
269
+
270
+ return extractors.FlixCloud(extractorCtx).extract(new PolyURL(picked.url), watchUrl);
271
+ };
272
+
273
+ return {
274
+ ...config,
275
+ search,
276
+ fetchAnimeInfo,
277
+ fetchEpisodeServers,
278
+ fetchEpisodeSources,
279
+ };
280
+ }
281
+
282
+ export type ReAnimeProviderInstance = ReturnType<typeof createReanime>;
283
+ export default createReanime;
@@ -0,0 +1,41 @@
1
+ import { AnimeParser } from '../../../models';
2
+ import { createProviderContext } from '../../../utils/create-provider-context';
3
+ import createReanime, { type ReAnimeProviderInstance } from './create-reanime';
4
+
5
+ export class ReAnime extends AnimeParser {
6
+ private instance: ReAnimeProviderInstance;
7
+ override logo: string;
8
+ override name: string;
9
+ override baseUrl: string;
10
+ override classPath: string;
11
+ override isNSFW: boolean;
12
+ override isWorking: boolean;
13
+ override isDubAvailableSeparately: boolean;
14
+
15
+ constructor(customBaseURL?: string, cookie?: string) {
16
+ super();
17
+
18
+ const defaultContext = createProviderContext();
19
+ this.instance = createReanime(defaultContext, customBaseURL);
20
+
21
+ this.logo = this.instance.logo;
22
+ this.name = this.instance.name;
23
+ this.baseUrl = this.instance.baseUrl;
24
+ this.classPath = this.instance.classPath;
25
+ this.isNSFW = this.instance.isNSFW ?? false;
26
+ this.isWorking = this.instance.isWorking ?? true;
27
+ this.isDubAvailableSeparately = this.instance.isDubAvailableSeparately ?? false;
28
+
29
+ this.search = this.instance.search;
30
+ this.fetchAnimeInfo = this.instance.fetchAnimeInfo;
31
+ this.fetchEpisodeServers = this.instance.fetchEpisodeServers;
32
+ this.fetchEpisodeSources = this.instance.fetchEpisodeSources;
33
+ }
34
+
35
+ search!: ReAnimeProviderInstance['search'];
36
+ fetchAnimeInfo!: ReAnimeProviderInstance['fetchAnimeInfo'];
37
+ fetchEpisodeServers!: ReAnimeProviderInstance['fetchEpisodeServers'];
38
+ fetchEpisodeSources!: ReAnimeProviderInstance['fetchEpisodeSources'];
39
+ }
40
+
41
+ export default ReAnime;
@@ -240,8 +240,8 @@ export function createVegaMovies(ctx: ProviderContext, customBaseURL?: string) {
240
240
  */
241
241
  const fetchMediaInfo = async (mediaId: string): Promise<IMovieInfo> => {
242
242
  let fullUrl = mediaId;
243
- if (!fullUrl.startsWith('http')) {
244
- fullUrl = `${config.baseUrl}/${mediaId.replace(/^\//, '')}`;
243
+ if (!fullUrl?.startsWith('http')) {
244
+ fullUrl = `${config.baseUrl}/${(mediaId ?? '').replace(/^\//, '')}`;
245
245
  }
246
246
 
247
247
  const cleanId = fullUrl.replace(/^https?:\/\/[^/]+\//, '').replace(/^\/|\/$/g, '');
@@ -277,7 +277,7 @@ export function createVegaMovies(ctx: ProviderContext, customBaseURL?: string) {
277
277
  $('.entry-content img[data-src]').attr('data-src') ||
278
278
  $('.entry-content img').first().attr('src') ||
279
279
  '';
280
- if (image.startsWith('//')) {
280
+ if (image?.startsWith('//')) {
281
281
  image = `https:${image}`;
282
282
  }
283
283
  movieInfo.image = image;
@@ -361,7 +361,7 @@ export function createVegaMovies(ctx: ProviderContext, customBaseURL?: string) {
361
361
  }
362
362
 
363
363
  const btnHref = btn.attr('href');
364
- if (btnHref && btnHref.startsWith('http')) {
364
+ if (btnHref && btnHref?.startsWith('http')) {
365
365
  seasonPacks.push({
366
366
  title: blockText,
367
367
  season: seasonNum,
@@ -429,7 +429,7 @@ export function createVegaMovies(ctx: ProviderContext, customBaseURL?: string) {
429
429
  nextP.find('.btn-outline').attr('href') ||
430
430
  nextP.find('a[href]').first().attr('href');
431
431
 
432
- if (link && link.startsWith('http') && !eps.some((e) => e.url === link)) {
432
+ if (link && link?.startsWith('http') && !eps.some((e) => e.url === link)) {
433
433
  eps.push({
434
434
  id: link,
435
435
  title: epTitle,
@@ -488,7 +488,7 @@ export function createVegaMovies(ctx: ProviderContext, customBaseURL?: string) {
488
488
  : nextP.find('.dwd-button, .btn-outline').first().parent('a');
489
489
 
490
490
  const btnHref = btn.attr('href');
491
- if (btnHref && btnHref.startsWith('http') && !episodesList.some((e) => e.url === btnHref)) {
491
+ if (btnHref && btnHref?.startsWith('http') && !episodesList.some((e) => e.url === btnHref)) {
492
492
  count++;
493
493
  episodesList.push({
494
494
  id: btnHref,
@@ -504,7 +504,7 @@ export function createVegaMovies(ctx: ProviderContext, customBaseURL?: string) {
504
504
  if (episodesList.length === 0) {
505
505
  $('a[href*="nexdrive.fit"], a[href*="vcloud"], a[href*="hubcloud"]').each((i, el) => {
506
506
  const href = $(el).attr('href');
507
- if (href && href.startsWith('http') && !episodesList.some((e) => e.url === href)) {
507
+ if (href && href?.startsWith('http') && !episodesList.some((e) => e.url === href)) {
508
508
  episodesList.push({
509
509
  id: href,
510
510
  title: `${movieInfo.title} Option ${i + 1}`,
@@ -546,7 +546,7 @@ export function createVegaMovies(ctx: ProviderContext, customBaseURL?: string) {
546
546
  const servers: IEpisodeServer[] = [];
547
547
 
548
548
  let resolvedUrl = episodeId;
549
- if (!resolvedUrl.startsWith('http')) {
549
+ if (!resolvedUrl?.startsWith('http')) {
550
550
  try {
551
551
  const info = await fetchMediaInfo(episodeId);
552
552
  const firstEp = info.episodes?.[0];
@@ -556,7 +556,7 @@ export function createVegaMovies(ctx: ProviderContext, customBaseURL?: string) {
556
556
  } catch {}
557
557
  }
558
558
 
559
- if (!resolvedUrl.startsWith('http')) {
559
+ if (!resolvedUrl?.startsWith('http')) {
560
560
  return [{ name: 'HubCloud', url: episodeId }];
561
561
  }
562
562
 
@@ -653,7 +653,7 @@ export function createVegaMovies(ctx: ProviderContext, customBaseURL?: string) {
653
653
  let resolvedUrl = episodeId;
654
654
 
655
655
  // If episodeId is not an HTTP URL, resolve via fetchMediaInfo
656
- if (!resolvedUrl.startsWith('http')) {
656
+ if (!resolvedUrl?.startsWith('http')) {
657
657
  const info = await fetchMediaInfo(episodeId);
658
658
  const firstEp = info.episodes?.[0];
659
659
  if (firstEp?.url) {
@@ -739,7 +739,7 @@ export function createVegaMovies(ctx: ProviderContext, customBaseURL?: string) {
739
739
  );
740
740
 
741
741
  const fpStreamUrl = fpRes2.data?.data?.[0];
742
- if (fpStreamUrl && fpStreamUrl.startsWith('http')) {
742
+ if (fpStreamUrl && fpStreamUrl?.startsWith('http')) {
743
743
  extraSources.push({
744
744
  url: fpStreamUrl,
745
745
  server: 'Filepress',
@@ -1,3 +1,4 @@
1
+ import CryptoJS from 'crypto-js';
1
2
  import type { ExtractorContext, IVideoExtractor, ExtractorContextConfig } from '../models';
2
3
  import { StreamingServers } from '../models';
3
4
  import type { ExtractorInfo } from '../models/extension-manifest';
@@ -198,6 +199,9 @@ export class ExtractorManager {
198
199
  }
199
200
  const extractorCode = await response.text();
200
201
 
202
+ // Integrity check — reject if hash doesn't match the bundled registry
203
+ this.verifyCodeIntegrity(extractorCode, metadata.sha256, metadata.name as string);
204
+
201
205
  // Execute the extractor code
202
206
  const extractorInstance = await this.executeExtractorCode(extractorCode, metadata);
203
207
 
@@ -242,9 +246,9 @@ export class ExtractorManager {
242
246
  const fetch = context.fetch;
243
247
  const URL = context.URL;
244
248
  const URLSearchParams = context.URLSearchParams;
245
- const __awaiter = context.__awaiter;
246
249
  const axios = context.axios;
247
250
  const load = context.load;
251
+ const CryptoJS = context.CryptoJS;
248
252
  const sharedUtils = context.sharedUtils;
249
253
 
250
254
  try {
@@ -289,6 +293,10 @@ export class ExtractorManager {
289
293
  MegaUp: 'megaup',
290
294
  MegaPlay: 'megaplay',
291
295
  Kwik: 'kwik',
296
+ VidHide: 'vidhide',
297
+ HubCloud: 'hubcloud',
298
+ GDFlix: 'gdflix',
299
+ Gofile: 'gofile',
292
300
  },
293
301
  MediaStatus: {
294
302
  COMPLETED: 'completed',
@@ -362,39 +370,27 @@ export class ExtractorManager {
362
370
  throw new Error(`fetch failed: ${error.message || error}`);
363
371
  }
364
372
  },
365
- __awaiter: (thisArg: any, _arguments: any, P: any, generator: any) => {
366
- function adopt(value: any) {
367
- return value instanceof P ? value : new P((resolve: any) => resolve(value));
368
- }
369
- return new (P || (P = Promise))((resolve: any, reject: any) => {
370
- function fulfilled(value: any) {
371
- try {
372
- step(generator.next(value));
373
- } catch (e) {
374
- reject(e);
375
- }
376
- }
377
- function rejected(value: any) {
378
- try {
379
- step(generator.throw(value));
380
- } catch (e) {
381
- reject(e);
382
- }
383
- }
384
- function step(result: any) {
385
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
386
- }
387
- step((generator = generator.apply(thisArg, _arguments || [])).next());
388
- });
389
- },
390
- // Provide extractor context for context-aware extractors
391
373
  axios: extractorContext.axios,
392
374
  load: extractorContext.load,
375
+ CryptoJS,
393
376
  console,
394
377
  URL: extractorContext.PolyURL,
395
378
  URLSearchParams: extractorContext.PolyURLSearchParams,
396
379
  };
397
380
  }
381
+
382
+ private verifyCodeIntegrity(code: string, expectedHash: string | undefined, id: string): void {
383
+ if (!expectedHash) {
384
+ console.warn(`⚠️ No integrity hash for '${id}' — skipping verification`);
385
+ return;
386
+ }
387
+ const actual = CryptoJS.SHA256(code).toString(CryptoJS.enc.Hex);
388
+ if (actual !== expectedHash) {
389
+ throw new Error(
390
+ `Integrity check failed for '${id}': expected ${expectedHash.slice(0, 12)}… got ${actual.slice(0, 12)}…`
391
+ );
392
+ }
393
+ }
398
394
  }
399
395
 
400
396
  export default ExtractorManager;
@@ -1,3 +1,4 @@
1
+ import CryptoJS from 'crypto-js';
1
2
  import createProviderContext from './create-provider-context';
2
3
  import type { ProviderContext } from '../models/provider-context';
3
4
  import { type IAnimeResult, type IMovieResult, type ISearch, type ProviderContextConfig } from '../models';
@@ -5,6 +6,8 @@ import extensionRegistry from '../extension-registry.json';
5
6
  import type { ExtensionManifest, ProviderType } from '../models/extension-manifest';
6
7
  import { animeProviders, movieProviders, type AnimeProvider, type MovieProvider } from './provider-maps';
7
8
 
9
+ const FACTORY_NAME_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
10
+
8
11
  export class ProviderManager {
9
12
  private providerContext: ProviderContext;
10
13
  private loadedExtensions = new Map<string, any>();
@@ -125,11 +128,17 @@ export class ProviderManager {
125
128
  }
126
129
  const providerCode = await response.text();
127
130
 
131
+ // Integrity check — reject if hash doesn't match the bundled registry
132
+ this.verifyCodeIntegrity(providerCode, metadata.sha256, extensionId as string);
133
+
128
134
  // Execute the provider code
129
135
  const factoryName = metadata.factoryName; // Use factory name directly
130
136
  if (!factoryName) {
131
137
  throw new Error(`No factory function available for extension ${extensionId}`);
132
138
  }
139
+ if (!FACTORY_NAME_RE.test(factoryName)) {
140
+ throw new Error(`Invalid factoryName '${factoryName}' for extension '${extensionId}'`);
141
+ }
133
142
  let providerInstance = await this.executeProviderCode(
134
143
  providerCode,
135
144
  factoryName,
@@ -224,7 +233,6 @@ export class ProviderManager {
224
233
  const Promise = context.Promise;
225
234
  const Object = context.Object;
226
235
  const fetch = context.fetch;
227
- const __awaiter = context.__awaiter;
228
236
 
229
237
  try {
230
238
  ${code}
@@ -326,7 +334,6 @@ export class ProviderManager {
326
334
  Promise,
327
335
  Object,
328
336
  fetch: customFetch,
329
- __awaiter: this.createAwaiterHelper(),
330
337
  URL: this.providerContext.PolyURL,
331
338
  URLSearchParams: this.providerContext.PolyURLSearchParams,
332
339
  };
@@ -346,6 +353,13 @@ export class ProviderManager {
346
353
  StreamTape: 'streamtape',
347
354
  VidStreaming: 'vidstreaming',
348
355
  MegaCloud: 'megacloud',
356
+ MegaUp: 'megaup',
357
+ MegaPlay: 'megaplay',
358
+ Kwik: 'kwik',
359
+ VidHide: 'vidhide',
360
+ HubCloud: 'hubcloud',
361
+ GDFlix: 'gdflix',
362
+ Gofile: 'gofile',
349
363
  },
350
364
  MediaStatus: {
351
365
  COMPLETED: 'completed',
@@ -369,37 +383,6 @@ export class ProviderManager {
369
383
  };
370
384
  }
371
385
 
372
- /**
373
- * Create __awaiter helper for compatibility
374
- */
375
- private createAwaiterHelper() {
376
- return (thisArg: any, _arguments: any, P: any, generator: any) => {
377
- function adopt(value: any) {
378
- return value instanceof P ? value : new P((resolve: any) => resolve(value));
379
- }
380
- return new (P || (P = Promise))((resolve: any, reject: any) => {
381
- function fulfilled(value: any) {
382
- try {
383
- step(generator.next(value));
384
- } catch (e) {
385
- reject(e);
386
- }
387
- }
388
- function rejected(value: any) {
389
- try {
390
- step(generator.throw(value));
391
- } catch (e) {
392
- reject(e);
393
- }
394
- }
395
- function step(result: any) {
396
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
397
- }
398
- step((generator = generator.apply(thisArg, _arguments || [])).next());
399
- });
400
- };
401
- }
402
-
403
386
  /**
404
387
  * Validate provider instance based on category
405
388
  */
@@ -485,6 +468,23 @@ export class ProviderManager {
485
468
 
486
469
  return Promise.all(searchPromises);
487
470
  }
471
+
472
+ /**
473
+ * Verify SHA-256 integrity of fetched code against the bundled registry hash.
474
+ * Throws if hashes don't match. Warns (but allows) if no hash is present in registry.
475
+ */
476
+ private verifyCodeIntegrity(code: string, expectedHash: string | undefined, id: string): void {
477
+ if (!expectedHash) {
478
+ console.warn(`⚠️ No integrity hash for '${id}' — skipping verification`);
479
+ return;
480
+ }
481
+ const actual = CryptoJS.SHA256(code).toString(CryptoJS.enc.Hex);
482
+ if (actual !== expectedHash) {
483
+ throw new Error(
484
+ `Integrity check failed for '${id}': expected ${expectedHash.slice(0, 12)}… got ${actual.slice(0, 12)}…`
485
+ );
486
+ }
487
+ }
488
488
  }
489
489
 
490
490
  export default ProviderManager;
@@ -1,4 +1,5 @@
1
1
  import { load } from 'cheerio';
2
+ import CryptoJS from 'crypto-js';
2
3
  import type { ExtractorContext } from '../models';
3
4
  import { defaultAxios } from './extension-utils';
4
5
  import { PolyURL, PolyURLSearchParams } from './url-polyfill';
@@ -20,6 +21,7 @@ export function createExtractorContext(config: ExtractorContextConfig = {}): Ext
20
21
  return {
21
22
  axios: config.axios || defaultAxios,
22
23
  load: config.load || load,
24
+ CryptoJS,
23
25
  USER_AGENT:
24
26
  config.userAgent ||
25
27
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
@@ -1,4 +1,5 @@
1
1
  import { load } from 'cheerio';
2
+ import CryptoJS from 'crypto-js';
2
3
  import type { ProviderContext, ProviderContextConfig } from '../models/provider-context';
3
4
  import {
4
5
  AnimeParser,
@@ -87,6 +88,7 @@ export function createProviderContext(config: ProviderContextConfig = {}): Provi
87
88
  return {
88
89
  axios: config.axios || defaultAxios,
89
90
  load: config.load || load,
91
+ CryptoJS,
90
92
  USER_AGENT:
91
93
  config.userAgent ||
92
94
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
@@ -1,4 +1,5 @@
1
1
  import axios from 'axios';
2
+ import CryptoJS from 'crypto-js';
2
3
 
3
4
  // Import extractors for fallback compatibility
4
5
  import {
@@ -25,6 +26,7 @@ import {
25
26
  GDFlix,
26
27
  Gofile,
27
28
  HubCloud,
29
+ FlixCloud,
28
30
  } from '../extractors';
29
31
  import { load } from 'cheerio';
30
32
  import { USER_AGENT } from './utils';
@@ -56,6 +58,7 @@ export const defaultAxios = axios.create({
56
58
  export const defaultExtractorContext: ExtractorContext = {
57
59
  axios: defaultAxios,
58
60
  load: load,
61
+ CryptoJS,
59
62
  USER_AGENT: USER_AGENT,
60
63
  PolyURL: PolyURL,
61
64
  PolyURLSearchParams: PolyURLSearchParams,
@@ -95,6 +98,7 @@ export const defaultExtractors = {
95
98
  GDFlix: (ctx?: ExtractorContext) => GDFlix(ctx || defaultExtractorContext),
96
99
  Gofile: (ctx?: ExtractorContext) => Gofile(ctx || defaultExtractorContext),
97
100
  HubCloud: (ctx?: ExtractorContext) => HubCloud(ctx || defaultExtractorContext),
101
+ FlixCloud: (ctx?: ExtractorContext) => FlixCloud(ctx || defaultExtractorContext),
98
102
  };
99
103
 
100
104
  export const extractors = {
@@ -116,6 +120,7 @@ export const extractors = {
116
120
  GDFlix: defaultExtractors.GDFlix,
117
121
  Gofile: defaultExtractors.Gofile,
118
122
  HubCloud: defaultExtractors.HubCloud,
123
+ FlixCloud: defaultExtractors.FlixCloud,
119
124
  };
120
125
 
121
126
  // Type definitions for provider and extractor instances