react-native-consumet 3.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/providers/anime/animepahe/create-animepahe.js +12 -13
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js.map +1 -1
- 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/providers/anime/animepahe/create-animepahe.js +12 -13
- package/lib/module/providers/anime/animepahe/create-animepahe.js.map +1 -1
- 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/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- 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/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- 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/providers/anime/animepahe/create-animepahe.ts +15 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeConsumet.d.ts","sourceRoot":"","sources":["../../../../src/NativeConsumet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD
|
|
1
|
+
{"version":3,"file":"NativeConsumet.d.ts","sourceRoot":"","sources":["../../../../src/NativeConsumet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC;;;OAGG;IACH,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1D;;;OAGG;IACH,8BAA8B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7D;;;;;;;;OAQG;IACH,yBAAyB,CACvB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GACjC,OAAO,CAAC;QACT,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;IACH;;;;;OAKG;IACH,0BAA0B,CACxB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,EAClC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC;QACT,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,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,CAiCgF,CAAC;AACpF,eAAO,MAAM,eAAe,QA5BnB,MAAM,WACF;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,QAC5B,MAAM,KACX,OAAO,CAAC;IACT,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACpC,CAqB0D,CAAC;AAC9D,eAAO,MAAM,iBAAiB,WAVA,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAUG,CAAC;AAElE,eAAe,cAAc,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ExtractorContext, type IVideoExtractor } from '../models';
|
|
2
2
|
/**
|
|
3
3
|
* Kwik extractor function
|
|
4
|
-
* @param ctx ExtractorContext
|
|
4
|
+
* @param ctx ExtractorContext; the embed page is loaded through its NativeConsumet WebView
|
|
5
5
|
* @returns Object with extract method implementing IVideoExtractor interface
|
|
6
6
|
*/
|
|
7
7
|
export declare function Kwik(ctx: ExtractorContext): IVideoExtractor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kwik.d.ts","sourceRoot":"","sources":["../../../../../src/extractors/kwik.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAA6B,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAGnG;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,gBAAgB,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"kwik.d.ts","sourceRoot":"","sources":["../../../../../src/extractors/kwik.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAA6B,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAGnG;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,gBAAgB,GAAG,eAAe,CAsE3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-animepahe.d.ts","sourceRoot":"","sources":["../../../../../../../src/providers/anime/animepahe/create-animepahe.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,gBAAgB,EAErB,KAAK,eAAe,EAIpB,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AAEzB,wBAAgB,eAAe,CAAC,GAAG,EAAE,eAAe,EAAE,aAAa,CAAC,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"create-animepahe.d.ts","sourceRoot":"","sources":["../../../../../../../src/providers/anime/animepahe/create-animepahe.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,gBAAgB,EAErB,KAAK,eAAe,EAIpB,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AAEzB,wBAAgB,eAAe,CAAC,GAAG,EAAE,eAAe,EAAE,aAAa,CAAC,EAAE,MAAM;kBAsR9B,oBAAoB;oBAhLnC,MAAM,SAAQ,MAAM,KAAO,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;yBAqBpD,MAAM,gBAAe,MAAM,KAAQ,OAAO,CAAC,UAAU,CAAC;qCAiF3E,MAAM,WACT,gBAAgB,aACd,QAAQ,KACjB,OAAO,CAAC,OAAO,CAAC;qCA8C2B,MAAM,YAAY,QAAQ,KAAG,OAAO,CAAC,cAAc,EAAE,CAAC;;;;;;;;;EA+BrG;AAED,MAAM,MAAM,yBAAyB,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -9,7 +9,7 @@ import type { TurboModule } from 'react-native';
|
|
|
9
9
|
* | code | methods | meaning |
|
|
10
10
|
* | ----------------- | ------------------------------ | --------------------------------------------------------------- |
|
|
11
11
|
* | `WEBVIEW_ERROR` | WebView requests (below) | The main document failed to load (DNS, TLS, connection). |
|
|
12
|
-
* | `TIMEOUT` | WebView requests (below) |
|
|
12
|
+
* | `TIMEOUT` | WebView requests (below) | No page (past any Cloudflare challenge) finished within 30 s. |
|
|
13
13
|
* | `COOKIE_ERROR` | getDdosGuardCookiesWithWebView | The page loaded but set no `__ddg2_` cookie. |
|
|
14
14
|
* | `ERROR` | bypassDdosGuard | Invalid URL, or no DDoS-Guard cookie could be obtained. |
|
|
15
15
|
* | `HTTP_ERROR` | makePostRequest | Invalid URL or transport failure. HTTP error statuses resolve. |
|
|
@@ -21,7 +21,10 @@ import type { TurboModule } from 'react-native';
|
|
|
21
21
|
* makePostRequestWithWebView) load the URL in a hidden WebView:
|
|
22
22
|
* - Only the main document decides the outcome. Failed sub-resources (images, scripts, iframes)
|
|
23
23
|
* are ignored, and HTTP error statuses (403, 503, ...) still resolve with the page.
|
|
24
|
-
* - The first finished page settles the request; later navigations and errors are ignored.
|
|
24
|
+
* - The first finished page settles the request; later navigations and errors are ignored. The
|
|
25
|
+
* exception is a Cloudflare challenge page ("Just a moment..."): makeGetRequestWithWebView and
|
|
26
|
+
* makePostRequestWithWebView wait for the page the challenge reloads into once its script has
|
|
27
|
+
* run, within the same 30 s.
|
|
25
28
|
* - `cookies` (and the getDdosGuardCookiesWithWebView result) is a Cookie header string with the
|
|
26
29
|
* cookies that apply to the loaded URL.
|
|
27
30
|
* - Cookies carry over between calls. Android uses the app-wide CookieManager; iOS uses an
|
|
@@ -46,9 +49,12 @@ export interface Spec extends TurboModule {
|
|
|
46
49
|
*/
|
|
47
50
|
getDdosGuardCookiesWithWebView(url: string): Promise<string>;
|
|
48
51
|
/**
|
|
49
|
-
* Loads `url` in a hidden WebView and resolves 1.5 s after the main document finishes loading
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
+
* Loads `url` in a hidden WebView and resolves 1.5 s after the main document finishes loading
|
|
53
|
+
* (the page a Cloudflare challenge reloads into, when the first page is one), with its
|
|
54
|
+
* `outerHTML`, the final URL and its cookies. User-Agent and Cookie headers are applied
|
|
55
|
+
* to the WebView; other headers are sent with the request. Without a User-Agent header the
|
|
56
|
+
* WebView keeps the engine's own (on iOS with Mobile Safari's tokens), which Cloudflare checks
|
|
57
|
+
* against what the engine reports. `status` is always `'success'`:
|
|
52
58
|
* failures and timeouts reject (`WEBVIEW_ERROR`, `TIMEOUT`).
|
|
53
59
|
*/
|
|
54
60
|
makeGetRequestWithWebView(url: string, headers: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeConsumet.d.ts","sourceRoot":"","sources":["../../../../src/NativeConsumet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD
|
|
1
|
+
{"version":3,"file":"NativeConsumet.d.ts","sourceRoot":"","sources":["../../../../src/NativeConsumet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC;;;OAGG;IACH,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1D;;;OAGG;IACH,8BAA8B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7D;;;;;;;;OAQG;IACH,yBAAyB,CACvB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GACjC,OAAO,CAAC;QACT,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC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AAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,CAiD8E,CAAC;AAClF,eAAO,MAAM,0BAA0B,QA1C9B,MAAM,WACF;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,QAC5B,MAAM,KACX,OAAO,CAAC;IACT,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB,CAiCgF,CAAC;AACpF,eAAO,MAAM,eAAe,QA5BnB,MAAM,WACF;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,QAC5B,MAAM,KACX,OAAO,CAAC;IACT,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACpC,CAqB0D,CAAC;AAC9D,eAAO,MAAM,iBAAiB,WAVA,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAUG,CAAC;AAElE,eAAe,cAAc,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ExtractorContext, type IVideoExtractor } from '../models';
|
|
2
2
|
/**
|
|
3
3
|
* Kwik extractor function
|
|
4
|
-
* @param ctx ExtractorContext
|
|
4
|
+
* @param ctx ExtractorContext; the embed page is loaded through its NativeConsumet WebView
|
|
5
5
|
* @returns Object with extract method implementing IVideoExtractor interface
|
|
6
6
|
*/
|
|
7
7
|
export declare function Kwik(ctx: ExtractorContext): IVideoExtractor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kwik.d.ts","sourceRoot":"","sources":["../../../../../src/extractors/kwik.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAA6B,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAGnG;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,gBAAgB,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"kwik.d.ts","sourceRoot":"","sources":["../../../../../src/extractors/kwik.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAA6B,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAGnG;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,gBAAgB,GAAG,eAAe,CAsE3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-animepahe.d.ts","sourceRoot":"","sources":["../../../../../../../src/providers/anime/animepahe/create-animepahe.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,gBAAgB,EAErB,KAAK,eAAe,EAIpB,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AAEzB,wBAAgB,eAAe,CAAC,GAAG,EAAE,eAAe,EAAE,aAAa,CAAC,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"create-animepahe.d.ts","sourceRoot":"","sources":["../../../../../../../src/providers/anime/animepahe/create-animepahe.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,gBAAgB,EAErB,KAAK,eAAe,EAIpB,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AAEzB,wBAAgB,eAAe,CAAC,GAAG,EAAE,eAAe,EAAE,aAAa,CAAC,EAAE,MAAM;kBAsR9B,oBAAoB;oBAhLnC,MAAM,SAAQ,MAAM,KAAO,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;yBAqBpD,MAAM,gBAAe,MAAM,KAAQ,OAAO,CAAC,UAAU,CAAC;qCAiF3E,MAAM,WACT,gBAAgB,aACd,QAAQ,KACjB,OAAO,CAAC,OAAO,CAAC;qCA8C2B,MAAM,YAAY,QAAQ,KAAG,OAAO,CAAC,cAAc,EAAE,CAAC;;;;;;;;;EA+BrG;AAED,MAAM,MAAM,yBAAyB,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-consumet",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "React Native library providing access to entertainment media information (anime, movies, manga, etc.) from multiple sources, adapting the Consumet API for mobile applications.",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|
package/src/NativeConsumet.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { TurboModuleRegistry } from 'react-native';
|
|
|
11
11
|
* | code | methods | meaning |
|
|
12
12
|
* | ----------------- | ------------------------------ | --------------------------------------------------------------- |
|
|
13
13
|
* | `WEBVIEW_ERROR` | WebView requests (below) | The main document failed to load (DNS, TLS, connection). |
|
|
14
|
-
* | `TIMEOUT` | WebView requests (below) |
|
|
14
|
+
* | `TIMEOUT` | WebView requests (below) | No page (past any Cloudflare challenge) finished within 30 s. |
|
|
15
15
|
* | `COOKIE_ERROR` | getDdosGuardCookiesWithWebView | The page loaded but set no `__ddg2_` cookie. |
|
|
16
16
|
* | `ERROR` | bypassDdosGuard | Invalid URL, or no DDoS-Guard cookie could be obtained. |
|
|
17
17
|
* | `HTTP_ERROR` | makePostRequest | Invalid URL or transport failure. HTTP error statuses resolve. |
|
|
@@ -23,7 +23,10 @@ import { TurboModuleRegistry } from 'react-native';
|
|
|
23
23
|
* makePostRequestWithWebView) load the URL in a hidden WebView:
|
|
24
24
|
* - Only the main document decides the outcome. Failed sub-resources (images, scripts, iframes)
|
|
25
25
|
* are ignored, and HTTP error statuses (403, 503, ...) still resolve with the page.
|
|
26
|
-
* - The first finished page settles the request; later navigations and errors are ignored.
|
|
26
|
+
* - The first finished page settles the request; later navigations and errors are ignored. The
|
|
27
|
+
* exception is a Cloudflare challenge page ("Just a moment..."): makeGetRequestWithWebView and
|
|
28
|
+
* makePostRequestWithWebView wait for the page the challenge reloads into once its script has
|
|
29
|
+
* run, within the same 30 s.
|
|
27
30
|
* - `cookies` (and the getDdosGuardCookiesWithWebView result) is a Cookie header string with the
|
|
28
31
|
* cookies that apply to the loaded URL.
|
|
29
32
|
* - Cookies carry over between calls. Android uses the app-wide CookieManager; iOS uses an
|
|
@@ -46,9 +49,12 @@ export interface Spec extends TurboModule {
|
|
|
46
49
|
*/
|
|
47
50
|
getDdosGuardCookiesWithWebView(url: string): Promise<string>;
|
|
48
51
|
/**
|
|
49
|
-
* Loads `url` in a hidden WebView and resolves 1.5 s after the main document finishes loading
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
+
* Loads `url` in a hidden WebView and resolves 1.5 s after the main document finishes loading
|
|
53
|
+
* (the page a Cloudflare challenge reloads into, when the first page is one), with its
|
|
54
|
+
* `outerHTML`, the final URL and its cookies. User-Agent and Cookie headers are applied
|
|
55
|
+
* to the WebView; other headers are sent with the request. Without a User-Agent header the
|
|
56
|
+
* WebView keeps the engine's own (on iOS with Mobile Safari's tokens), which Cloudflare checks
|
|
57
|
+
* against what the engine reports. `status` is always `'success'`:
|
|
52
58
|
* failures and timeouts reject (`WEBVIEW_ERROR`, `TIMEOUT`).
|
|
53
59
|
*/
|
|
54
60
|
makeGetRequestWithWebView(
|
|
@@ -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}/` },
|
|
@@ -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
|
});
|