react-native-consumet 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Consumet.podspec +9 -0
- package/README.md +7 -0
- package/android/generated/jni/CMakeLists.txt +1 -9
- package/android/generated/jni/react/renderer/components/RNConsumetSpec/RNConsumetSpecJSI.h +65 -92
- package/ios/Consumet.h +1 -1
- package/ios/Consumet.mm +681 -7
- package/ios/generated/Package.swift +66 -0
- package/ios/generated/ReactAppDependencyProvider/RCTAppDependencyProvider.h +25 -0
- package/ios/generated/ReactAppDependencyProvider/RCTAppDependencyProvider.mm +40 -0
- package/ios/generated/ReactAppDependencyProvider/ReactAppDependencyProvider.podspec +34 -0
- package/ios/generated/ReactCodegen/RCTModuleProviders.h +16 -0
- package/ios/generated/ReactCodegen/RCTModuleProviders.mm +51 -0
- package/ios/generated/ReactCodegen/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/ios/generated/ReactCodegen/RCTModulesConformingToProtocolsProvider.mm +54 -0
- package/ios/generated/ReactCodegen/RCTThirdPartyComponentsProvider.h +16 -0
- package/ios/generated/ReactCodegen/RCTThirdPartyComponentsProvider.mm +30 -0
- package/ios/generated/ReactCodegen/RCTUnstableModulesRequiringMainQueueSetupProvider.h +14 -0
- package/ios/generated/ReactCodegen/RCTUnstableModulesRequiringMainQueueSetupProvider.mm +19 -0
- package/ios/generated/ReactCodegen/RNConsumetSpecJSI.h +98 -0
- package/ios/generated/ReactCodegen/ReactCodegen.podspec +114 -0
- package/lib/commonjs/extension-registry.json +106 -29
- package/lib/commonjs/extractors/flixcloud.js +179 -0
- package/lib/commonjs/extractors/flixcloud.js.map +1 -0
- package/lib/commonjs/extractors/index.js +7 -0
- package/lib/commonjs/extractors/index.js.map +1 -1
- package/lib/commonjs/extractors/kwik.js +59 -74
- package/lib/commonjs/extractors/kwik.js.map +1 -1
- package/lib/commonjs/extractors/megaplay.js +196 -124
- package/lib/commonjs/extractors/megaplay.js.map +1 -1
- package/lib/commonjs/extractors/vidhide.js +9 -2
- package/lib/commonjs/extractors/vidhide.js.map +1 -1
- package/lib/commonjs/models/types.js +1 -0
- package/lib/commonjs/models/types.js.map +1 -1
- package/lib/commonjs/providers/anime/anikoto/create-anikoto.js +11 -4
- package/lib/commonjs/providers/anime/anikoto/create-anikoto.js.map +1 -1
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js +107 -137
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/commonjs/providers/anime/anineko/anineko.js +31 -0
- package/lib/commonjs/providers/anime/anineko/anineko.js.map +1 -0
- package/lib/commonjs/providers/anime/anineko/create-anineko.js +447 -0
- package/lib/commonjs/providers/anime/anineko/create-anineko.js.map +1 -0
- package/lib/commonjs/providers/anime/index.js +9 -1
- package/lib/commonjs/providers/anime/index.js.map +1 -1
- package/lib/commonjs/providers/anime/reanime/create-reanime.js +255 -0
- package/lib/commonjs/providers/anime/reanime/create-reanime.js.map +1 -0
- package/lib/commonjs/providers/anime/reanime/reanime.js +31 -0
- package/lib/commonjs/providers/anime/reanime/reanime.js.map +1 -0
- package/lib/commonjs/providers/movies/vegamovies/create-vegamovies.js +11 -11
- package/lib/commonjs/providers/movies/vegamovies/create-vegamovies.js.map +1 -1
- package/lib/commonjs/utils/ExtractorManager.js +21 -28
- package/lib/commonjs/utils/ExtractorManager.js.map +1 -1
- package/lib/commonjs/utils/ProviderManager.js +31 -34
- package/lib/commonjs/utils/ProviderManager.js.map +1 -1
- package/lib/commonjs/utils/create-extractor-context.js +3 -0
- package/lib/commonjs/utils/create-extractor-context.js.map +1 -1
- package/lib/commonjs/utils/create-provider-context.js +2 -0
- package/lib/commonjs/utils/create-provider-context.js.map +1 -1
- package/lib/commonjs/utils/extension-utils.js +6 -2
- package/lib/commonjs/utils/extension-utils.js.map +1 -1
- package/lib/module/extension-registry.json +106 -29
- package/lib/module/extractors/flixcloud.js +174 -0
- package/lib/module/extractors/flixcloud.js.map +1 -0
- package/lib/module/extractors/index.js +2 -1
- package/lib/module/extractors/index.js.map +1 -1
- package/lib/module/extractors/kwik.js +58 -74
- package/lib/module/extractors/kwik.js.map +1 -1
- package/lib/module/extractors/megaplay.js +196 -123
- package/lib/module/extractors/megaplay.js.map +1 -1
- package/lib/module/extractors/vidhide.js +8 -2
- package/lib/module/extractors/vidhide.js.map +1 -1
- package/lib/module/models/types.js +1 -0
- package/lib/module/models/types.js.map +1 -1
- package/lib/module/providers/anime/anikoto/create-anikoto.js +11 -4
- package/lib/module/providers/anime/anikoto/create-anikoto.js.map +1 -1
- package/lib/module/providers/anime/animepahe/create-animepahe.js +107 -138
- package/lib/module/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/module/providers/anime/anineko/anineko.js +25 -0
- package/lib/module/providers/anime/anineko/anineko.js.map +1 -0
- package/lib/module/providers/anime/anineko/create-anineko.js +443 -0
- package/lib/module/providers/anime/anineko/create-anineko.js.map +1 -0
- package/lib/module/providers/anime/index.js +9 -1
- package/lib/module/providers/anime/index.js.map +1 -1
- package/lib/module/providers/anime/reanime/create-reanime.js +251 -0
- package/lib/module/providers/anime/reanime/create-reanime.js.map +1 -0
- package/lib/module/providers/anime/reanime/reanime.js +25 -0
- package/lib/module/providers/anime/reanime/reanime.js.map +1 -0
- package/lib/module/providers/movies/vegamovies/create-vegamovies.js +11 -11
- package/lib/module/providers/movies/vegamovies/create-vegamovies.js.map +1 -1
- package/lib/module/utils/ExtractorManager.js +21 -28
- package/lib/module/utils/ExtractorManager.js.map +1 -1
- package/lib/module/utils/ProviderManager.js +31 -34
- package/lib/module/utils/ProviderManager.js.map +1 -1
- package/lib/module/utils/create-extractor-context.js +2 -0
- package/lib/module/utils/create-extractor-context.js.map +1 -1
- package/lib/module/utils/create-provider-context.js +2 -0
- package/lib/module/utils/create-provider-context.js.map +1 -1
- package/lib/module/utils/extension-utils.js +7 -3
- package/lib/module/utils/extension-utils.js.map +1 -1
- package/lib/typescript/commonjs/src/extractors/flixcloud.d.ts +18 -0
- package/lib/typescript/commonjs/src/extractors/flixcloud.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/extractors/index.d.ts +2 -1
- package/lib/typescript/commonjs/src/extractors/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/kwik.d.ts +1 -0
- package/lib/typescript/commonjs/src/extractors/kwik.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/megaplay.d.ts +1 -1
- package/lib/typescript/commonjs/src/extractors/megaplay.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/vidhide.d.ts +1 -0
- package/lib/typescript/commonjs/src/extractors/vidhide.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/extension-manifest.d.ts +4 -0
- package/lib/typescript/commonjs/src/models/extension-manifest.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/extractor-context.d.ts +3 -0
- package/lib/typescript/commonjs/src/models/extractor-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/provider-context.d.ts +6 -0
- package/lib/typescript/commonjs/src/models/provider-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/types.d.ts +2 -1
- package/lib/typescript/commonjs/src/models/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/anikoto/create-anikoto.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/anineko/anineko.d.ts +23 -0
- package/lib/typescript/commonjs/src/providers/anime/anineko/anineko.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/anime/anineko/create-anineko.d.ts +52 -0
- package/lib/typescript/commonjs/src/providers/anime/anineko/create-anineko.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/anime/index.d.ts +8 -0
- package/lib/typescript/commonjs/src/providers/anime/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/reanime/create-reanime.d.ts +18 -0
- package/lib/typescript/commonjs/src/providers/anime/reanime/create-reanime.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/anime/reanime/reanime.d.ts +19 -0
- package/lib/typescript/commonjs/src/providers/anime/reanime/reanime.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/ExtractorManager.d.ts +1 -0
- package/lib/typescript/commonjs/src/utils/ExtractorManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts +5 -4
- package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/create-extractor-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/create-provider-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/extension-utils.d.ts +2 -0
- package/lib/typescript/commonjs/src/utils/extension-utils.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/flixcloud.d.ts +18 -0
- package/lib/typescript/module/src/extractors/flixcloud.d.ts.map +1 -0
- package/lib/typescript/module/src/extractors/index.d.ts +2 -1
- package/lib/typescript/module/src/extractors/index.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/kwik.d.ts +1 -0
- package/lib/typescript/module/src/extractors/kwik.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/megaplay.d.ts +1 -1
- package/lib/typescript/module/src/extractors/megaplay.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/vidhide.d.ts +1 -0
- package/lib/typescript/module/src/extractors/vidhide.d.ts.map +1 -1
- package/lib/typescript/module/src/models/extension-manifest.d.ts +4 -0
- package/lib/typescript/module/src/models/extension-manifest.d.ts.map +1 -1
- package/lib/typescript/module/src/models/extractor-context.d.ts +3 -0
- package/lib/typescript/module/src/models/extractor-context.d.ts.map +1 -1
- package/lib/typescript/module/src/models/provider-context.d.ts +6 -0
- package/lib/typescript/module/src/models/provider-context.d.ts.map +1 -1
- package/lib/typescript/module/src/models/types.d.ts +2 -1
- package/lib/typescript/module/src/models/types.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/anikoto/create-anikoto.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/anineko/anineko.d.ts +23 -0
- package/lib/typescript/module/src/providers/anime/anineko/anineko.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/anime/anineko/create-anineko.d.ts +52 -0
- package/lib/typescript/module/src/providers/anime/anineko/create-anineko.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/anime/index.d.ts +8 -0
- package/lib/typescript/module/src/providers/anime/index.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/reanime/create-reanime.d.ts +18 -0
- package/lib/typescript/module/src/providers/anime/reanime/create-reanime.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/anime/reanime/reanime.d.ts +19 -0
- package/lib/typescript/module/src/providers/anime/reanime/reanime.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/ExtractorManager.d.ts +1 -0
- package/lib/typescript/module/src/utils/ExtractorManager.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/ProviderManager.d.ts +5 -4
- package/lib/typescript/module/src/utils/ProviderManager.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/create-extractor-context.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/create-provider-context.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/extension-utils.d.ts +2 -0
- package/lib/typescript/module/src/utils/extension-utils.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/extension-registry.json +106 -29
- package/src/extractors/flixcloud.ts +139 -0
- package/src/extractors/index.ts +2 -0
- package/src/extractors/kwik.ts +74 -93
- package/src/extractors/megaplay.ts +205 -133
- package/src/extractors/vidhide.ts +12 -4
- package/src/models/extension-manifest.ts +5 -0
- package/src/models/extractor-context.ts +3 -0
- package/src/models/provider-context.ts +6 -0
- package/src/models/types.ts +1 -0
- package/src/providers/anime/anikoto/create-anikoto.ts +10 -3
- package/src/providers/anime/animepahe/create-animepahe.ts +118 -158
- package/src/providers/anime/anineko/anineko.ts +44 -0
- package/src/providers/anime/anineko/create-anineko.ts +489 -0
- package/src/providers/anime/index.ts +8 -0
- package/src/providers/anime/reanime/create-reanime.ts +283 -0
- package/src/providers/anime/reanime/reanime.ts +41 -0
- package/src/providers/movies/vegamovies/create-vegamovies.ts +11 -11
- package/src/utils/ExtractorManager.ts +23 -27
- package/src/utils/ProviderManager.ts +33 -33
- package/src/utils/create-extractor-context.ts +2 -0
- package/src/utils/create-provider-context.ts +2 -0
- package/src/utils/extension-utils.ts +5 -0
- package/android/generated/jni/react/renderer/components/RNConsumetSpec/RNConsumetSpecJSI-generated.cpp +0 -75
- package/ios/generated/RNConsumetSpecJSI-generated.cpp +0 -75
- package/ios/generated/RNConsumetSpecJSI.h +0 -125
- /package/ios/generated/{RNConsumetSpec → ReactCodegen/RNConsumetSpec}/RNConsumetSpec-generated.mm +0 -0
- /package/ios/generated/{RNConsumetSpec → ReactCodegen/RNConsumetSpec}/RNConsumetSpec.h +0 -0
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ISearch,
|
|
3
|
+
type IAnimeInfo,
|
|
4
|
+
type IAnimeResult,
|
|
5
|
+
type ISource,
|
|
6
|
+
type IEpisodeServer,
|
|
7
|
+
type StreamingServers,
|
|
8
|
+
type MediaFormat,
|
|
9
|
+
type SubOrDub,
|
|
10
|
+
type ProviderContext,
|
|
11
|
+
type ProviderConfig,
|
|
12
|
+
} from '../../../models';
|
|
13
|
+
|
|
14
|
+
function createAniNeko(ctx: ProviderContext, customBaseURL?: string) {
|
|
15
|
+
const { axios, load, enums, createCustomBaseUrl, USER_AGENT, PolyURL, extractors } = ctx;
|
|
16
|
+
const { VidHide } = extractors;
|
|
17
|
+
const { MediaStatus: MediaStatusEnum, SubOrDub: SubOrDubEnum } = enums;
|
|
18
|
+
|
|
19
|
+
const baseUrl = createCustomBaseUrl('https://anineko.to', customBaseURL);
|
|
20
|
+
|
|
21
|
+
const config: ProviderConfig = {
|
|
22
|
+
name: 'AniNeko',
|
|
23
|
+
languages: 'en',
|
|
24
|
+
classPath: 'ANIME.AniNeko',
|
|
25
|
+
logo: 'https://anineko.to/favicon.ico',
|
|
26
|
+
baseUrl,
|
|
27
|
+
isNSFW: false,
|
|
28
|
+
isWorking: true,
|
|
29
|
+
isDubAvailableSeparately: true,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const UA =
|
|
33
|
+
USER_AGENT ||
|
|
34
|
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36';
|
|
35
|
+
|
|
36
|
+
const hdrs = (referer?: string): Record<string, string> => ({
|
|
37
|
+
'User-Agent': UA,
|
|
38
|
+
'Accept': 'text/html,application/xhtml+xml,*/*;q=0.9',
|
|
39
|
+
'Accept-Language': 'en-US,en;q=0.5',
|
|
40
|
+
'Referer': referer ?? `${baseUrl}/`,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// ── Card scraping ──────────────────────────────────────────────────────────
|
|
44
|
+
|
|
45
|
+
const scrapeCards = (html: string): IAnimeResult[] => {
|
|
46
|
+
const $ = load(html);
|
|
47
|
+
const results: IAnimeResult[] = [];
|
|
48
|
+
|
|
49
|
+
// Cards: article.nv-anime-card (browse page layout from Kotlin extension)
|
|
50
|
+
$('article.nv-anime-card').each((_, el) => {
|
|
51
|
+
const card = $(el);
|
|
52
|
+
const anchor = card.find('a').first();
|
|
53
|
+
const href = anchor.attr('href') ?? '';
|
|
54
|
+
// href = /watch/{slug} → id = {slug}
|
|
55
|
+
const id = href.replace(/^\/watch\//, '').replace(/\/$/, '');
|
|
56
|
+
if (!id) return;
|
|
57
|
+
|
|
58
|
+
const title = card.find('h3.nv-anime-title a').text().trim() || card.find('img').attr('alt')?.trim() || '';
|
|
59
|
+
|
|
60
|
+
const image = card.find('img').attr('src') || card.find('img').attr('data-src') || undefined;
|
|
61
|
+
|
|
62
|
+
// Badge: "TV", "Movie", "OVA" etc.
|
|
63
|
+
const type = card.find('.nv-anime-badge, .badge').first().text().trim() as MediaFormat;
|
|
64
|
+
|
|
65
|
+
results.push({
|
|
66
|
+
id,
|
|
67
|
+
title,
|
|
68
|
+
url: `${baseUrl}/watch/${id}`,
|
|
69
|
+
image,
|
|
70
|
+
type: type || undefined,
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return results;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const parsePagination = (html: string, page: number) => {
|
|
78
|
+
const $ = load(html);
|
|
79
|
+
// Common pagination pattern — adapt selectors if the site uses different markup
|
|
80
|
+
const totalText = $('[class*="result"], [class*="total"]').first().text();
|
|
81
|
+
const totalMatch = totalText.match(/(\d[\d,]*)/);
|
|
82
|
+
const total = totalMatch ? parseInt(totalMatch[1]!.replace(',', ''), 10) : 0;
|
|
83
|
+
|
|
84
|
+
const hasNextPage = $('a[rel="next"], .pagination .next:not(.disabled) a').length > 0;
|
|
85
|
+
|
|
86
|
+
return { total, hasNextPage };
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const fetchBrowsePage = async (
|
|
90
|
+
params: Record<string, string | number>,
|
|
91
|
+
page: number = 1
|
|
92
|
+
): Promise<ISearch<IAnimeResult>> => {
|
|
93
|
+
const qs = new URLSearchParams({
|
|
94
|
+
page: String(page),
|
|
95
|
+
...Object.fromEntries(Object.entries(params).map(([k, v]) => [k, String(v)])),
|
|
96
|
+
});
|
|
97
|
+
const url = `${baseUrl}/browse?${qs}`;
|
|
98
|
+
const { data: html } = await axios.get<string>(url, { headers: hdrs() });
|
|
99
|
+
const { total, hasNextPage } = parsePagination(html, page);
|
|
100
|
+
return {
|
|
101
|
+
currentPage: page,
|
|
102
|
+
hasNextPage,
|
|
103
|
+
totalResults: total,
|
|
104
|
+
results: scrapeCards(html),
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// ── Public browse / search ─────────────────────────────────────────────────
|
|
109
|
+
|
|
110
|
+
// ── Filter constants (from Filters.kt) ────────────────────────────────────
|
|
111
|
+
|
|
112
|
+
/** All valid genre values for genre[] param */
|
|
113
|
+
const GENRES = [
|
|
114
|
+
'Action',
|
|
115
|
+
'Adventure',
|
|
116
|
+
'Cars',
|
|
117
|
+
'Comedy',
|
|
118
|
+
'Dementia',
|
|
119
|
+
'Demons',
|
|
120
|
+
'Drama',
|
|
121
|
+
'Ecchi',
|
|
122
|
+
'Fantasy',
|
|
123
|
+
'Game',
|
|
124
|
+
'Harem',
|
|
125
|
+
'Historical',
|
|
126
|
+
'Horror',
|
|
127
|
+
'Isekai',
|
|
128
|
+
'Josei',
|
|
129
|
+
'Kids',
|
|
130
|
+
'Magic',
|
|
131
|
+
'Mahou Shoujo',
|
|
132
|
+
'Martial Arts',
|
|
133
|
+
'Mecha',
|
|
134
|
+
'Military',
|
|
135
|
+
'Music',
|
|
136
|
+
'Mystery',
|
|
137
|
+
'Parody',
|
|
138
|
+
'Police',
|
|
139
|
+
'Psychological',
|
|
140
|
+
'Romance',
|
|
141
|
+
'Samurai',
|
|
142
|
+
'School',
|
|
143
|
+
'Sci-Fi',
|
|
144
|
+
'Seinen',
|
|
145
|
+
'Shoujo',
|
|
146
|
+
'Shoujo Ai',
|
|
147
|
+
'Shounen',
|
|
148
|
+
'Shounen Ai',
|
|
149
|
+
'Slice of Life',
|
|
150
|
+
'Space',
|
|
151
|
+
'Sports',
|
|
152
|
+
'Super Power',
|
|
153
|
+
'Supernatural',
|
|
154
|
+
'Thriller',
|
|
155
|
+
'Vampire',
|
|
156
|
+
] as const;
|
|
157
|
+
|
|
158
|
+
/** type[] param values: TV=1, Movie=2, OVA=3, ONA=4, Special=5, Music=6, TV_SHORT=7 */
|
|
159
|
+
const TYPES = { TV: '1', Movie: '2', OVA: '3', ONA: '4', Special: '5', Music: '6', TV_SHORT: '7' } as const;
|
|
160
|
+
|
|
161
|
+
/** status[] param values */
|
|
162
|
+
const STATUS = { Ongoing: 'Ongoing', Completed: 'Completed', Upcoming: 'Upcoming' } as const;
|
|
163
|
+
|
|
164
|
+
/** language[] param values (maps to "version") */
|
|
165
|
+
const LANGUAGE = { Subbed: 'Subbed', Dubbed: 'Dubbed' } as const;
|
|
166
|
+
|
|
167
|
+
/** sort param values */
|
|
168
|
+
const SORT = {
|
|
169
|
+
LatestUpdate: 'recently_updated',
|
|
170
|
+
ReleaseDate: 'release_date',
|
|
171
|
+
RecentlyAdded: 'recently_added',
|
|
172
|
+
TitleAZ: 'title_az',
|
|
173
|
+
} as const;
|
|
174
|
+
|
|
175
|
+
const search = async (query: string, page: number = 1): Promise<ISearch<IAnimeResult>> => {
|
|
176
|
+
return fetchBrowsePage({ keyword: query, sort: SORT.LatestUpdate }, page);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const fetchRecentlyUpdated = async (page: number = 1): Promise<ISearch<IAnimeResult>> => {
|
|
180
|
+
return fetchBrowsePage({ sort: SORT.LatestUpdate }, page);
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const fetchNewReleases = async (page: number = 1): Promise<ISearch<IAnimeResult>> => {
|
|
184
|
+
return fetchBrowsePage({ sort: SORT.ReleaseDate }, page);
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const fetchRecentlyAdded = async (page: number = 1): Promise<ISearch<IAnimeResult>> => {
|
|
188
|
+
return fetchBrowsePage({ sort: SORT.RecentlyAdded }, page);
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Browse by genre — genre must be one of the GENRES constants.
|
|
193
|
+
* Additional filters (type, status, language, year) can be passed as extra params.
|
|
194
|
+
*/
|
|
195
|
+
const genreSearch = async (
|
|
196
|
+
genre: string,
|
|
197
|
+
page: number = 1,
|
|
198
|
+
extra?: { type?: string; status?: string; language?: string; year?: string | number }
|
|
199
|
+
): Promise<ISearch<IAnimeResult>> => {
|
|
200
|
+
const params = new URLSearchParams({
|
|
201
|
+
page: String(page),
|
|
202
|
+
sort: SORT.LatestUpdate,
|
|
203
|
+
});
|
|
204
|
+
params.append('genre[]', genre);
|
|
205
|
+
if (extra?.type) params.append('type[]', extra.type);
|
|
206
|
+
if (extra?.status) params.append('status[]', extra.status);
|
|
207
|
+
if (extra?.language) params.append('language[]', extra.language);
|
|
208
|
+
if (extra?.year) params.append('year[]', String(extra.year));
|
|
209
|
+
|
|
210
|
+
const url = `${baseUrl}/browse?${params}`;
|
|
211
|
+
const { data: html } = await axios.get<string>(url, { headers: hdrs() });
|
|
212
|
+
const { total, hasNextPage } = parsePagination(html, page);
|
|
213
|
+
return {
|
|
214
|
+
currentPage: page,
|
|
215
|
+
hasNextPage,
|
|
216
|
+
totalResults: total,
|
|
217
|
+
results: scrapeCards(html),
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
// ── Anime info ─────────────────────────────────────────────────────────────
|
|
222
|
+
|
|
223
|
+
const fetchAnimeInfo = async (id: string): Promise<IAnimeInfo> => {
|
|
224
|
+
const { data: html } = await axios.get<string>(`${baseUrl}/watch/${id}`, { headers: hdrs() });
|
|
225
|
+
const $ = load(html);
|
|
226
|
+
|
|
227
|
+
const info: IAnimeInfo = { id, title: '' };
|
|
228
|
+
|
|
229
|
+
// Title — h1 or h2 on the info page
|
|
230
|
+
info.title =
|
|
231
|
+
$('h1.nv-anime-title, h1.anime-title, h1').first().text().trim() ||
|
|
232
|
+
$('meta[property="og:title"]').attr('content')?.trim() ||
|
|
233
|
+
'';
|
|
234
|
+
|
|
235
|
+
info.url = `${baseUrl}/watch/${id}`;
|
|
236
|
+
info.image =
|
|
237
|
+
$('meta[property="og:image"]').attr('content') ||
|
|
238
|
+
$('img.nv-anime-poster, .poster img, img.cover').first().attr('src') ||
|
|
239
|
+
undefined;
|
|
240
|
+
|
|
241
|
+
info.description =
|
|
242
|
+
$('meta[property="og:description"]').attr('content')?.trim() ||
|
|
243
|
+
$('[class*="desc"], [class*="synopsis"], [class*="summary"]').first().text().trim() ||
|
|
244
|
+
undefined;
|
|
245
|
+
|
|
246
|
+
// Meta fields — try common selector patterns
|
|
247
|
+
const metaText = (label: string) =>
|
|
248
|
+
$(`[class*="info"] *:contains("${label}")`)
|
|
249
|
+
.filter((_, el) => $(el).text().trim().startsWith(label))
|
|
250
|
+
.first()
|
|
251
|
+
.next()
|
|
252
|
+
.text()
|
|
253
|
+
.trim() || $(`[class*="info"] *:contains("${label}")`).first().text().replace(label, '').trim();
|
|
254
|
+
|
|
255
|
+
const statusRaw = metaText('Status');
|
|
256
|
+
switch (statusRaw.toLowerCase()) {
|
|
257
|
+
case 'currently airing':
|
|
258
|
+
case 'ongoing':
|
|
259
|
+
case 'releasing':
|
|
260
|
+
info.status = MediaStatusEnum.ONGOING;
|
|
261
|
+
break;
|
|
262
|
+
case 'finished airing':
|
|
263
|
+
case 'completed':
|
|
264
|
+
info.status = MediaStatusEnum.COMPLETED;
|
|
265
|
+
break;
|
|
266
|
+
case 'not yet aired':
|
|
267
|
+
info.status = MediaStatusEnum.NOT_YET_AIRED;
|
|
268
|
+
break;
|
|
269
|
+
default:
|
|
270
|
+
info.status = MediaStatusEnum.UNKNOWN;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
info.type = (metaText('Type').toUpperCase() as MediaFormat) || undefined;
|
|
274
|
+
info.releaseDate = metaText('Aired') || metaText('Release') || undefined;
|
|
275
|
+
|
|
276
|
+
// Genres — links inside genre section
|
|
277
|
+
info.genres = [];
|
|
278
|
+
$('a[href*="/browse"][href*="genre"]').each((_, el) => {
|
|
279
|
+
const g = $(el).text().trim();
|
|
280
|
+
if (g) info.genres?.push(g);
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
// SUB / DUB / HSUB detection from episode badges
|
|
284
|
+
let hasSub = false;
|
|
285
|
+
let hasDub = false;
|
|
286
|
+
$('article.nv-info-episode-item, .episode-item').each((_, el) => {
|
|
287
|
+
const badges = $(el).text().toLowerCase();
|
|
288
|
+
if (badges.includes('sub') || badges.includes('hsub')) hasSub = true;
|
|
289
|
+
if (badges.includes('dub')) hasDub = true;
|
|
290
|
+
});
|
|
291
|
+
info.hasSub = hasSub;
|
|
292
|
+
info.hasDub = hasDub;
|
|
293
|
+
|
|
294
|
+
// Episodes
|
|
295
|
+
info.episodes = [];
|
|
296
|
+
$('div.nv-info-episode-grid article.nv-info-episode-item, .episode-item').each((_, el) => {
|
|
297
|
+
const item = $(el);
|
|
298
|
+
|
|
299
|
+
// Links: watch href = /watch/{slug}/ep-{n}, download href = /download/{slug}/ep-{n}
|
|
300
|
+
const watchHref = item.find('a[href*="/watch/"]').attr('href') || item.find('a').first().attr('href') || '';
|
|
301
|
+
|
|
302
|
+
if (!watchHref) return;
|
|
303
|
+
|
|
304
|
+
// Extract episode number from the URL /watch/one-piece/ep-1 → 1
|
|
305
|
+
const epNumMatch = watchHref.match(/\/ep-(\d+(?:\.\d+)?)/);
|
|
306
|
+
const number = epNumMatch ? parseFloat(epNumMatch[1]!) : 0;
|
|
307
|
+
|
|
308
|
+
// ID = `{slug}/ep-{number}` — strip leading /watch/
|
|
309
|
+
const epId = watchHref.replace(/^\/watch\//, '');
|
|
310
|
+
|
|
311
|
+
const badgeText = item.text().toLowerCase();
|
|
312
|
+
const isSubbed = badgeText.includes('sub') || badgeText.includes('hsub');
|
|
313
|
+
const isDubbed = badgeText.includes('dub');
|
|
314
|
+
|
|
315
|
+
const titleEl = item.find('[class*="title"], span').first();
|
|
316
|
+
const title = titleEl.text().trim() || `Episode ${number}`;
|
|
317
|
+
|
|
318
|
+
info.episodes?.push({
|
|
319
|
+
id: epId,
|
|
320
|
+
number,
|
|
321
|
+
title,
|
|
322
|
+
isSubbed,
|
|
323
|
+
isDubbed,
|
|
324
|
+
url: `${baseUrl}${watchHref}`,
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
info.totalEpisodes = info.episodes.length;
|
|
329
|
+
|
|
330
|
+
return info;
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
// ── Servers ────────────────────────────────────────────────────────────────
|
|
334
|
+
|
|
335
|
+
const fetchEpisodeServers = async (
|
|
336
|
+
episodeId: string,
|
|
337
|
+
subOrDub: SubOrDub = SubOrDubEnum.SUB
|
|
338
|
+
): Promise<IEpisodeServer[]> => {
|
|
339
|
+
// episodeId = "{slug}/ep-{n}" or a full URL (passthrough)
|
|
340
|
+
const url = episodeId.startsWith('http') ? episodeId : `${baseUrl}/watch/${episodeId}`;
|
|
341
|
+
const { data: html } = await axios.get<string>(url, { headers: hdrs(`${baseUrl}/`) });
|
|
342
|
+
const $ = load(html);
|
|
343
|
+
|
|
344
|
+
const servers: IEpisodeServer[] = [];
|
|
345
|
+
const seen = new Set<string>();
|
|
346
|
+
|
|
347
|
+
// Actual DOM structure:
|
|
348
|
+
// <div class="nv-server-grid lang-group" data-id="hsub|sub|dub">
|
|
349
|
+
// <button class="nv-server-btn server-video server" data-video="<url>" data-tab="hsub|sub|dub">
|
|
350
|
+
// HD-2 <span>Hard Sub</span>
|
|
351
|
+
// </button>
|
|
352
|
+
// </div>
|
|
353
|
+
//
|
|
354
|
+
// SUB → include panels: hsub (Hard Sub) + sub (Soft Sub)
|
|
355
|
+
// DUB → include only panel: dub
|
|
356
|
+
const panelIds = subOrDub === SubOrDubEnum.DUB ? ['dub'] : ['hsub', 'sub'];
|
|
357
|
+
|
|
358
|
+
for (const panelId of panelIds) {
|
|
359
|
+
$(`div.lang-group[data-id="${panelId}"] button.server-video[data-video]`).each((_, btn) => {
|
|
360
|
+
const embedUrl = $(btn).attr('data-video')?.trim();
|
|
361
|
+
if (!embedUrl) return;
|
|
362
|
+
|
|
363
|
+
// Server name: button text excluding child <span>
|
|
364
|
+
const serverName = $(btn)
|
|
365
|
+
.clone()
|
|
366
|
+
.children('span')
|
|
367
|
+
.remove()
|
|
368
|
+
.end()
|
|
369
|
+
.text()
|
|
370
|
+
.trim()
|
|
371
|
+
.toLowerCase()
|
|
372
|
+
.replace(/\s+/g, '-');
|
|
373
|
+
|
|
374
|
+
// Sub-type: from <span> inside button
|
|
375
|
+
const spanText = $(btn).find('span').text().trim().toLowerCase();
|
|
376
|
+
const subType = spanText.includes('hard') ? 'hardsub' : spanText.includes('dub') ? 'dub' : 'softsub';
|
|
377
|
+
|
|
378
|
+
const name = `${serverName}-${subType}`;
|
|
379
|
+
if (seen.has(name)) return;
|
|
380
|
+
seen.add(name);
|
|
381
|
+
|
|
382
|
+
servers.push({ name, url: embedUrl });
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
return servers;
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
// ── Sources ────────────────────────────────────────────────────────────────
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Pick the right extractor based on the embed URL domain.
|
|
393
|
+
*
|
|
394
|
+
* Known mappings (from Kotlin extension):
|
|
395
|
+
* vivibebe.site / vibevibe.workers.dev / bibiemb.xyz → inline M3U8 regex
|
|
396
|
+
* otakuhg.site / otakuvid.online → VidHide
|
|
397
|
+
* playmogo.com / dood.* → StreamTape (closest available)
|
|
398
|
+
* fallback → VidHide
|
|
399
|
+
*/
|
|
400
|
+
const extractFromUrl = async (embedUrl: string, pageUrl: string): Promise<ISource> => {
|
|
401
|
+
const domain = new PolyURL(embedUrl).hostname.toLowerCase();
|
|
402
|
+
|
|
403
|
+
// Vivibebe / vibevibe / bibiemb — direct M3U8 via regex
|
|
404
|
+
if (domain.includes('vivibebe') || domain.includes('vibevibe') || domain.includes('bibiemb')) {
|
|
405
|
+
const { data: pageHtml } = await axios.get<string>(embedUrl, {
|
|
406
|
+
headers: { 'User-Agent': UA, 'Referer': pageUrl },
|
|
407
|
+
});
|
|
408
|
+
const m3u8Match = pageHtml.match(/const\s+src\s*=\s*"([^"]+\.m3u8[^"]*)"/);
|
|
409
|
+
if (!m3u8Match?.[1]) throw new Error(`[AniNeko] Could not find M3U8 in ${domain}`);
|
|
410
|
+
// Extract subtitles from URL params (sub, caption_1, c1_file, sub_1)
|
|
411
|
+
const subUrl =
|
|
412
|
+
new PolyURL(embedUrl).searchParams.get('sub') ||
|
|
413
|
+
new PolyURL(embedUrl).searchParams.get('caption_1') ||
|
|
414
|
+
new PolyURL(embedUrl).searchParams.get('c1_file') ||
|
|
415
|
+
null;
|
|
416
|
+
const subLabel =
|
|
417
|
+
new PolyURL(embedUrl).searchParams.get('c1_label') ||
|
|
418
|
+
new PolyURL(embedUrl).searchParams.get('sub_1') ||
|
|
419
|
+
'English';
|
|
420
|
+
return {
|
|
421
|
+
sources: [{ url: m3u8Match[1], isM3U8: true, quality: 'auto' }],
|
|
422
|
+
subtitles: subUrl ? [{ url: subUrl, lang: subLabel }] : [],
|
|
423
|
+
headers: { Referer: `https://${domain}/` },
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// Doodstream / playmogo — extract direct mp4 link via regex (no context extractor available)
|
|
428
|
+
if (domain.includes('dood') || domain.includes('playmogo')) {
|
|
429
|
+
const { data: doodHtml } = await axios.get<string>(embedUrl, {
|
|
430
|
+
headers: { 'User-Agent': UA, 'Referer': pageUrl },
|
|
431
|
+
});
|
|
432
|
+
const mp4 =
|
|
433
|
+
doodHtml.match(/source\s+src="([^"]+\.mp4[^"]*)"/)?.[1] || doodHtml.match(/file:\s*["']([^"']+)["']/)?.[1];
|
|
434
|
+
if (!mp4) throw new Error(`[AniNeko] Could not extract source from ${domain}`);
|
|
435
|
+
return { sources: [{ url: mp4, isM3U8: false, quality: 'auto' }], subtitles: [] };
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// OtakuHG / OtakuVid / default — VidHide
|
|
439
|
+
return VidHide(ctx).extract(new PolyURL(embedUrl), pageUrl);
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
const fetchEpisodeSources = async (
|
|
443
|
+
episodeId: string,
|
|
444
|
+
server: StreamingServers,
|
|
445
|
+
subOrDub: SubOrDub = SubOrDubEnum.SUB
|
|
446
|
+
): Promise<ISource> => {
|
|
447
|
+
// Direct embed URL passthrough
|
|
448
|
+
if (episodeId.startsWith('http')) {
|
|
449
|
+
return extractFromUrl(episodeId, baseUrl);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
const watchUrl = `${baseUrl}/watch/${episodeId}`;
|
|
453
|
+
const servers = await fetchEpisodeServers(episodeId, subOrDub);
|
|
454
|
+
|
|
455
|
+
if (servers.length === 0) {
|
|
456
|
+
throw new Error(`[AniNeko] No servers found for episode ${episodeId}`);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// Server selection: match by server enum value (e.g. 'vidhide' matches 'hd-1-hardsub' via host name)
|
|
460
|
+
// Prefer server param match, fall back to first available
|
|
461
|
+
const serverLower = server?.toLowerCase() ?? '';
|
|
462
|
+
const picked = servers.find((s) => s.name.includes(serverLower)) ?? servers[0]!;
|
|
463
|
+
|
|
464
|
+
if (!picked.url) throw new Error(`[AniNeko] No embed URL for server "${picked.name}"`);
|
|
465
|
+
return extractFromUrl(picked.url, watchUrl);
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
return {
|
|
469
|
+
...config,
|
|
470
|
+
// filter constants — consumers can use these for UI filter pickers
|
|
471
|
+
GENRES,
|
|
472
|
+
TYPES,
|
|
473
|
+
STATUS,
|
|
474
|
+
LANGUAGE,
|
|
475
|
+
SORT,
|
|
476
|
+
// methods
|
|
477
|
+
search,
|
|
478
|
+
fetchRecentlyUpdated,
|
|
479
|
+
fetchNewReleases,
|
|
480
|
+
fetchRecentlyAdded,
|
|
481
|
+
genreSearch,
|
|
482
|
+
fetchAnimeInfo,
|
|
483
|
+
fetchEpisodeServers,
|
|
484
|
+
fetchEpisodeSources,
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export type AniNekoProviderInstance = ReturnType<typeof createAniNeko>;
|
|
489
|
+
export default createAniNeko;
|
|
@@ -10,6 +10,10 @@ import AnimeKai from './animekai/animekai';
|
|
|
10
10
|
import createAnimeKai from './animekai/create-animekai';
|
|
11
11
|
import AniKoto from './anikoto/anikoto';
|
|
12
12
|
import createAniKoto from './anikoto/create-anikoto';
|
|
13
|
+
import ReAnime from './reanime/reanime';
|
|
14
|
+
import createReanime from './reanime/create-reanime';
|
|
15
|
+
import AniNeko from './anineko/anineko';
|
|
16
|
+
import createAniNeko from './anineko/create-anineko';
|
|
13
17
|
|
|
14
18
|
export default {
|
|
15
19
|
AnimePahe,
|
|
@@ -24,4 +28,8 @@ export default {
|
|
|
24
28
|
createAnimeKai,
|
|
25
29
|
AniKoto,
|
|
26
30
|
createAniKoto,
|
|
31
|
+
ReAnime,
|
|
32
|
+
createReanime,
|
|
33
|
+
AniNeko,
|
|
34
|
+
createAniNeko,
|
|
27
35
|
};
|