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
|
@@ -14,11 +14,22 @@ import {
|
|
|
14
14
|
} from '../../../models';
|
|
15
15
|
|
|
16
16
|
function createAnimePahe(ctx: ProviderContext, customBaseURL?: string) {
|
|
17
|
-
const {
|
|
17
|
+
const { load, extractors, enums, createCustomBaseUrl, PolyURL, NativeConsumet, CryptoJS, axios } = ctx;
|
|
18
18
|
const { Kwik } = extractors;
|
|
19
|
+
const { makeGetRequestWithWebView } = NativeConsumet;
|
|
20
|
+
|
|
21
|
+
const extractorCtx = {
|
|
22
|
+
axios,
|
|
23
|
+
load,
|
|
24
|
+
CryptoJS,
|
|
25
|
+
USER_AGENT: ctx.USER_AGENT,
|
|
26
|
+
PolyURL: ctx.PolyURL,
|
|
27
|
+
PolyURLSearchParams: ctx.PolyURLSearchParams,
|
|
28
|
+
NativeConsumet,
|
|
29
|
+
};
|
|
30
|
+
|
|
19
31
|
const { StreamingServers: StreamingServersEnum, SubOrDub: SubOrDubEnum, MediaStatus: MediaStatusEnum } = enums;
|
|
20
|
-
|
|
21
|
-
// Provider configuration - use the standardized base URL creation
|
|
32
|
+
|
|
22
33
|
const baseUrl = createCustomBaseUrl('https://animepahe.pw', customBaseURL);
|
|
23
34
|
|
|
24
35
|
const config: ProviderConfig = {
|
|
@@ -31,81 +42,95 @@ function createAnimePahe(ctx: ProviderContext, customBaseURL?: string) {
|
|
|
31
42
|
isWorking: true,
|
|
32
43
|
isDubAvailableSeparately: true,
|
|
33
44
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
45
|
+
|
|
46
|
+
const UA =
|
|
47
|
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36';
|
|
48
|
+
|
|
49
|
+
// ── WebView helpers ────────────────────────────────────────────────────────
|
|
50
|
+
let _challengePassed = false;
|
|
51
|
+
const ensureChallengePassed = async () => {
|
|
52
|
+
if (_challengePassed) return;
|
|
53
|
+
await makeGetRequestWithWebView(config.baseUrl, { 'User-Agent': UA });
|
|
54
|
+
_challengePassed = true;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const withRetry = async <T>(fn: () => Promise<T>, retries = 2): Promise<T> => {
|
|
41
58
|
try {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
59
|
+
return await fn();
|
|
60
|
+
} catch (err: any) {
|
|
61
|
+
const msg = String(err?.message ?? err);
|
|
62
|
+
const isQuic = msg.includes('QUIC') || msg.includes('ERR_QUIC');
|
|
63
|
+
const isJsonOrEmpty =
|
|
64
|
+
msg.includes('JSON Parse error') ||
|
|
65
|
+
msg.includes('Unexpected token') ||
|
|
66
|
+
msg.includes('Unexpected character') ||
|
|
67
|
+
msg.includes('Empty response');
|
|
68
|
+
if (retries > 0 && (isQuic || isJsonOrEmpty)) {
|
|
69
|
+
if (isJsonOrEmpty) await new Promise((r) => setTimeout(r, 800));
|
|
70
|
+
return withRetry(fn, retries - 1);
|
|
47
71
|
}
|
|
48
|
-
|
|
49
|
-
console.error('Failed to initialize DDoS-Guard cookie:', error);
|
|
72
|
+
throw err;
|
|
50
73
|
}
|
|
51
74
|
};
|
|
52
75
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
'x-requested-with': 'XMLHttpRequest',
|
|
64
|
-
'Referer': sessionId ? `${config.baseUrl}/anime/${sessionId}` : `${config.baseUrl}`,
|
|
65
|
-
'user-agent':
|
|
66
|
-
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36',
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
if (ddgCookie) {
|
|
70
|
-
headers.Cookie = typeof ddgCookie === 'object' && ddgCookie !== null ? ddgCookie.cookie : ddgCookie || '';
|
|
71
|
-
}
|
|
76
|
+
// Fetches an HTML page through the WebView (bypasses DDoS-Guard JS challenge).
|
|
77
|
+
const webViewGet = async (url: string, referer?: string): Promise<string> => {
|
|
78
|
+
return withRetry(async () => {
|
|
79
|
+
const res = await makeGetRequestWithWebView(url, {
|
|
80
|
+
'User-Agent': UA,
|
|
81
|
+
'Referer': referer ?? config.baseUrl,
|
|
82
|
+
});
|
|
83
|
+
return res.html ?? '';
|
|
84
|
+
});
|
|
85
|
+
};
|
|
72
86
|
|
|
73
|
-
|
|
74
|
-
|
|
87
|
+
const webViewGetJson = async <T = any>(url: string, referer?: string): Promise<T> => {
|
|
88
|
+
return withRetry(async () => {
|
|
89
|
+
const res = await makeGetRequestWithWebView(url, {
|
|
90
|
+
'User-Agent': UA,
|
|
91
|
+
'Accept': 'application/json, text/javascript, */*; q=0.01',
|
|
92
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
93
|
+
'Referer': referer ?? config.baseUrl,
|
|
94
|
+
});
|
|
95
|
+
const raw = (res.html ?? '').replace(/<[^>]*>/g, '').trim();
|
|
96
|
+
console.log(raw);
|
|
75
97
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
headers: Headers(session),
|
|
98
|
+
if (!raw) throw new Error(`[AnimePahe] Empty response from ${url}`);
|
|
99
|
+
return JSON.parse(raw) as T;
|
|
79
100
|
});
|
|
80
|
-
|
|
101
|
+
};
|
|
81
102
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
103
|
+
// ── Episode list ───────────────────────────────────────────────────────────
|
|
104
|
+
|
|
105
|
+
const mapEpisode = (session: string, item: any): IAnimeEpisode => ({
|
|
106
|
+
id: `${session}/${item.session}`,
|
|
107
|
+
number: item.episode,
|
|
108
|
+
title: item.title,
|
|
109
|
+
image: item.snapshot,
|
|
110
|
+
duration: item.duration,
|
|
111
|
+
isSubbed: item.audio === 'jpn' || item.audio === 'eng',
|
|
112
|
+
isDubbed: item.audio === 'eng',
|
|
113
|
+
releaseDate: item.created_at,
|
|
114
|
+
url: `${config.baseUrl}/play/${session}/${item.session}`,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const fetchEpisodePage = async (session: string, page: number): Promise<IAnimeEpisode[]> => {
|
|
118
|
+
const data = await webViewGetJson<{ data: any[] }>(
|
|
119
|
+
`${config.baseUrl}/api?m=release&id=${session}&sort=episode_asc&page=${page}`,
|
|
120
|
+
`${config.baseUrl}/anime/${session}`
|
|
121
|
+
);
|
|
122
|
+
return data.data.map((item: any) => mapEpisode(session, item));
|
|
97
123
|
};
|
|
98
124
|
|
|
125
|
+
// ── Public methods ─────────────────────────────────────────────────────────
|
|
126
|
+
|
|
99
127
|
const search = async (query: string, page: number = 1): Promise<ISearch<IAnimeResult>> => {
|
|
100
128
|
try {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
const res = {
|
|
129
|
+
await ensureChallengePassed();
|
|
130
|
+
const data = await webViewGetJson<{ data: any[] }>(
|
|
131
|
+
`${config.baseUrl}/api?m=search&q=${encodeURIComponent(query)}`
|
|
132
|
+
);
|
|
133
|
+
return {
|
|
109
134
|
results: data.data.map((item: any) => ({
|
|
110
135
|
id: item.session,
|
|
111
136
|
title: item.title,
|
|
@@ -115,35 +140,23 @@ function createAnimePahe(ctx: ProviderContext, customBaseURL?: string) {
|
|
|
115
140
|
type: item.type,
|
|
116
141
|
})),
|
|
117
142
|
};
|
|
118
|
-
|
|
119
|
-
return res;
|
|
120
143
|
} catch (err) {
|
|
121
|
-
//console.log(err);
|
|
122
144
|
throw new Error((err as Error).message);
|
|
123
145
|
}
|
|
124
146
|
};
|
|
125
147
|
|
|
126
148
|
const fetchAnimeInfo = async (id: string, episodePage: number = -1): Promise<IAnimeInfo> => {
|
|
127
|
-
const animeInfo: IAnimeInfo = {
|
|
128
|
-
id: id,
|
|
129
|
-
title: '',
|
|
130
|
-
};
|
|
149
|
+
const animeInfo: IAnimeInfo = { id, title: '' };
|
|
131
150
|
try {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
const res = await fetch(`${config.baseUrl}/anime/${id}`, {
|
|
136
|
-
headers: Headers(id),
|
|
137
|
-
});
|
|
138
|
-
const data = await res.text();
|
|
139
|
-
const $ = load(data);
|
|
151
|
+
const html = await webViewGet(`${config.baseUrl}/anime/${id}`);
|
|
152
|
+
const $ = load(html);
|
|
140
153
|
|
|
141
154
|
animeInfo.title = $('div.title-wrapper > h1 > span').first().text();
|
|
142
155
|
animeInfo.image = $('div.anime-poster a').attr('href');
|
|
143
156
|
animeInfo.cover = `https:${$('div.anime-cover').attr('data-src')}`;
|
|
144
157
|
animeInfo.description = $('div.anime-summary').text().trim();
|
|
145
158
|
animeInfo.genres = $('div.anime-genre ul li')
|
|
146
|
-
.map((
|
|
159
|
+
.map((_, el) => $(el).find('a').attr('title'))
|
|
147
160
|
.get();
|
|
148
161
|
animeInfo.hasSub = true;
|
|
149
162
|
|
|
@@ -165,8 +178,9 @@ function createAnimePahe(ctx: ProviderContext, customBaseURL?: string) {
|
|
|
165
178
|
.trim();
|
|
166
179
|
animeInfo.studios = $('div.anime-info > p:contains("Studio:")').text().replace('Studio:', '').trim().split('\n');
|
|
167
180
|
animeInfo.totalEpisodes = parseInt($('div.anime-info > p:contains("Episodes:")').text().replace('Episodes:', ''));
|
|
181
|
+
|
|
168
182
|
animeInfo.recommendations = [];
|
|
169
|
-
$('div.anime-recommendation .col-sm-6').each((
|
|
183
|
+
$('div.anime-recommendation .col-sm-6').each((_, el) => {
|
|
170
184
|
animeInfo.recommendations?.push({
|
|
171
185
|
id: $(el).find('.col-2 > a').attr('href')?.split('/')[2]!,
|
|
172
186
|
title: $(el).find('.col-2 > a').attr('title')!,
|
|
@@ -178,7 +192,7 @@ function createAnimePahe(ctx: ProviderContext, customBaseURL?: string) {
|
|
|
178
192
|
});
|
|
179
193
|
|
|
180
194
|
animeInfo.relations = [];
|
|
181
|
-
$('div.anime-relation .col-sm-6').each((
|
|
195
|
+
$('div.anime-relation .col-sm-6').each((_, el) => {
|
|
182
196
|
animeInfo.relations?.push({
|
|
183
197
|
id: $(el).find('.col-2 > a').attr('href')?.split('/')[2]!,
|
|
184
198
|
title: $(el).find('.col-2 > a').attr('title')!,
|
|
@@ -192,36 +206,17 @@ function createAnimePahe(ctx: ProviderContext, customBaseURL?: string) {
|
|
|
192
206
|
|
|
193
207
|
animeInfo.episodes = [];
|
|
194
208
|
if (episodePage < 0) {
|
|
195
|
-
const {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
headers: Headers(id),
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
animeInfo.episodePages = last_page;
|
|
202
|
-
|
|
203
|
-
animeInfo.episodes.push(
|
|
204
|
-
...data.map(
|
|
205
|
-
(item: any) =>
|
|
206
|
-
({
|
|
207
|
-
id: `${id}/${item.session}`,
|
|
208
|
-
number: item.episode,
|
|
209
|
-
title: item.title,
|
|
210
|
-
image: item.snapshot,
|
|
211
|
-
duration: item.duration,
|
|
212
|
-
isSubbed: item.audio === 'jpn' || item.audio === 'eng',
|
|
213
|
-
isDubbed: item.audio === 'eng',
|
|
214
|
-
releaseDate: item.created_at,
|
|
215
|
-
url: `${config.baseUrl}/play/${id}/${item.session}`,
|
|
216
|
-
}) as IAnimeEpisode
|
|
217
|
-
)
|
|
209
|
+
const firstPage = await webViewGetJson<{ last_page: number; data: any[] }>(
|
|
210
|
+
`${config.baseUrl}/api?m=release&id=${id}&sort=episode_asc&page=1`,
|
|
211
|
+
`${config.baseUrl}/anime/${id}`
|
|
218
212
|
);
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
213
|
+
animeInfo.episodePages = firstPage.last_page;
|
|
214
|
+
animeInfo.episodes.push(...firstPage.data.map((item: any) => mapEpisode(id, item)));
|
|
215
|
+
for (let i = 2; i <= firstPage.last_page; i++) {
|
|
216
|
+
animeInfo.episodes.push(...(await fetchEpisodePage(id, i)));
|
|
222
217
|
}
|
|
223
218
|
} else {
|
|
224
|
-
animeInfo.episodes.push(...(await
|
|
219
|
+
animeInfo.episodes.push(...(await fetchEpisodePage(id, episodePage)));
|
|
225
220
|
}
|
|
226
221
|
|
|
227
222
|
return animeInfo;
|
|
@@ -236,16 +231,11 @@ function createAnimePahe(ctx: ProviderContext, customBaseURL?: string) {
|
|
|
236
231
|
subOrDub: SubOrDub = SubOrDubEnum.SUB
|
|
237
232
|
): Promise<ISource> => {
|
|
238
233
|
try {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
const { data } = await axios.get(`${config.baseUrl}/play/${episodeId}`, {
|
|
243
|
-
headers: Headers(episodeId.split('/')[0]!),
|
|
244
|
-
});
|
|
234
|
+
const html = await webViewGet(`${config.baseUrl}/play/${episodeId}`);
|
|
235
|
+
const $ = load(html);
|
|
245
236
|
|
|
246
|
-
const $ = load(data);
|
|
247
237
|
const links = $('div#resolutionMenu > button')
|
|
248
|
-
.map((
|
|
238
|
+
.map((_, el) => ({
|
|
249
239
|
url: $(el).attr('data-src')!,
|
|
250
240
|
quality: $(el).text(),
|
|
251
241
|
audio: $(el).attr('data-audio'),
|
|
@@ -253,37 +243,22 @@ function createAnimePahe(ctx: ProviderContext, customBaseURL?: string) {
|
|
|
253
243
|
.get();
|
|
254
244
|
|
|
255
245
|
const downloads = $('div#pickDownload > a')
|
|
256
|
-
.map((
|
|
257
|
-
url: $(el).attr('href')!,
|
|
258
|
-
quality: $(el).text(),
|
|
259
|
-
}))
|
|
246
|
+
.map((_, el) => ({ url: $(el).attr('href')!, quality: $(el).text() }))
|
|
260
247
|
.get();
|
|
261
248
|
|
|
262
|
-
const iSource: ISource = {
|
|
263
|
-
headers: {
|
|
264
|
-
Referer: 'https://kwik.si/',
|
|
265
|
-
},
|
|
266
|
-
sources: [],
|
|
267
|
-
};
|
|
268
|
-
|
|
249
|
+
const iSource: ISource = { headers: { Referer: 'https://kwik.cx/' }, sources: [] };
|
|
269
250
|
iSource.download = downloads;
|
|
270
251
|
|
|
271
|
-
// Filter links based on subOrDub parameter
|
|
272
252
|
const filteredLinks = links.filter((link) => {
|
|
273
253
|
const isDub = link.audio === 'eng';
|
|
274
|
-
if (subOrDub === SubOrDubEnum.DUB)
|
|
275
|
-
|
|
276
|
-
} else if (subOrDub === SubOrDubEnum.SUB) {
|
|
277
|
-
return !isDub;
|
|
278
|
-
}
|
|
279
|
-
// For SubOrDubEnum.BOTH, return all links
|
|
254
|
+
if (subOrDub === SubOrDubEnum.DUB) return isDub;
|
|
255
|
+
if (subOrDub === SubOrDubEnum.SUB) return !isDub;
|
|
280
256
|
return true;
|
|
281
257
|
});
|
|
282
258
|
|
|
283
|
-
// Extract sources from filtered links
|
|
284
259
|
for (const link of filteredLinks) {
|
|
285
|
-
const res = await Kwik().extract(new PolyURL(link.url));
|
|
286
|
-
if (res
|
|
260
|
+
const res = await Kwik(extractorCtx).extract(new PolyURL(link.url), `${config.baseUrl}/`);
|
|
261
|
+
if (res?.sources?.length) {
|
|
287
262
|
res.sources.forEach((source: any) => {
|
|
288
263
|
iSource.sources.push({
|
|
289
264
|
...source,
|
|
@@ -302,27 +277,17 @@ function createAnimePahe(ctx: ProviderContext, customBaseURL?: string) {
|
|
|
302
277
|
|
|
303
278
|
const fetchEpisodeServers = async (episodeId: string, subOrDub: SubOrDub): Promise<IEpisodeServer[]> => {
|
|
304
279
|
try {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
}
|
|
308
|
-
const { data } = await axios.get(`${config.baseUrl}/play/${episodeId}`, {
|
|
309
|
-
headers: Headers(episodeId.split('/')[0]!),
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
const $ = load(data);
|
|
280
|
+
const html = await webViewGet(`${config.baseUrl}/play/${episodeId}`);
|
|
281
|
+
const $ = load(html);
|
|
313
282
|
const servers: IEpisodeServer[] = [];
|
|
314
283
|
|
|
315
|
-
$('div#resolutionMenu > button').each((
|
|
284
|
+
$('div#resolutionMenu > button').each((_, el) => {
|
|
316
285
|
const audio = $(el).attr('data-audio');
|
|
317
286
|
const fansub = $(el).attr('data-fansub');
|
|
318
287
|
const src = $(el).attr('data-src');
|
|
319
288
|
const resolution = $(el).attr('data-resolution');
|
|
320
|
-
|
|
321
289
|
if ((subOrDub === SubOrDubEnum.DUB && audio === 'eng') || (subOrDub === SubOrDubEnum.SUB && audio !== 'eng')) {
|
|
322
|
-
servers.push({
|
|
323
|
-
url: src!,
|
|
324
|
-
name: `kwik-${fansub}-${resolution}`,
|
|
325
|
-
});
|
|
290
|
+
servers.push({ url: src!, name: `kwik-${fansub}-${resolution}` });
|
|
326
291
|
}
|
|
327
292
|
});
|
|
328
293
|
|
|
@@ -333,10 +298,8 @@ function createAnimePahe(ctx: ProviderContext, customBaseURL?: string) {
|
|
|
333
298
|
}
|
|
334
299
|
};
|
|
335
300
|
|
|
336
|
-
// Return the functional provider object
|
|
337
301
|
return {
|
|
338
302
|
...config,
|
|
339
|
-
// Core methods, pass only the necessary methods, dont pass helpers or unused methods
|
|
340
303
|
search,
|
|
341
304
|
fetchAnimeInfo,
|
|
342
305
|
fetchEpisodeSources,
|
|
@@ -344,8 +307,5 @@ function createAnimePahe(ctx: ProviderContext, customBaseURL?: string) {
|
|
|
344
307
|
};
|
|
345
308
|
}
|
|
346
309
|
|
|
347
|
-
// Type definition for the provider instance returned by createAnimePahe
|
|
348
310
|
export type AnimePaheProviderInstance = ReturnType<typeof createAnimePahe>;
|
|
349
|
-
|
|
350
|
-
// Default export for backward compatibility
|
|
351
311
|
export default createAnimePahe;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AnimeParser } from '../../../models';
|
|
2
|
+
import { createProviderContext } from '../../../utils/create-provider-context';
|
|
3
|
+
import createAniNeko, { type AniNekoProviderInstance } from './create-anineko';
|
|
4
|
+
|
|
5
|
+
export class AniNeko extends AnimeParser {
|
|
6
|
+
private instance: AniNekoProviderInstance;
|
|
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) {
|
|
16
|
+
super();
|
|
17
|
+
const defaultContext = createProviderContext();
|
|
18
|
+
this.instance = createAniNeko(defaultContext, customBaseURL);
|
|
19
|
+
|
|
20
|
+
this.logo = this.instance.logo;
|
|
21
|
+
this.name = this.instance.name;
|
|
22
|
+
this.baseUrl = this.instance.baseUrl;
|
|
23
|
+
this.classPath = this.instance.classPath;
|
|
24
|
+
this.isNSFW = this.instance.isNSFW ?? false;
|
|
25
|
+
this.isWorking = this.instance.isWorking ?? true;
|
|
26
|
+
this.isDubAvailableSeparately = this.instance.isDubAvailableSeparately ?? false;
|
|
27
|
+
|
|
28
|
+
this.search = this.instance.search;
|
|
29
|
+
this.fetchAnimeInfo = this.instance.fetchAnimeInfo;
|
|
30
|
+
this.fetchEpisodeServers = this.instance.fetchEpisodeServers;
|
|
31
|
+
this.fetchEpisodeSources = this.instance.fetchEpisodeSources;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
search!: AniNekoProviderInstance['search'];
|
|
35
|
+
fetchAnimeInfo!: AniNekoProviderInstance['fetchAnimeInfo'];
|
|
36
|
+
fetchEpisodeServers!: AniNekoProviderInstance['fetchEpisodeServers'];
|
|
37
|
+
fetchEpisodeSources!: AniNekoProviderInstance['fetchEpisodeSources'];
|
|
38
|
+
fetchRecentlyUpdated!: AniNekoProviderInstance['fetchRecentlyUpdated'];
|
|
39
|
+
fetchNewReleases!: AniNekoProviderInstance['fetchNewReleases'];
|
|
40
|
+
fetchRecentlyAdded!: AniNekoProviderInstance['fetchRecentlyAdded'];
|
|
41
|
+
genreSearch!: AniNekoProviderInstance['genreSearch'];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default AniNeko;
|