react-native-consumet 0.6.2 → 0.7.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.
Files changed (99) hide show
  1. package/android/generated/java/com/consumet/NativeConsumetSpec.java +1 -1
  2. package/android/generated/jni/RNConsumetSpec-generated.cpp +2 -2
  3. package/android/generated/jni/react/renderer/components/RNConsumetSpec/RNConsumetSpecJSI-generated.cpp +3 -2
  4. package/android/generated/jni/react/renderer/components/RNConsumetSpec/RNConsumetSpecJSI.h +5 -5
  5. package/android/src/main/assets/crypto-js.js +1 -0
  6. package/android/src/main/assets/megacloud.decodedpng.js +606 -0
  7. package/android/src/main/assets/megacloud.getsrcs.js +832 -0
  8. package/android/src/main/java/com/consumet/ConsumetModule.kt +37 -69
  9. package/ios/generated/RNConsumetSpec/RNConsumetSpec-generated.mm +2 -2
  10. package/ios/generated/RNConsumetSpec/RNConsumetSpec.h +2 -1
  11. package/ios/generated/RNConsumetSpecJSI-generated.cpp +3 -2
  12. package/ios/generated/RNConsumetSpecJSI.h +5 -5
  13. package/lib/commonjs/NativeConsumet.ts +9 -2
  14. package/lib/commonjs/extractors/megacloud/index.js +2 -3
  15. package/lib/commonjs/extractors/megacloud/index.js.map +1 -1
  16. package/lib/commonjs/extractors/megaup.js +56 -63
  17. package/lib/commonjs/extractors/megaup.js.map +1 -1
  18. package/lib/commonjs/extractors/vidcloud.js +2 -3
  19. package/lib/commonjs/extractors/vidcloud.js.map +1 -1
  20. package/lib/commonjs/index.js +0 -13
  21. package/lib/commonjs/index.js.map +1 -1
  22. package/lib/commonjs/models/types.js +1 -0
  23. package/lib/commonjs/models/types.js.map +1 -1
  24. package/lib/commonjs/providers/anime/animekai.js +3 -2
  25. package/lib/commonjs/providers/anime/animekai.js.map +1 -1
  26. package/lib/commonjs/providers/anime/animepahe.js +3 -3
  27. package/lib/commonjs/providers/anime/animepahe.js.map +1 -1
  28. package/lib/commonjs/providers/movies/himovies.js +404 -0
  29. package/lib/commonjs/providers/movies/himovies.js.map +1 -0
  30. package/lib/commonjs/providers/movies/index.js +3 -1
  31. package/lib/commonjs/providers/movies/index.js.map +1 -1
  32. package/lib/commonjs/providers/movies/netflixmirror.js +2 -2
  33. package/lib/commonjs/providers/movies/netflixmirror.js.map +1 -1
  34. package/lib/commonjs/utils/providers-list.js +1 -1
  35. package/lib/commonjs/utils/providers-list.js.map +1 -1
  36. package/lib/module/NativeConsumet.ts +9 -2
  37. package/lib/module/extractors/megacloud/index.js +2 -2
  38. package/lib/module/extractors/megacloud/index.js.map +1 -1
  39. package/lib/module/extractors/megaup.js +56 -63
  40. package/lib/module/extractors/megaup.js.map +1 -1
  41. package/lib/module/extractors/vidcloud.js +2 -2
  42. package/lib/module/extractors/vidcloud.js.map +1 -1
  43. package/lib/module/index.js +0 -7
  44. package/lib/module/index.js.map +1 -1
  45. package/lib/module/models/types.js +1 -0
  46. package/lib/module/models/types.js.map +1 -1
  47. package/lib/module/providers/anime/animekai.js +3 -2
  48. package/lib/module/providers/anime/animekai.js.map +1 -1
  49. package/lib/module/providers/anime/animepahe.js +1 -1
  50. package/lib/module/providers/anime/animepahe.js.map +1 -1
  51. package/lib/module/providers/movies/himovies.js +401 -0
  52. package/lib/module/providers/movies/himovies.js.map +1 -0
  53. package/lib/module/providers/movies/index.js +3 -1
  54. package/lib/module/providers/movies/index.js.map +1 -1
  55. package/lib/module/providers/movies/netflixmirror.js +1 -1
  56. package/lib/module/providers/movies/netflixmirror.js.map +1 -1
  57. package/lib/module/utils/providers-list.js +1 -1
  58. package/lib/module/utils/providers-list.js.map +1 -1
  59. package/lib/typescript/commonjs/src/NativeConsumet.d.ts +16 -3
  60. package/lib/typescript/commonjs/src/NativeConsumet.d.ts.map +1 -1
  61. package/lib/typescript/commonjs/src/extractors/megaup.d.ts +7 -5
  62. package/lib/typescript/commonjs/src/extractors/megaup.d.ts.map +1 -1
  63. package/lib/typescript/commonjs/src/index.d.ts +0 -10
  64. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  65. package/lib/typescript/commonjs/src/models/types.d.ts +2 -1
  66. package/lib/typescript/commonjs/src/models/types.d.ts.map +1 -1
  67. package/lib/typescript/commonjs/src/providers/movies/himovies.d.ts +41 -0
  68. package/lib/typescript/commonjs/src/providers/movies/himovies.d.ts.map +1 -0
  69. package/lib/typescript/commonjs/src/providers/movies/index.d.ts +2 -0
  70. package/lib/typescript/commonjs/src/providers/movies/index.d.ts.map +1 -1
  71. package/lib/typescript/commonjs/src/utils/providers-list.d.ts +1 -1
  72. package/lib/typescript/commonjs/src/utils/providers-list.d.ts.map +1 -1
  73. package/lib/typescript/module/src/NativeConsumet.d.ts +16 -3
  74. package/lib/typescript/module/src/NativeConsumet.d.ts.map +1 -1
  75. package/lib/typescript/module/src/extractors/megaup.d.ts +7 -5
  76. package/lib/typescript/module/src/extractors/megaup.d.ts.map +1 -1
  77. package/lib/typescript/module/src/index.d.ts +0 -10
  78. package/lib/typescript/module/src/index.d.ts.map +1 -1
  79. package/lib/typescript/module/src/models/types.d.ts +2 -1
  80. package/lib/typescript/module/src/models/types.d.ts.map +1 -1
  81. package/lib/typescript/module/src/providers/movies/himovies.d.ts +41 -0
  82. package/lib/typescript/module/src/providers/movies/himovies.d.ts.map +1 -0
  83. package/lib/typescript/module/src/providers/movies/index.d.ts +2 -0
  84. package/lib/typescript/module/src/providers/movies/index.d.ts.map +1 -1
  85. package/lib/typescript/module/src/utils/providers-list.d.ts +1 -1
  86. package/lib/typescript/module/src/utils/providers-list.d.ts.map +1 -1
  87. package/package.json +1 -1
  88. package/src/NativeConsumet.ts +9 -2
  89. package/src/extractors/megacloud/index.ts +2 -2
  90. package/src/extractors/megaup.ts +60 -83
  91. package/src/extractors/vidcloud.ts +2 -2
  92. package/src/index.tsx +135 -138
  93. package/src/models/types.ts +1 -0
  94. package/src/providers/anime/animekai.ts +2 -2
  95. package/src/providers/anime/animepahe.ts +1 -1
  96. package/src/providers/movies/himovies.ts +495 -0
  97. package/src/providers/movies/index.ts +2 -0
  98. package/src/providers/movies/netflixmirror.ts +1 -1
  99. package/src/utils/providers-list.ts +1 -0
@@ -0,0 +1,41 @@
1
+ import { MovieParser, TvType, type IMovieInfo, type IEpisodeServer, StreamingServers, type ISource, type IMovieResult, type ISearch } from '../../models';
2
+ declare class HiMovies extends MovieParser {
3
+ readonly name = "HiMovies";
4
+ protected baseUrl: string;
5
+ protected logo: string;
6
+ protected classPath: string;
7
+ supportedTypes: Set<TvType>;
8
+ constructor(customBaseURL?: string);
9
+ /**
10
+ *
11
+ * @param query search query string
12
+ * @param page page number (default 1) (optional)
13
+ */
14
+ search: (query: string, page?: number) => Promise<ISearch<IMovieResult>>;
15
+ /**
16
+ *
17
+ * @param mediaId media link or id
18
+ */
19
+ fetchMediaInfo: (mediaId: string) => Promise<IMovieInfo>;
20
+ /**
21
+ *
22
+ * @param episodeId episode id
23
+ * @param mediaId media id
24
+ * @param server server type (default `MegaCloud`) (optional)
25
+ */
26
+ fetchEpisodeSources: (episodeId: string, mediaId: string, server?: StreamingServers) => Promise<ISource>;
27
+ /**
28
+ *
29
+ * @param episodeId takes episode link or movie id
30
+ * @param mediaId takes movie link or id (found on movie info object)
31
+ */
32
+ fetchEpisodeServers: (episodeId: string, mediaId: string) => Promise<IEpisodeServer[]>;
33
+ fetchRecentMovies: () => Promise<IMovieResult[]>;
34
+ fetchRecentTvShows: () => Promise<IMovieResult[]>;
35
+ fetchTrendingMovies: () => Promise<IMovieResult[]>;
36
+ fetchTrendingTvShows: () => Promise<IMovieResult[]>;
37
+ fetchByCountry: (country: string, page?: number) => Promise<ISearch<IMovieResult>>;
38
+ fetchByGenre: (genre: string, page?: number) => Promise<ISearch<IMovieResult>>;
39
+ }
40
+ export default HiMovies;
41
+ //# sourceMappingURL=himovies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"himovies.d.ts","sourceRoot":"","sources":["../../../../../../src/providers/movies/himovies.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,MAAM,EACN,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,gBAAgB,EAChB,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,OAAO,EACb,MAAM,cAAc,CAAC;AAGtB,cAAM,QAAS,SAAQ,WAAW;IAChC,SAAkB,IAAI,cAAc;IACpC,UAAmB,OAAO,SAAyB;IACnD,UAAmB,IAAI,SAA4D;IACnF,UAAmB,SAAS,SAAqB;IACxC,cAAc,cAA4C;gBACvD,aAAa,CAAC,EAAE,MAAM;IAalC;;;;OAIG;IACM,MAAM,GAAU,OAAO,MAAM,EAAE,OAAM,MAAU,KAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAmCvF;IAEF;;;OAGG;IACM,cAAc,GAAU,SAAS,MAAM,KAAG,OAAO,CAAC,UAAU,CAAC,CAgGpE;IAEF;;;;;OAKG;IACM,mBAAmB,GAC1B,WAAW,MAAM,EACjB,SAAS,MAAM,EACf,SAAQ,gBAA6C,KACpD,OAAO,CAAC,OAAO,CAAC,CA0CjB;IAEF;;;;OAIG;IACM,mBAAmB,GAAU,WAAW,MAAM,EAAE,SAAS,MAAM,KAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CA0BlG;IAEF,iBAAiB,QAAa,OAAO,CAAC,YAAY,EAAE,CAAC,CA6BnD;IAEF,kBAAkB,QAAa,OAAO,CAAC,YAAY,EAAE,CAAC,CA6BpD;IAEF,mBAAmB,QAAa,OAAO,CAAC,YAAY,EAAE,CAAC,CA2BrD;IAEF,oBAAoB,QAAa,OAAO,CAAC,YAAY,EAAE,CAAC,CA2BtD;IAEF,cAAc,GAAU,SAAS,MAAM,EAAE,OAAM,MAAU,KAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CA+CxF;IAEF,YAAY,GAAU,OAAO,MAAM,EAAE,OAAM,MAAU,KAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAiDpF;CACH;AAWD,eAAe,QAAQ,CAAC"}
@@ -10,6 +10,7 @@ import ViewAsian from './viewAsian';
10
10
  import SFlix from './sflix';
11
11
  import MultiMovies from './multimovies';
12
12
  import NetflixMirror from './netflixmirror';
13
+ import HiMovies from './himovies';
13
14
  declare const _default: {
14
15
  DramaCool: typeof DramaCool;
15
16
  FlixHQ: typeof FlixHQ;
@@ -23,6 +24,7 @@ declare const _default: {
23
24
  SFlix: typeof SFlix;
24
25
  MultiMovies: typeof MultiMovies;
25
26
  NetflixMirror: typeof NetflixMirror;
27
+ HiMovies: typeof HiMovies;
26
28
  };
27
29
  export default _default;
28
30
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/providers/movies/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,aAAa,MAAM,iBAAiB,CAAC;;;;;;;;;;;;;;;AAE5C,wBAaE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/providers/movies/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,QAAQ,MAAM,YAAY,CAAC;;;;;;;;;;;;;;;;AAElC,wBAcE"}
@@ -8,7 +8,7 @@ export declare const PROVIDERS_LIST: {
8
8
  MANGA: (import("../providers/manga/mangadex").default | import("../providers/manga/comick").default | import("../providers/manga/mangahere").default | import("../providers/manga/mangakakalot").default | import("../providers/manga/mangasee123").default | import("../providers/manga/mangapark").default | import("../providers/manga/mangapill").default | import("../providers/manga/mangareader").default | import("../providers/manga/flamescans").default | import("../providers/manga/mangahost").default | import("../providers/manga/brmangas").default)[];
9
9
  COMICS: import("../providers/comics/getComics").default[];
10
10
  LIGHT_NOVELS: import("../providers/light-novels/readlightnovels").default[];
11
- MOVIES: (import("../providers/movies/dramacool").default | import("../providers/movies/flixhq").default | import("../providers/movies/fmovies").default | import("../providers/movies/goku").default | import("../providers/movies/kissasian").default | import("../providers/movies/moviehdwatch").default | import("../providers/movies/viewAsian").default | import("../providers/movies/sflix").default | import("../providers/movies/multimovies").default | import("../providers/movies/netflixmirror").default)[];
11
+ MOVIES: (import("../providers/movies/dramacool").default | import("../providers/movies/flixhq").default | import("../providers/movies/fmovies").default | import("../providers/movies/goku").default | import("../providers/movies/kissasian").default | import("../providers/movies/moviehdwatch").default | import("../providers/movies/viewAsian").default | import("../providers/movies/sflix").default | import("../providers/movies/multimovies").default | import("../providers/movies/netflixmirror").default | import("../providers/movies/himovies").default)[];
12
12
  NEWS: import("../providers/news/animenewsnetwork").default[];
13
13
  META: (import("../providers/meta/anilist").default | import("../providers/meta/mal").default | import("../providers/meta/tmdb").default)[];
14
14
  OTHERS: never[];
@@ -1 +1 @@
1
- {"version":3,"file":"providers-list.d.ts","sourceRoot":"","sources":["../../../../../src/utils/providers-list.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;;;;CAyC1B,CAAC"}
1
+ {"version":3,"file":"providers-list.d.ts","sourceRoot":"","sources":["../../../../../src/utils/providers-list.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;;;;CA0C1B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-consumet",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
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",
@@ -2,7 +2,7 @@ import type { TurboModule } from 'react-native';
2
2
  import { TurboModuleRegistry } from 'react-native';
3
3
 
4
4
  export interface Spec extends TurboModule {
5
- getSources(xrax: string): Promise<string>;
5
+ getSources(embedUrl: string, site: string): Promise<string>;
6
6
  bypassDdosGuard(url: string): Promise<{ cookie: string }>;
7
7
  getDdosGuardCookiesWithWebView(url: string): Promise<string>;
8
8
  makeGetRequestWithWebView(
@@ -16,4 +16,11 @@ export interface Spec extends TurboModule {
16
16
  }>;
17
17
  }
18
18
 
19
- export default TurboModuleRegistry.getEnforcing<Spec>('Consumet');
19
+ const NativeConsumet = TurboModuleRegistry.getEnforcing<Spec>('Consumet');
20
+
21
+ export const bypassDdosGuard = NativeConsumet.bypassDdosGuard;
22
+ export const getDdosGuardCookiesWithWebView = NativeConsumet.getDdosGuardCookiesWithWebView;
23
+ export const makeGetRequestWithWebView = NativeConsumet.makeGetRequestWithWebView;
24
+ export const getSources = NativeConsumet.getSources;
25
+
26
+ export default NativeConsumet;
@@ -1,5 +1,5 @@
1
1
  import { type ISource, type IVideo, VideoExtractor } from '../../models';
2
- import Consumet from '../../NativeConsumet';
2
+ import { getSources } from '../../NativeConsumet';
3
3
 
4
4
  class MegaCloud extends VideoExtractor {
5
5
  protected override serverName = 'MegaCloud';
@@ -21,7 +21,7 @@ class MegaCloud extends VideoExtractor {
21
21
  };
22
22
  const regex = /\/([^\/?]+)(?=\?)/;
23
23
  const xrax = embedIframeURL.toString().match(regex)?.[1];
24
- const jsonResponse = await Consumet.getSources(xrax!);
24
+ const jsonResponse = await getSources(embedIframeURL.href, referer);
25
25
  const resp = JSON.parse(jsonResponse);
26
26
 
27
27
  if (!resp) return extractedData;
@@ -1,120 +1,97 @@
1
1
  //extractor for https://animekai.to
2
2
 
3
- // The code for this is now fetched from outside consumet:
4
- // https://raw.githubusercontent.com/amarullz/kaicodex/refs/heads/main/generated/kai_codex.js
5
- // as this repository auto-updates the extraction keys when they change.
6
- // If something breaks in the future, blame this part.
3
+ // Keys required for the decryption to work are loaded dynamically from
4
+ // https://raw.githubusercontent.com/amarullz/kaicodex/main/generated/keys.json
7
5
 
8
6
  import { type ISource, type IVideo, VideoExtractor } from '../models';
9
- import { type AxiosAdapter } from 'axios';
10
- import { type ProxyConfig } from '../models/types';
11
-
12
- interface KaiCodex {
13
- rc4: (key: string, str: string) => string;
14
- safeBtoa: (s: string) => string;
15
- safeAtob: (s: string) => string;
16
- reverseString: (s: string) => string;
17
- replaceChars: (s: string, f: string, r: string) => string;
18
- enc: (n: string) => string;
19
- dec: (n: string) => string;
20
- decMega: (n: string) => string;
21
- }
7
+ import type { AxiosAdapter } from 'axios';
8
+ import type { ProxyConfig } from '../models/types';
22
9
 
23
10
  export class MegaUp extends VideoExtractor {
24
11
  protected serverName: string = 'MegaUp';
25
12
  protected sources: IVideo[] = [];
26
- private KAICODEX!: KaiCodex;
27
- private kaicodexReady: Promise<void>;
28
-
29
- /* Old decrypting functions in case the new ones break
30
-
31
- #reverseIt = (n: string) => {
32
- return n.split('').reverse().join('');
33
- };
34
- #base64UrlEncode = (str: string) => {
35
- return btoa(str).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
36
- };
37
- #substitute = (input: string, keys: string, values: string) => {
38
- const map = Object.fromEntries(keys.split('').map((key, i) => [key, values[i] || '']));
39
- const a = input
40
- .split('')
41
- .map(char => map[char] || char)
42
- .join('');
43
- return a;
44
- };
45
- #transform = (n: string, t: string) => {
46
- const v = Array.from({ length: 256 }, (_, i) => i);
47
- let c = 0,
48
- f = '';
49
-
50
- for (let w = 0; w < 256; w++) {
51
- c = (c + v[w] + n.charCodeAt(w % n.length)) % 256;
52
- [v[w], v[c]] = [v[c], v[w]];
53
- }
54
- for (let a = (c = 0), w = 0; a < t.length; a++) {
55
- w = (w + 1) % 256;
56
- c = (c + v[w]) % 256;
57
- [v[w], v[c]] = [v[c], v[w]];
58
- f += String.fromCharCode(t.charCodeAt(a) ^ v[(v[w] + v[c]) % 256]);
59
- }
60
-
61
- return f;
62
- };
63
- #base64UrlDecode = (n: string) => {
64
- n = n
65
- .padEnd(n.length + ((4 - (n.length % 4)) % 4), '=')
66
- .replace(/-/g, '+')
67
- .replace(/_/g, '/');
68
- return atob(n);
69
- };
70
-
71
- */
13
+ private homeKeys: string[] = [];
14
+ private megaKeys: string[] = [];
15
+ private kaiKeysReady: Promise<void>;
72
16
 
73
17
  constructor(
74
18
  protected proxyConfig?: ProxyConfig,
75
19
  protected adapter?: AxiosAdapter
76
20
  ) {
77
21
  super(proxyConfig, adapter);
78
- this.kaicodexReady = this.loadKAICODEX();
22
+ this.kaiKeysReady = this.loadKAIKEYS();
79
23
  }
80
24
 
81
- private async loadKAICODEX(): Promise<void> {
82
- const extraction_code =
83
- 'https://raw.githubusercontent.com/amarullz/kaicodex/refs/heads/main/generated/kai_codex.js';
84
-
85
- const response = await fetch(extraction_code);
86
- const originalCode = await response.text();
25
+ private async loadKAIKEYS(): Promise<void> {
26
+ const extraction_keys = 'https://raw.githubusercontent.com/amarullz/kaicodex/main/generated/keys.json';
87
27
 
88
- const wrappedCode = `
89
- ${originalCode}
90
- return KAICODEX;
91
- `;
28
+ const response = await this.client.get(extraction_keys);
29
+ const keys = await response.data;
92
30
 
93
- // eslint-disable-next-line no-new-func
94
- const fn = new Function(wrappedCode);
95
- this.KAICODEX = fn();
31
+ for (var i = 0; i < keys.kai.length; i++) {
32
+ this.homeKeys.push(atob(keys.kai[i]));
33
+ }
34
+ for (var i = 0; i < keys.mega.length; i++) {
35
+ this.megaKeys.push(atob(keys.mega[i]));
36
+ }
96
37
  }
97
38
 
39
+ private keysChar = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-~!*()'.".split('');
40
+
98
41
  GenerateToken = (n: string) => {
99
- return this.KAICODEX.enc(n);
42
+ n = encodeURIComponent(n);
43
+ const l = n.length;
44
+ let o = [];
45
+ for (var i = 0; i < l; i++) {
46
+ const kc = this.homeKeys[this.keysChar.indexOf(n.charAt(i))];
47
+ const c = kc?.charAt(i % kc.length!);
48
+ o.push(c);
49
+ }
50
+ return btoa(o.join('')).replace(/\//g, '_').replace(/\+/g, '-').replace(/\=/g, '');
100
51
  };
101
52
 
102
53
  DecodeIframeData = (n: string) => {
103
- return this.KAICODEX.dec(n);
54
+ n = atob(n.replace(/_/g, '/').replace(/-/g, '+'));
55
+ const l = n.length;
56
+ let o = [];
57
+ for (var i = 0; i < l; i++) {
58
+ const c = n.charCodeAt(i);
59
+ const k = this.megaKeys[c];
60
+ o.push(k?.charCodeAt(i % k.length!));
61
+ }
62
+ return decodeURIComponent(String.fromCharCode.apply(null, o.filter((val) => val !== undefined) as number[]));
104
63
  };
105
64
 
106
65
  Decode = (n: string) => {
107
- return this.KAICODEX.decMega(n);
66
+ n = atob(n.replace(/_/g, '/').replace(/-/g, '+'));
67
+ const l = n.length;
68
+ let o = [];
69
+ for (var i = 0; i < l; i++) {
70
+ const c = n.charCodeAt(i);
71
+ let cp = '';
72
+ for (var j = 0; j < this.homeKeys.length; j++) {
73
+ var ck = this.homeKeys[j]?.charCodeAt(i % this.homeKeys[j]?.length!);
74
+ if (ck === c) {
75
+ cp = this.keysChar[j]!;
76
+ break;
77
+ }
78
+ }
79
+ if (cp) {
80
+ o.push(cp);
81
+ } else {
82
+ o.push('%');
83
+ }
84
+ }
85
+ return decodeURIComponent(o.join(''));
108
86
  };
109
87
 
110
88
  override extract = async (videoUrl: URL): Promise<ISource> => {
111
89
  try {
112
- await this.kaicodexReady;
90
+ await this.kaiKeysReady;
113
91
 
114
92
  const url = videoUrl.href.replace(/\/(e|e2)\//, '/media/');
115
93
  const res = await this.client.get(url);
116
-
117
- const decrypted = JSON.parse(this.KAICODEX.decMega(res.data.result).replace(/\\/g, ''));
94
+ const decrypted = JSON.parse(this.DecodeIframeData(res.data.result).replace(/\\/g, ''));
118
95
  const data: ISource = {
119
96
  sources: decrypted.sources.map((s: { file: string }) => ({
120
97
  url: s.file,
@@ -1,6 +1,6 @@
1
1
  import { VideoExtractor, type IVideo, type ISubtitle, type Intro } from '../models';
2
2
  import { USER_AGENT } from '../utils';
3
- import Consumet from '../NativeConsumet';
3
+ import { getSources } from '../NativeConsumet';
4
4
 
5
5
  class VidCloud extends VideoExtractor {
6
6
  protected override serverName = 'VidCloud';
@@ -26,7 +26,7 @@ class VidCloud extends VideoExtractor {
26
26
 
27
27
  const regex = /\/([^\/?]+)(?=\?)/;
28
28
  const xrax = videoUrl.toString().match(regex)?.[1];
29
- const jsonResponse = await Consumet.getSources(xrax!);
29
+ const jsonResponse = await getSources(videoUrl.href, referer);
30
30
  const res = JSON.parse(jsonResponse);
31
31
  const sources = res.sources;
32
32
 
package/src/index.tsx CHANGED
@@ -1,138 +1,135 @@
1
- import 'react-native-url-polyfill/auto';
2
- import Consumet from './NativeConsumet';
3
-
4
- export const { getSources, bypassDdosGuard, getDdosGuardCookiesWithWebView, makeGetRequestWithWebView } = Consumet;
5
-
6
- import { ANIME, COMICS, LIGHT_NOVELS, MANGA, MOVIES, META, NEWS } from './providers';
7
- import { PROVIDERS_LIST } from './utils/providers-list';
8
- import {
9
- AsianLoad,
10
- BilibiliExtractor,
11
- Filemoon,
12
- GogoCDN,
13
- Kwik,
14
- MixDrop,
15
- Mp4Upload,
16
- RapidCloud,
17
- SmashyStream,
18
- StreamHub,
19
- StreamLare,
20
- StreamSB,
21
- StreamTape,
22
- StreamWish,
23
- VidCloud,
24
- VidMoly,
25
- VizCloud,
26
- Mp4Player,
27
- MegaCloud,
28
- VidHide,
29
- Voe,
30
- MegaUp,
31
- } from './extractors';
32
- import {
33
- type IProviderStats,
34
- type ISearch,
35
- type IAnimeEpisode,
36
- type IAnimeInfo,
37
- type IAnimeResult,
38
- type IEpisodeServer,
39
- type IVideo,
40
- type LibgenBook,
41
- StreamingServers,
42
- MediaStatus,
43
- SubOrSub,
44
- type IMangaResult,
45
- type IMangaChapter,
46
- type IMangaInfo,
47
- type ILightNovelResult,
48
- type ILightNovelInfo,
49
- type ILightNovelChapter,
50
- type ILightNovelChapterContent,
51
- type GetComicsComics,
52
- type ComicRes,
53
- type IMangaChapterPage,
54
- TvType,
55
- type IMovieEpisode,
56
- type IMovieInfo,
57
- type ISource,
58
- type ISubtitle,
59
- type IMovieResult,
60
- type Intro,
61
- Genres,
62
- type INewsFeed,
63
- Topics,
64
- type INewsInfo,
65
- type FuzzyDate,
66
- type ITitle,
67
- MediaFormat,
68
- type ProxyConfig,
69
- type AniZipEpisode,
70
- type IMovieSeason,
71
- } from './models';
72
-
73
- export { ANIME, COMICS, MANGA, LIGHT_NOVELS, MOVIES, META, NEWS };
74
- export { PROVIDERS_LIST };
75
- export {
76
- Topics,
77
- Genres,
78
- SubOrSub,
79
- StreamingServers,
80
- MediaStatus,
81
- TvType,
82
- MediaFormat,
83
- GogoCDN,
84
- StreamSB,
85
- VidCloud,
86
- MixDrop,
87
- Kwik,
88
- RapidCloud,
89
- StreamTape,
90
- StreamLare,
91
- StreamHub,
92
- SmashyStream,
93
- VizCloud,
94
- AsianLoad,
95
- BilibiliExtractor,
96
- Filemoon,
97
- Mp4Upload,
98
- StreamWish,
99
- VidMoly,
100
- MegaUp,
101
- Mp4Player,
102
- MegaCloud,
103
- VidHide,
104
- Voe,
105
- };
106
- export type {
107
- IProviderStats,
108
- IAnimeEpisode,
109
- IAnimeInfo,
110
- IAnimeResult,
111
- IEpisodeServer,
112
- IVideo,
113
- LibgenBook,
114
- IMangaResult,
115
- IMangaChapter,
116
- IMangaInfo,
117
- ILightNovelResult,
118
- ILightNovelInfo,
119
- ILightNovelChapter,
120
- ILightNovelChapterContent,
121
- GetComicsComics,
122
- ComicRes,
123
- ISearch,
124
- IMangaChapterPage,
125
- IMovieEpisode,
126
- IMovieInfo,
127
- ISource,
128
- ISubtitle,
129
- IMovieResult,
130
- Intro,
131
- INewsFeed,
132
- INewsInfo,
133
- FuzzyDate,
134
- ITitle,
135
- ProxyConfig,
136
- AniZipEpisode,
137
- IMovieSeason,
138
- };
1
+ import 'react-native-url-polyfill/auto';
2
+
3
+ import { ANIME, COMICS, LIGHT_NOVELS, MANGA, MOVIES, META, NEWS } from './providers';
4
+ import { PROVIDERS_LIST } from './utils/providers-list';
5
+ import {
6
+ AsianLoad,
7
+ BilibiliExtractor,
8
+ Filemoon,
9
+ GogoCDN,
10
+ Kwik,
11
+ MixDrop,
12
+ Mp4Upload,
13
+ RapidCloud,
14
+ SmashyStream,
15
+ StreamHub,
16
+ StreamLare,
17
+ StreamSB,
18
+ StreamTape,
19
+ StreamWish,
20
+ VidCloud,
21
+ VidMoly,
22
+ VizCloud,
23
+ Mp4Player,
24
+ MegaCloud,
25
+ VidHide,
26
+ Voe,
27
+ MegaUp,
28
+ } from './extractors';
29
+ import {
30
+ type IProviderStats,
31
+ type ISearch,
32
+ type IAnimeEpisode,
33
+ type IAnimeInfo,
34
+ type IAnimeResult,
35
+ type IEpisodeServer,
36
+ type IVideo,
37
+ type LibgenBook,
38
+ StreamingServers,
39
+ MediaStatus,
40
+ SubOrSub,
41
+ type IMangaResult,
42
+ type IMangaChapter,
43
+ type IMangaInfo,
44
+ type ILightNovelResult,
45
+ type ILightNovelInfo,
46
+ type ILightNovelChapter,
47
+ type ILightNovelChapterContent,
48
+ type GetComicsComics,
49
+ type ComicRes,
50
+ type IMangaChapterPage,
51
+ TvType,
52
+ type IMovieEpisode,
53
+ type IMovieInfo,
54
+ type ISource,
55
+ type ISubtitle,
56
+ type IMovieResult,
57
+ type Intro,
58
+ Genres,
59
+ type INewsFeed,
60
+ Topics,
61
+ type INewsInfo,
62
+ type FuzzyDate,
63
+ type ITitle,
64
+ MediaFormat,
65
+ type ProxyConfig,
66
+ type AniZipEpisode,
67
+ type IMovieSeason,
68
+ } from './models';
69
+
70
+ export { ANIME, COMICS, MANGA, LIGHT_NOVELS, MOVIES, META, NEWS };
71
+ export { PROVIDERS_LIST };
72
+ export {
73
+ Topics,
74
+ Genres,
75
+ SubOrSub,
76
+ StreamingServers,
77
+ MediaStatus,
78
+ TvType,
79
+ MediaFormat,
80
+ GogoCDN,
81
+ StreamSB,
82
+ VidCloud,
83
+ MixDrop,
84
+ Kwik,
85
+ RapidCloud,
86
+ StreamTape,
87
+ StreamLare,
88
+ StreamHub,
89
+ SmashyStream,
90
+ VizCloud,
91
+ AsianLoad,
92
+ BilibiliExtractor,
93
+ Filemoon,
94
+ Mp4Upload,
95
+ StreamWish,
96
+ VidMoly,
97
+ MegaUp,
98
+ Mp4Player,
99
+ MegaCloud,
100
+ VidHide,
101
+ Voe,
102
+ };
103
+ export type {
104
+ IProviderStats,
105
+ IAnimeEpisode,
106
+ IAnimeInfo,
107
+ IAnimeResult,
108
+ IEpisodeServer,
109
+ IVideo,
110
+ LibgenBook,
111
+ IMangaResult,
112
+ IMangaChapter,
113
+ IMangaInfo,
114
+ ILightNovelResult,
115
+ ILightNovelInfo,
116
+ ILightNovelChapter,
117
+ ILightNovelChapterContent,
118
+ GetComicsComics,
119
+ ComicRes,
120
+ ISearch,
121
+ IMangaChapterPage,
122
+ IMovieEpisode,
123
+ IMovieInfo,
124
+ ISource,
125
+ ISubtitle,
126
+ IMovieResult,
127
+ Intro,
128
+ INewsFeed,
129
+ INewsInfo,
130
+ FuzzyDate,
131
+ ITitle,
132
+ ProxyConfig,
133
+ AniZipEpisode,
134
+ IMovieSeason,
135
+ };
@@ -212,6 +212,7 @@ export enum StreamingServers {
212
212
  VidMoly = 'vidmoly',
213
213
  Voe = 'voe',
214
214
  MegaUp = 'megaup',
215
+ MegaCloud = 'megacloud',
215
216
  }
216
217
 
217
218
  export enum MediaStatus {
@@ -17,7 +17,7 @@ import {
17
17
  import { MegaUp } from '../../utils';
18
18
  import axios from 'axios';
19
19
 
20
- const { GenerateToken, DecodeIframeData } = new MegaUp();
20
+ const { GenerateToken, DecodeIframeData, Decode } = new MegaUp();
21
21
 
22
22
  class AnimeKai extends AnimeParser {
23
23
  override readonly name = 'AnimeKai';
@@ -576,7 +576,7 @@ class AnimeKai extends AnimeParser {
576
576
  const { data } = await this.client.get(`${this.baseUrl}/ajax/links/view?id=${id}&_=${GenerateToken(id!)}`, {
577
577
  headers: this.Headers(),
578
578
  });
579
- const decodedData = JSON.parse(DecodeIframeData(data.result));
579
+ const decodedData = JSON.parse(Decode(data.result));
580
580
  servers.push({
581
581
  name: `MegaUp ${$(server).text().trim()}`!, //megaup is the only server for now
582
582
  url: decodedData.url,
@@ -13,7 +13,7 @@ import {
13
13
  SubOrSub,
14
14
  } from '../../models';
15
15
  import { Kwik } from '../../extractors';
16
- import { bypassDdosGuard, getDdosGuardCookiesWithWebView } from 'react-native-consumet';
16
+ import { bypassDdosGuard, getDdosGuardCookiesWithWebView } from '../../NativeConsumet';
17
17
 
18
18
  class AnimePahe extends AnimeParser {
19
19
  override readonly name = 'AnimePahe';