react-native-consumet 1.4.0 → 1.5.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/lib/commonjs/extension-registry.json +30 -1
- 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/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/utils/ExtractorManager.js +8 -1
- package/lib/commonjs/utils/ExtractorManager.js.map +1 -1
- package/lib/commonjs/utils/ProviderManager.js +8 -1
- 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 +30 -1
- 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/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/utils/ExtractorManager.js +8 -1
- package/lib/module/utils/ExtractorManager.js.map +1 -1
- package/lib/module/utils/ProviderManager.js +8 -1
- 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/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/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.map +1 -1
- 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/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/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.map +1 -1
- 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 +1 -1
- package/src/extension-registry.json +30 -1
- 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/extractor-context.ts +3 -0
- package/src/models/provider-context.ts +6 -0
- package/src/models/types.ts +1 -0
- 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/utils/ExtractorManager.ts +7 -0
- package/src/utils/ProviderManager.ts +7 -0
- 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
|
@@ -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;
|
|
@@ -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';
|
|
@@ -245,6 +246,7 @@ export class ExtractorManager {
|
|
|
245
246
|
const __awaiter = context.__awaiter;
|
|
246
247
|
const axios = context.axios;
|
|
247
248
|
const load = context.load;
|
|
249
|
+
const CryptoJS = context.CryptoJS;
|
|
248
250
|
const sharedUtils = context.sharedUtils;
|
|
249
251
|
|
|
250
252
|
try {
|
|
@@ -289,6 +291,10 @@ export class ExtractorManager {
|
|
|
289
291
|
MegaUp: 'megaup',
|
|
290
292
|
MegaPlay: 'megaplay',
|
|
291
293
|
Kwik: 'kwik',
|
|
294
|
+
VidHide: 'vidhide',
|
|
295
|
+
HubCloud: 'hubcloud',
|
|
296
|
+
GDFlix: 'gdflix',
|
|
297
|
+
Gofile: 'gofile',
|
|
292
298
|
},
|
|
293
299
|
MediaStatus: {
|
|
294
300
|
COMPLETED: 'completed',
|
|
@@ -390,6 +396,7 @@ export class ExtractorManager {
|
|
|
390
396
|
// Provide extractor context for context-aware extractors
|
|
391
397
|
axios: extractorContext.axios,
|
|
392
398
|
load: extractorContext.load,
|
|
399
|
+
CryptoJS,
|
|
393
400
|
console,
|
|
394
401
|
URL: extractorContext.PolyURL,
|
|
395
402
|
URLSearchParams: extractorContext.PolyURLSearchParams,
|
|
@@ -346,6 +346,13 @@ export class ProviderManager {
|
|
|
346
346
|
StreamTape: 'streamtape',
|
|
347
347
|
VidStreaming: 'vidstreaming',
|
|
348
348
|
MegaCloud: 'megacloud',
|
|
349
|
+
MegaUp: 'megaup',
|
|
350
|
+
MegaPlay: 'megaplay',
|
|
351
|
+
Kwik: 'kwik',
|
|
352
|
+
VidHide: 'vidhide',
|
|
353
|
+
HubCloud: 'hubcloud',
|
|
354
|
+
GDFlix: 'gdflix',
|
|
355
|
+
Gofile: 'gofile',
|
|
349
356
|
},
|
|
350
357
|
MediaStatus: {
|
|
351
358
|
COMPLETED: 'completed',
|
|
@@ -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
|