react-native-consumet 2.0.0 → 3.0.1
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/android/src/main/java/com/consumet/HttpRequestModule.kt +88 -33
- package/android/src/main/java/com/consumet/WebViewTask.kt +18 -3
- package/ios/Consumet.mm +172 -72
- package/lib/commonjs/NativeConsumet.ts +11 -5
- package/lib/commonjs/extension-registry.json +6 -6
- package/lib/commonjs/extension-registry.json.sig +1 -1
- package/lib/commonjs/extractors/kwik.js +28 -29
- package/lib/commonjs/extractors/kwik.js.map +1 -1
- package/lib/commonjs/index.js +18 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/types.js +6 -0
- package/lib/commonjs/models/types.js.map +1 -1
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js +12 -13
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/commonjs/providers/manga/asurascans.js +160 -96
- package/lib/commonjs/providers/manga/asurascans.js.map +1 -1
- package/lib/commonjs/providers/manga/flamescans.js +173 -91
- package/lib/commonjs/providers/manga/flamescans.js.map +1 -1
- package/lib/commonjs/providers/manga/index.js +1 -15
- package/lib/commonjs/providers/manga/index.js.map +1 -1
- package/lib/commonjs/providers/manga/mangadex.js +234 -227
- package/lib/commonjs/providers/manga/mangadex.js.map +1 -1
- package/lib/commonjs/providers/manga/mangahere.js +279 -135
- package/lib/commonjs/providers/manga/mangahere.js.map +1 -1
- package/lib/commonjs/providers/manga/mangakakalot.js +206 -107
- package/lib/commonjs/providers/manga/mangakakalot.js.map +1 -1
- package/lib/commonjs/providers/manga/mangapill.js +126 -38
- package/lib/commonjs/providers/manga/mangapill.js.map +1 -1
- package/lib/commonjs/providers/meta/anilist.js +41 -12
- package/lib/commonjs/providers/meta/anilist.js.map +1 -1
- package/lib/commonjs/utils/index.js +19 -0
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/manga.js +60 -0
- package/lib/commonjs/utils/manga.js.map +1 -0
- package/lib/module/NativeConsumet.ts +11 -5
- package/lib/module/extension-registry.json +6 -6
- package/lib/module/extension-registry.json.sig +1 -1
- package/lib/module/extractors/kwik.js +28 -29
- package/lib/module/extractors/kwik.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/types.js +9 -0
- package/lib/module/models/types.js.map +1 -1
- package/lib/module/providers/anime/animepahe/create-animepahe.js +12 -13
- package/lib/module/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/module/providers/manga/asurascans.js +161 -96
- package/lib/module/providers/manga/asurascans.js.map +1 -1
- package/lib/module/providers/manga/flamescans.js +174 -91
- package/lib/module/providers/manga/flamescans.js.map +1 -1
- package/lib/module/providers/manga/index.js +1 -15
- package/lib/module/providers/manga/index.js.map +1 -1
- package/lib/module/providers/manga/mangadex.js +236 -228
- package/lib/module/providers/manga/mangadex.js.map +1 -1
- package/lib/module/providers/manga/mangahere.js +276 -132
- package/lib/module/providers/manga/mangahere.js.map +1 -1
- package/lib/module/providers/manga/mangakakalot.js +207 -107
- package/lib/module/providers/manga/mangakakalot.js.map +1 -1
- package/lib/module/providers/manga/mangapill.js +128 -39
- package/lib/module/providers/manga/mangapill.js.map +1 -1
- package/lib/module/providers/meta/anilist.js +41 -12
- package/lib/module/providers/meta/anilist.js.map +1 -1
- package/lib/module/utils/index.js +1 -0
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/manga.js +54 -0
- package/lib/module/utils/manga.js.map +1 -0
- package/lib/typescript/commonjs/src/NativeConsumet.d.ts +11 -5
- package/lib/typescript/commonjs/src/NativeConsumet.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/kwik.d.ts +1 -1
- package/lib/typescript/commonjs/src/extractors/kwik.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +2 -2
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/types.d.ts +38 -5
- 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/manga/asurascans.d.ts +14 -4
- package/lib/typescript/commonjs/src/providers/manga/asurascans.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/manga/flamescans.d.ts +18 -3
- package/lib/typescript/commonjs/src/providers/manga/flamescans.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/manga/index.d.ts +0 -14
- package/lib/typescript/commonjs/src/providers/manga/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/manga/mangadex.d.ts +22 -5
- package/lib/typescript/commonjs/src/providers/manga/mangadex.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/manga/mangahere.d.ts +15 -3
- package/lib/typescript/commonjs/src/providers/manga/mangahere.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/manga/mangakakalot.d.ts +26 -4
- package/lib/typescript/commonjs/src/providers/manga/mangakakalot.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/manga/mangapill.d.ts +16 -2
- package/lib/typescript/commonjs/src/providers/manga/mangapill.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/meta/anilist.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/manga.d.ts +19 -0
- package/lib/typescript/commonjs/src/utils/manga.d.ts.map +1 -0
- package/lib/typescript/module/src/NativeConsumet.d.ts +11 -5
- package/lib/typescript/module/src/NativeConsumet.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/kwik.d.ts +1 -1
- package/lib/typescript/module/src/extractors/kwik.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +2 -2
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/models/types.d.ts +38 -5
- 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/manga/asurascans.d.ts +14 -4
- package/lib/typescript/module/src/providers/manga/asurascans.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/manga/flamescans.d.ts +18 -3
- package/lib/typescript/module/src/providers/manga/flamescans.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/manga/index.d.ts +0 -14
- package/lib/typescript/module/src/providers/manga/index.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/manga/mangadex.d.ts +22 -5
- package/lib/typescript/module/src/providers/manga/mangadex.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/manga/mangahere.d.ts +15 -3
- package/lib/typescript/module/src/providers/manga/mangahere.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/manga/mangakakalot.d.ts +26 -4
- package/lib/typescript/module/src/providers/manga/mangakakalot.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/manga/mangapill.d.ts +16 -2
- package/lib/typescript/module/src/providers/manga/mangapill.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/meta/anilist.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/index.d.ts +1 -0
- package/lib/typescript/module/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/manga.d.ts +19 -0
- package/lib/typescript/module/src/utils/manga.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/NativeConsumet.ts +11 -5
- package/src/extension-registry.json +6 -6
- package/src/extension-registry.json.sig +1 -1
- package/src/extractors/kwik.ts +30 -43
- package/src/index.tsx +6 -0
- package/src/models/types.ts +38 -3
- package/src/providers/anime/animepahe/create-animepahe.ts +15 -14
- package/src/providers/manga/asurascans.ts +200 -135
- package/src/providers/manga/flamescans.ts +221 -118
- package/src/providers/manga/index.ts +0 -14
- package/src/providers/manga/mangadex.ts +335 -282
- package/src/providers/manga/mangahere.ts +309 -156
- package/src/providers/manga/mangakakalot.ts +249 -152
- package/src/providers/manga/mangapill.ts +163 -64
- package/src/providers/meta/anilist.ts +50 -14
- package/src/utils/index.ts +1 -0
- package/src/utils/manga.ts +58 -0
- package/lib/commonjs/providers/manga/brmangas.js +0 -110
- package/lib/commonjs/providers/manga/brmangas.js.map +0 -1
- package/lib/commonjs/providers/manga/comick.js +0 -154
- package/lib/commonjs/providers/manga/comick.js.map +0 -1
- package/lib/commonjs/providers/manga/mangahost.js +0 -113
- package/lib/commonjs/providers/manga/mangahost.js.map +0 -1
- package/lib/commonjs/providers/manga/mangapark.js +0 -97
- package/lib/commonjs/providers/manga/mangapark.js.map +0 -1
- package/lib/commonjs/providers/manga/mangareader.js +0 -106
- package/lib/commonjs/providers/manga/mangareader.js.map +0 -1
- package/lib/commonjs/providers/manga/mangasee123.js +0 -161
- package/lib/commonjs/providers/manga/mangasee123.js.map +0 -1
- package/lib/commonjs/providers/manga/readmanga.js +0 -269
- package/lib/commonjs/providers/manga/readmanga.js.map +0 -1
- package/lib/commonjs/providers/manga/vyvymanga.js +0 -166
- package/lib/commonjs/providers/manga/vyvymanga.js.map +0 -1
- package/lib/module/providers/manga/brmangas.js +0 -105
- package/lib/module/providers/manga/brmangas.js.map +0 -1
- package/lib/module/providers/manga/comick.js +0 -149
- package/lib/module/providers/manga/comick.js.map +0 -1
- package/lib/module/providers/manga/mangahost.js +0 -108
- package/lib/module/providers/manga/mangahost.js.map +0 -1
- package/lib/module/providers/manga/mangapark.js +0 -92
- package/lib/module/providers/manga/mangapark.js.map +0 -1
- package/lib/module/providers/manga/mangareader.js +0 -101
- package/lib/module/providers/manga/mangareader.js.map +0 -1
- package/lib/module/providers/manga/mangasee123.js +0 -156
- package/lib/module/providers/manga/mangasee123.js.map +0 -1
- package/lib/module/providers/manga/readmanga.js +0 -264
- package/lib/module/providers/manga/readmanga.js.map +0 -1
- package/lib/module/providers/manga/vyvymanga.js +0 -161
- package/lib/module/providers/manga/vyvymanga.js.map +0 -1
- package/lib/typescript/commonjs/src/providers/manga/brmangas.d.ts +0 -18
- package/lib/typescript/commonjs/src/providers/manga/brmangas.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/manga/comick.d.ts +0 -39
- package/lib/typescript/commonjs/src/providers/manga/comick.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/manga/mangahost.d.ts +0 -18
- package/lib/typescript/commonjs/src/providers/manga/mangahost.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/manga/mangapark.d.ts +0 -14
- package/lib/typescript/commonjs/src/providers/manga/mangapark.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/manga/mangareader.d.ts +0 -18
- package/lib/typescript/commonjs/src/providers/manga/mangareader.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/manga/mangasee123.d.ts +0 -17
- package/lib/typescript/commonjs/src/providers/manga/mangasee123.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/manga/readmanga.d.ts +0 -31
- package/lib/typescript/commonjs/src/providers/manga/readmanga.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/manga/vyvymanga.d.ts +0 -17
- package/lib/typescript/commonjs/src/providers/manga/vyvymanga.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/manga/brmangas.d.ts +0 -18
- package/lib/typescript/module/src/providers/manga/brmangas.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/manga/comick.d.ts +0 -39
- package/lib/typescript/module/src/providers/manga/comick.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/manga/mangahost.d.ts +0 -18
- package/lib/typescript/module/src/providers/manga/mangahost.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/manga/mangapark.d.ts +0 -14
- package/lib/typescript/module/src/providers/manga/mangapark.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/manga/mangareader.d.ts +0 -18
- package/lib/typescript/module/src/providers/manga/mangareader.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/manga/mangasee123.d.ts +0 -17
- package/lib/typescript/module/src/providers/manga/mangasee123.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/manga/readmanga.d.ts +0 -31
- package/lib/typescript/module/src/providers/manga/readmanga.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/manga/vyvymanga.d.ts +0 -17
- package/lib/typescript/module/src/providers/manga/vyvymanga.d.ts.map +0 -1
- package/src/providers/manga/brmangas.ts +0 -148
- package/src/providers/manga/comick.ts +0 -285
- package/src/providers/manga/mangahost.ts +0 -134
- package/src/providers/manga/mangapark.ts +0 -115
- package/src/providers/manga/mangareader.ts +0 -132
- package/src/providers/manga/mangasee123.ts +0 -187
- package/src/providers/manga/readmanga.ts +0 -380
- package/src/providers/manga/vyvymanga.ts +0 -237
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"name": "Kwik",
|
|
18
|
-
"version": "1.2.
|
|
18
|
+
"version": "1.2.5",
|
|
19
19
|
"minContextVersion": 1,
|
|
20
|
-
"main": "https://raw.githubusercontent.com/uwumilabs/react-native-consumet/refs/heads/main/registry/extractors/kwik/1.2.
|
|
21
|
-
"sha256": "
|
|
20
|
+
"main": "https://raw.githubusercontent.com/uwumilabs/react-native-consumet/refs/heads/main/registry/extractors/kwik/1.2.5.js",
|
|
21
|
+
"sha256": "d4b4992d35d6e8f5e00143deaf61e0c54c5bd1f402a64f376e8550dd77dbb68a",
|
|
22
22
|
"distFile": "dist/bundles/extractors/kwik.js"
|
|
23
23
|
},
|
|
24
24
|
{
|
|
@@ -75,14 +75,14 @@
|
|
|
75
75
|
"id": "animepahe",
|
|
76
76
|
"name": "AnimePahe",
|
|
77
77
|
"description": "High-quality anime streaming from AnimePahe with multiple servers and subtitles",
|
|
78
|
-
"version": "1.2.
|
|
78
|
+
"version": "1.2.7",
|
|
79
79
|
"minContextVersion": 1,
|
|
80
80
|
"author": {
|
|
81
81
|
"name": "RNConsumet Team",
|
|
82
82
|
"url": "https://github.com/uwumilabs"
|
|
83
83
|
},
|
|
84
84
|
"category": "anime",
|
|
85
|
-
"main": "https://raw.githubusercontent.com/uwumilabs/react-native-consumet/refs/heads/main/registry/extensions/animepahe/1.2.
|
|
85
|
+
"main": "https://raw.githubusercontent.com/uwumilabs/react-native-consumet/refs/heads/main/registry/extensions/animepahe/1.2.7.js",
|
|
86
86
|
"factoryName": "createAnimePahe",
|
|
87
87
|
"baseUrl": "https://animepahe.pw",
|
|
88
88
|
"logo": "https://animepahe.pw/web-app-manifest-512x512.png",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"dubbed": true,
|
|
101
101
|
"isSourceEmbed": true,
|
|
102
102
|
"haveMultiServers": false,
|
|
103
|
-
"sha256": "
|
|
103
|
+
"sha256": "63b4fbf8c7333984e518545171571d43cd983479c9b1f14b9c194beec5966811",
|
|
104
104
|
"distFile": "dist/bundles/providers/anime/animepahe/create-animepahe.js"
|
|
105
105
|
},
|
|
106
106
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
fa54678c129da118d355e4e5c0d0077224807ca6deb394e653ddc067c65958d371b89425d58e09836631c4b1c2ca19ef1520b73ca9dc9170598c56b9b3c56b0e
|
package/src/extractors/kwik.ts
CHANGED
|
@@ -3,26 +3,22 @@ import type { PolyURL } from '../utils/url-polyfill';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Kwik extractor function
|
|
6
|
-
* @param ctx ExtractorContext
|
|
6
|
+
* @param ctx ExtractorContext; the embed page is loaded through its NativeConsumet WebView
|
|
7
7
|
* @returns Object with extract method implementing IVideoExtractor interface
|
|
8
8
|
*/
|
|
9
9
|
export function Kwik(ctx: ExtractorContext): IVideoExtractor {
|
|
10
10
|
const serverName = 'kwik';
|
|
11
11
|
const sources: IVideo[] = [];
|
|
12
|
-
const {
|
|
12
|
+
const { NativeConsumet } = ctx;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
'
|
|
14
|
+
// One eval(function(p,a,c,k,e,d){...}('payload',base,count,'words'.split('|'))) block.
|
|
15
|
+
const PACKED =
|
|
16
|
+
/\beval\s*\(\s*function\s*\(\s*p\s*,\s*a\s*,\s*c\s*,\s*k\s*,\s*e\s*,\s*[dr]\s*\)\s*\{[\s\S]+?\}\s*\(\s*'([\s\S]+?)'\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*'([\s\S]+?)'\s*\.split\s*\(\s*'(.+?)'\s*\)/;
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const m = packed.match(re);
|
|
23
|
-
if (!m) return null;
|
|
24
|
-
|
|
25
|
-
const encoded = m[1]!;
|
|
18
|
+
/** The code of one packed block. */
|
|
19
|
+
function unpackPacked(m: RegExpMatchArray): string {
|
|
20
|
+
// The payload is the source of a single-quoted string: undo its escapes (\' and \\).
|
|
21
|
+
const encoded = m[1]!.replace(/\\(['"\\])/g, '$1');
|
|
26
22
|
const base = parseInt(m[2]!, 10);
|
|
27
23
|
const count = parseInt(m[3]!, 10);
|
|
28
24
|
const words = m[4]!.split(m[5]!);
|
|
@@ -42,46 +38,37 @@ export function Kwik(ctx: ExtractorContext): IVideoExtractor {
|
|
|
42
38
|
return result;
|
|
43
39
|
}
|
|
44
40
|
|
|
41
|
+
/** The stream URL in a Kwik embed page; the page packs several scripts, only one has it. */
|
|
42
|
+
function findSource(html: string): string | null {
|
|
43
|
+
const packed = new RegExp(PACKED.source, 'g');
|
|
44
|
+
let block: RegExpExecArray | null;
|
|
45
|
+
while ((block = packed.exec(html))) {
|
|
46
|
+
const code = unpackPacked(block);
|
|
47
|
+
const source =
|
|
48
|
+
code.match(/const\s+source\s*=\s*'([^']+)'/) ||
|
|
49
|
+
code.match(/const\s+source\s*=\s*"([^"]+)"/) ||
|
|
50
|
+
code.match(/['"](https?:\/\/[^'"]+\.m3u8[^'"]*)['"]/);
|
|
51
|
+
if (source?.[1]) return source[1];
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
45
56
|
// @ts-ignore
|
|
46
57
|
const extract = async (videoUrl: PolyURL, referer = 'https://animepahe.ru/'): Promise<ISource> => {
|
|
47
58
|
const kwikUrl = typeof videoUrl === 'string' ? videoUrl : (videoUrl as any).href;
|
|
48
59
|
const kwikHost = kwikUrl.match(/^https?:\/\/([^/]+)/)?.[1] ?? 'kwik.cx';
|
|
49
60
|
|
|
61
|
+
// No User-Agent: the WebView's own keeps a Cloudflare clearance valid (see AnimePahe).
|
|
50
62
|
const { html } = await NativeConsumet.makeGetRequestWithWebView(kwikUrl, {
|
|
51
|
-
|
|
52
|
-
'User-Agent': ua,
|
|
63
|
+
Referer: referer,
|
|
53
64
|
});
|
|
54
65
|
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const text = $(el).html() ?? '';
|
|
60
|
-
if (text.includes('eval(function(p,a,c,k,e,')) {
|
|
61
|
-
packedScript = text;
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
if (!packedScript) {
|
|
67
|
-
const m = html.match(/eval\(function\(p,a,c,k,e,[dr]\)[\s\S]+?\.split\(['"]\|['"]\)[\s\S]+?\)/);
|
|
68
|
-
packedScript = m?.[0] ?? null;
|
|
66
|
+
const m3u8 = findSource(html);
|
|
67
|
+
if (!m3u8) {
|
|
68
|
+
const packed = html.includes('eval(function(p,a,c,k,e,');
|
|
69
|
+
throw new Error(packed ? '[Kwik] No source URL found' : '[Kwik] No packed script found');
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
if (!packedScript) throw new Error('[Kwik] No packed script found');
|
|
72
|
-
|
|
73
|
-
const unpacked = unpackPacked(packedScript);
|
|
74
|
-
if (!unpacked) throw new Error('[Kwik] Failed to unpack script');
|
|
75
|
-
|
|
76
|
-
const sourceMatch =
|
|
77
|
-
unpacked.match(/const\s+source\s*=\s*'([^']+)'/) ||
|
|
78
|
-
unpacked.match(/const\s+source\s*=\s*"([^"]+)"/) ||
|
|
79
|
-
unpacked.match(/['"]?(https?:\/\/[^'"]+\.m3u8[^'"]*)['"]/);
|
|
80
|
-
|
|
81
|
-
if (!sourceMatch?.[1]) throw new Error('[Kwik] No source URL found');
|
|
82
|
-
|
|
83
|
-
const m3u8 = sourceMatch[1];
|
|
84
|
-
|
|
85
72
|
return {
|
|
86
73
|
sources: [{ url: m3u8, isM3U8: m3u8.includes('.m3u8') }],
|
|
87
74
|
headers: { Referer: `https://${kwikHost}/` },
|
package/src/index.tsx
CHANGED
|
@@ -51,6 +51,9 @@ import {
|
|
|
51
51
|
RegistrySignatureError,
|
|
52
52
|
verifyRegistrySignature,
|
|
53
53
|
parseSignedRegistry,
|
|
54
|
+
parseChapterNumber,
|
|
55
|
+
parseVolumeNumber,
|
|
56
|
+
sortChaptersForReading,
|
|
54
57
|
} from './utils';
|
|
55
58
|
import type {
|
|
56
59
|
IntegrityErrorCode,
|
|
@@ -275,6 +278,9 @@ export {
|
|
|
275
278
|
RegistrySignatureError,
|
|
276
279
|
verifyRegistrySignature,
|
|
277
280
|
parseSignedRegistry,
|
|
281
|
+
parseChapterNumber,
|
|
282
|
+
parseVolumeNumber,
|
|
283
|
+
sortChaptersForReading,
|
|
278
284
|
MetaError,
|
|
279
285
|
};
|
|
280
286
|
export type { MetaErrorSource };
|
package/src/models/types.ts
CHANGED
|
@@ -308,39 +308,74 @@ export enum SubOrDub {
|
|
|
308
308
|
BOTH = 'both',
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
+
/**
|
|
312
|
+
* A manga search result. Sites describe titles differently, so most fields are optional; every
|
|
313
|
+
* provider fills the ones its site has, in the same shape (see docs/guides/manga.md).
|
|
314
|
+
*/
|
|
311
315
|
export interface IMangaResult {
|
|
316
|
+
/** Provider id of the title, passed to `fetchMangaInfo`. Stable across calls. */
|
|
312
317
|
id: string;
|
|
313
|
-
title
|
|
314
|
-
|
|
318
|
+
/** Display title. Manga providers return a string; meta providers (AniList) return an `ITitle`. */
|
|
319
|
+
title: string | ITitle;
|
|
320
|
+
/** The title in other languages or spellings. */
|
|
321
|
+
altTitles?: string[];
|
|
322
|
+
/** Absolute cover image URL. */
|
|
315
323
|
image?: string;
|
|
316
|
-
|
|
324
|
+
/** Headers the cover image request needs (e.g. Referer) when the image host refuses hotlinks. */
|
|
325
|
+
headerForImage?: Record<string, string>;
|
|
326
|
+
/** Plain-text synopsis. */
|
|
327
|
+
description?: string;
|
|
317
328
|
status?: MediaStatus;
|
|
318
329
|
releaseDate?: number | string;
|
|
330
|
+
/** Absolute URL of the title's page on the site. */
|
|
331
|
+
url?: string;
|
|
319
332
|
[x: string]: unknown; // other fields
|
|
320
333
|
}
|
|
321
334
|
|
|
335
|
+
/** One chapter of a title. */
|
|
322
336
|
export interface IMangaChapter {
|
|
337
|
+
/** Provider id of the chapter, passed to `fetchChapterPages`. */
|
|
323
338
|
id: string;
|
|
339
|
+
/** Always a string: the chapter's name, or `Chapter 12` when the site gives none. */
|
|
324
340
|
title: string;
|
|
341
|
+
/** Chapter number (`12`, `10.5`) when the site gives one; chapter lists are ordered by it. */
|
|
342
|
+
chapterNumber?: number;
|
|
343
|
+
/** Volume number when the site gives one. */
|
|
344
|
+
volumeNumber?: number;
|
|
345
|
+
/** @deprecated Use `volumeNumber`. */
|
|
325
346
|
volume?: number;
|
|
326
347
|
pages?: number;
|
|
348
|
+
/** ISO 8601 date when it can be parsed, otherwise the site's own text. */
|
|
327
349
|
releaseDate?: string;
|
|
350
|
+
/** Scanlation group, when the site credits one. */
|
|
351
|
+
scanlator?: string;
|
|
352
|
+
/** Language of the chapter (ISO 639-1, e.g. `en`, with a region when the site has one, e.g. `pt-br`). */
|
|
353
|
+
language?: string;
|
|
354
|
+
/** Absolute URL of the chapter on the site. */
|
|
355
|
+
url?: string;
|
|
328
356
|
[x: string]: unknown; // other fields
|
|
329
357
|
}
|
|
330
358
|
|
|
331
359
|
export interface IMangaInfo extends IMangaResult {
|
|
332
360
|
malId?: number | string;
|
|
333
361
|
authors?: string[];
|
|
362
|
+
artists?: string[];
|
|
334
363
|
genres?: string[];
|
|
335
364
|
links?: string[];
|
|
336
365
|
characters?: any[];
|
|
337
366
|
recommendations?: IMangaResult[];
|
|
367
|
+
/** In reading order: the first chapter first (see `sortChaptersForReading`). */
|
|
338
368
|
chapters?: IMangaChapter[];
|
|
339
369
|
}
|
|
340
370
|
|
|
371
|
+
/** One page image of a chapter. */
|
|
341
372
|
export interface IMangaChapterPage {
|
|
373
|
+
/** Absolute image URL. */
|
|
342
374
|
img: string;
|
|
375
|
+
/** Position in the chapter, starting at 1. */
|
|
343
376
|
page: number;
|
|
377
|
+
/** Headers the image request needs (e.g. Referer). Set on every page when the host needs them. */
|
|
378
|
+
headerForImage?: Record<string, string>;
|
|
344
379
|
[x: string]: unknown; // other fields
|
|
345
380
|
}
|
|
346
381
|
|
|
@@ -34,15 +34,20 @@ export function createAnimePahe(ctx: ProviderContext, customBaseURL?: string) {
|
|
|
34
34
|
isDubAvailableSeparately: true,
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
const UA =
|
|
38
|
-
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36';
|
|
39
|
-
|
|
40
37
|
// ── WebView helpers ────────────────────────────────────────────────────────
|
|
41
|
-
let
|
|
42
|
-
const ensureChallengePassed =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
let challenge: Promise<void> | undefined;
|
|
39
|
+
const ensureChallengePassed = (): Promise<void> => {
|
|
40
|
+
// Searches running at once share one challenge load.
|
|
41
|
+
if (!challenge) {
|
|
42
|
+
challenge = makeGetRequestWithWebView(config.baseUrl, {}).then(
|
|
43
|
+
() => undefined,
|
|
44
|
+
(err: unknown) => {
|
|
45
|
+
challenge = undefined;
|
|
46
|
+
throw err;
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
return challenge;
|
|
46
51
|
};
|
|
47
52
|
|
|
48
53
|
const withRetry = async <T>(fn: () => Promise<T>, retries = 2): Promise<T> => {
|
|
@@ -64,12 +69,11 @@ export function createAnimePahe(ctx: ProviderContext, customBaseURL?: string) {
|
|
|
64
69
|
}
|
|
65
70
|
};
|
|
66
71
|
|
|
67
|
-
// Fetches an HTML page through the WebView
|
|
72
|
+
// Fetches an HTML page through the WebView, which gets past the Cloudflare challenge.
|
|
68
73
|
const webViewGet = async (url: string, referer?: string): Promise<string> => {
|
|
69
74
|
return withRetry(async () => {
|
|
70
75
|
const res = await makeGetRequestWithWebView(url, {
|
|
71
|
-
|
|
72
|
-
'Referer': referer ?? config.baseUrl,
|
|
76
|
+
Referer: referer ?? config.baseUrl,
|
|
73
77
|
});
|
|
74
78
|
return res.html ?? '';
|
|
75
79
|
});
|
|
@@ -78,14 +82,11 @@ export function createAnimePahe(ctx: ProviderContext, customBaseURL?: string) {
|
|
|
78
82
|
const webViewGetJson = async <T = any>(url: string, referer?: string): Promise<T> => {
|
|
79
83
|
return withRetry(async () => {
|
|
80
84
|
const res = await makeGetRequestWithWebView(url, {
|
|
81
|
-
'User-Agent': UA,
|
|
82
85
|
'Accept': 'application/json, text/javascript, */*; q=0.01',
|
|
83
86
|
'X-Requested-With': 'XMLHttpRequest',
|
|
84
87
|
'Referer': referer ?? config.baseUrl,
|
|
85
88
|
});
|
|
86
89
|
const raw = (res.html ?? '').replace(/<[^>]*>/g, '').trim();
|
|
87
|
-
console.log(raw);
|
|
88
|
-
|
|
89
90
|
if (!raw) throw new Error(`[AnimePahe] Empty response from ${url}`);
|
|
90
91
|
return JSON.parse(raw) as T;
|
|
91
92
|
});
|