react-native-consumet 1.0.0-rc.0 → 1.0.0-rc.2
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/generated/java/com/consumet/NativeConsumetSpec.java +4 -0
- package/android/generated/jni/RNConsumetSpec-generated.cpp +6 -0
- package/android/generated/jni/react/renderer/components/RNConsumetSpec/RNConsumetSpecJSI-generated.cpp +8 -0
- package/android/generated/jni/react/renderer/components/RNConsumetSpec/RNConsumetSpecJSI.h +9 -0
- package/android/src/main/java/com/consumet/ConsumetModule.kt +7 -0
- package/android/src/main/java/com/consumet/DdosGuardModule.kt +248 -189
- package/ios/generated/RNConsumetSpec/RNConsumetSpec-generated.mm +7 -0
- package/ios/generated/RNConsumetSpec/RNConsumetSpec.h +2 -0
- package/ios/generated/RNConsumetSpecJSI-generated.cpp +8 -0
- package/ios/generated/RNConsumetSpecJSI.h +9 -0
- package/lib/commonjs/NativeConsumet.ts +28 -26
- package/lib/commonjs/extension-registry.json +13 -13
- package/lib/commonjs/extractors/filemoon.js +2 -2
- package/lib/commonjs/extractors/kwik.js +60 -15
- package/lib/commonjs/extractors/kwik.js.map +1 -1
- package/lib/commonjs/extractors/megacloud.js +6 -6
- package/lib/commonjs/index.js +2 -11
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/types.js +4 -4
- package/lib/commonjs/models/video-extractor.js +4 -4
- package/lib/commonjs/providers/anime/animedrive.js +12 -12
- package/lib/commonjs/providers/anime/animekai.js +41 -41
- package/lib/commonjs/providers/anime/animepahe/animepahe.js +16 -15
- package/lib/commonjs/providers/anime/animepahe/animepahe.js.map +1 -1
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js +12 -9
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/commonjs/providers/anime/animesuge/animesuge.js +78 -0
- package/lib/commonjs/providers/anime/animesuge/animesuge.js.map +1 -0
- package/lib/commonjs/providers/anime/animesuge/create-animesuge.js +312 -0
- package/lib/commonjs/providers/anime/animesuge/create-animesuge.js.map +1 -0
- package/lib/commonjs/providers/anime/animeunity.js +13 -13
- package/lib/commonjs/providers/anime/index.js +4 -4
- package/lib/commonjs/providers/anime/index.js.map +1 -1
- package/lib/commonjs/providers/anime/marin.js +12 -12
- package/lib/commonjs/providers/anime/zoro/create-zoro.js +2 -2
- package/lib/commonjs/providers/anime/zoro/create-zoro.js.map +1 -1
- package/lib/commonjs/providers/anime/zoro/zoro.js +76 -74
- package/lib/commonjs/providers/anime/zoro/zoro.js.map +1 -1
- package/lib/commonjs/providers/manga/brmangas.js +3 -3
- package/lib/commonjs/providers/meta/anilist.js +91 -91
- package/lib/commonjs/providers/meta/mal.js +12 -12
- package/lib/commonjs/providers/meta/tmdb.js +21 -21
- package/lib/commonjs/providers/movies/himovies/create-himovies.js +16 -16
- package/lib/commonjs/providers/movies/himovies/himovies.js +16 -16
- package/lib/commonjs/providers/movies/multimovies.js +15 -15
- package/lib/commonjs/providers/movies/multistream/index.js +21 -20
- package/lib/commonjs/providers/movies/multistream/index.js.map +1 -1
- package/lib/commonjs/providers/movies/multistream/utils.js +142 -130
- package/lib/commonjs/providers/movies/multistream/utils.js.map +1 -1
- package/lib/commonjs/utils/ExtractorManager.js +15 -15
- package/lib/commonjs/utils/ExtractorManager.js.map +1 -1
- package/lib/commonjs/utils/ProviderManager.js +2 -1
- package/lib/commonjs/utils/ProviderManager.js.map +1 -1
- package/lib/commonjs/utils/create-extractor-context.js +9 -1
- package/lib/commonjs/utils/create-extractor-context.js.map +1 -1
- package/lib/commonjs/utils/create-provider-context.js +6 -2
- package/lib/commonjs/utils/create-provider-context.js.map +1 -1
- package/lib/commonjs/utils/extension-utils.js +44 -54
- package/lib/commonjs/utils/extension-utils.js.map +1 -1
- package/lib/commonjs/utils/index.js +2 -2
- package/lib/commonjs/utils/provider-maps.js +31 -0
- package/lib/commonjs/utils/provider-maps.js.map +1 -0
- package/lib/commonjs/utils/providers-list.js +4 -4
- package/lib/commonjs/utils/url-polyfill.js +4 -4
- package/lib/module/NativeConsumet.ts +28 -26
- package/lib/module/extension-registry.json +13 -13
- package/lib/module/extractors/filemoon.js +2 -2
- package/lib/module/extractors/kwik.js +60 -15
- package/lib/module/extractors/kwik.js.map +1 -1
- package/lib/module/extractors/megacloud.js +6 -6
- package/lib/module/index.js +3 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/types.js +4 -4
- package/lib/module/models/video-extractor.js +4 -4
- package/lib/module/providers/anime/animedrive.js +12 -12
- package/lib/module/providers/anime/animekai.js +41 -41
- package/lib/module/providers/anime/animepahe/animepahe.js +14 -14
- package/lib/module/providers/anime/animepahe/animepahe.js.map +1 -1
- package/lib/module/providers/anime/animepahe/create-animepahe.js +13 -9
- package/lib/module/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/module/providers/anime/animesuge/animesuge.js +73 -0
- package/lib/module/providers/anime/animesuge/animesuge.js.map +1 -0
- package/lib/module/providers/anime/animesuge/create-animesuge.js +309 -0
- package/lib/module/providers/anime/animesuge/create-animesuge.js.map +1 -0
- package/lib/module/providers/anime/animeunity.js +13 -13
- package/lib/module/providers/anime/index.js +2 -2
- package/lib/module/providers/anime/index.js.map +1 -1
- package/lib/module/providers/anime/marin.js +12 -12
- package/lib/module/providers/anime/zoro/create-zoro.js +3 -2
- package/lib/module/providers/anime/zoro/create-zoro.js.map +1 -1
- package/lib/module/providers/anime/zoro/zoro.js +74 -73
- package/lib/module/providers/anime/zoro/zoro.js.map +1 -1
- package/lib/module/providers/manga/brmangas.js +3 -3
- package/lib/module/providers/meta/anilist.js +91 -91
- package/lib/module/providers/meta/mal.js +12 -12
- package/lib/module/providers/meta/tmdb.js +21 -21
- package/lib/module/providers/movies/himovies/create-himovies.js +16 -16
- package/lib/module/providers/movies/himovies/himovies.js +16 -16
- package/lib/module/providers/movies/multimovies.js +15 -15
- package/lib/module/providers/movies/multistream/index.js +21 -20
- package/lib/module/providers/movies/multistream/index.js.map +1 -1
- package/lib/module/providers/movies/multistream/utils.js +141 -129
- package/lib/module/providers/movies/multistream/utils.js.map +1 -1
- package/lib/module/utils/ExtractorManager.js +16 -16
- package/lib/module/utils/ExtractorManager.js.map +1 -1
- package/lib/module/utils/ProviderManager.js +2 -1
- package/lib/module/utils/ProviderManager.js.map +1 -1
- package/lib/module/utils/create-extractor-context.js +10 -1
- package/lib/module/utils/create-extractor-context.js.map +1 -1
- package/lib/module/utils/create-provider-context.js +8 -4
- package/lib/module/utils/create-provider-context.js.map +1 -1
- package/lib/module/utils/extension-utils.js +23 -33
- package/lib/module/utils/extension-utils.js.map +1 -1
- package/lib/module/utils/index.js +1 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/provider-maps.js +27 -0
- package/lib/module/utils/provider-maps.js.map +1 -0
- package/lib/module/utils/providers-list.js +4 -4
- package/lib/module/utils/url-polyfill.js +4 -4
- package/lib/typescript/commonjs/src/NativeConsumet.d.ts +2 -0
- package/lib/typescript/commonjs/src/NativeConsumet.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/kwik.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +6 -6
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/extractor-context.d.ts +8 -0
- package/lib/typescript/commonjs/src/models/extractor-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/index.d.ts +2 -2
- package/lib/typescript/commonjs/src/models/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/provider-context.d.ts +6 -2
- package/lib/typescript/commonjs/src/models/provider-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/animepahe/animepahe.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/animepahe/create-animepahe.d.ts +1 -1
- package/lib/typescript/commonjs/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/animesuge/animesuge.d.ts +34 -0
- package/lib/typescript/commonjs/src/providers/anime/animesuge/animesuge.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/anime/animesuge/create-animesuge.d.ts +14 -0
- package/lib/typescript/commonjs/src/providers/anime/animesuge/create-animesuge.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/anime/index.d.ts +2 -2
- package/lib/typescript/commonjs/src/providers/anime/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/zoro/create-zoro.d.ts +1 -1
- package/lib/typescript/commonjs/src/providers/anime/zoro/create-zoro.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/zoro/zoro.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/multistream/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/providers/movies/multistream/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/multistream/utils.d.ts +2 -2
- package/lib/typescript/commonjs/src/providers/movies/multistream/utils.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts +1 -1
- package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/create-extractor-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/create-provider-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/extension-utils.d.ts +1 -20
- package/lib/typescript/commonjs/src/utils/extension-utils.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/index.d.ts +2 -1
- package/lib/typescript/commonjs/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/provider-maps.d.ts +27 -0
- package/lib/typescript/commonjs/src/utils/provider-maps.d.ts.map +1 -0
- package/lib/typescript/module/src/NativeConsumet.d.ts +2 -0
- package/lib/typescript/module/src/NativeConsumet.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/kwik.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +6 -6
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/models/extractor-context.d.ts +8 -0
- package/lib/typescript/module/src/models/extractor-context.d.ts.map +1 -1
- package/lib/typescript/module/src/models/index.d.ts +2 -2
- package/lib/typescript/module/src/models/index.d.ts.map +1 -1
- package/lib/typescript/module/src/models/provider-context.d.ts +6 -2
- package/lib/typescript/module/src/models/provider-context.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/animepahe/animepahe.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/animepahe/create-animepahe.d.ts +1 -1
- package/lib/typescript/module/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/animesuge/animesuge.d.ts +34 -0
- package/lib/typescript/module/src/providers/anime/animesuge/animesuge.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/anime/animesuge/create-animesuge.d.ts +14 -0
- package/lib/typescript/module/src/providers/anime/animesuge/create-animesuge.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/anime/index.d.ts +2 -2
- package/lib/typescript/module/src/providers/anime/index.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/zoro/create-zoro.d.ts +1 -1
- package/lib/typescript/module/src/providers/anime/zoro/create-zoro.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/zoro/zoro.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/multistream/index.d.ts +1 -1
- package/lib/typescript/module/src/providers/movies/multistream/index.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/multistream/utils.d.ts +2 -2
- package/lib/typescript/module/src/providers/movies/multistream/utils.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/ProviderManager.d.ts +1 -1
- package/lib/typescript/module/src/utils/ProviderManager.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/create-extractor-context.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/create-provider-context.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/extension-utils.d.ts +1 -20
- package/lib/typescript/module/src/utils/extension-utils.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/index.d.ts +2 -1
- package/lib/typescript/module/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/provider-maps.d.ts +27 -0
- package/lib/typescript/module/src/utils/provider-maps.d.ts.map +1 -0
- package/package.json +6 -2
- package/src/NativeConsumet.ts +2 -0
- package/src/extension-registry.json +81 -81
- package/src/extractors/StreamP2P.ts +60 -60
- package/src/extractors/filemoon.ts +58 -58
- package/src/extractors/index.ts +41 -41
- package/src/extractors/kwik.ts +113 -50
- package/src/extractors/megacloud.ts +163 -163
- package/src/extractors/mixdrop.ts +31 -31
- package/src/extractors/mp4upload.ts +31 -31
- package/src/extractors/streamhub.ts +58 -58
- package/src/extractors/streamwish.ts +120 -120
- package/src/extractors/vidhide.ts +59 -59
- package/src/index.tsx +176 -175
- package/src/models/extension-manifest.ts +77 -77
- package/src/models/extractor-context.ts +55 -41
- package/src/models/index.ts +107 -106
- package/src/models/provider-context.ts +192 -182
- package/src/models/types.ts +531 -531
- package/src/models/video-extractor.ts +48 -48
- package/src/providers/anime/animedrive.ts +245 -245
- package/src/providers/anime/animekai.ts +627 -627
- package/src/providers/anime/animepahe/animepahe.ts +76 -76
- package/src/providers/anime/animepahe/create-animepahe.ts +350 -348
- package/src/providers/anime/animesuge/animesuge.ts +77 -0
- package/src/providers/anime/animesuge/create-animesuge.ts +327 -0
- package/src/providers/anime/animeunity.ts +216 -216
- package/src/providers/anime/index.ts +21 -21
- package/src/providers/anime/marin.ts +319 -319
- package/src/providers/anime/zoro/create-zoro.ts +656 -655
- package/src/providers/anime/zoro/zoro.ts +198 -197
- package/src/providers/index.ts +7 -7
- package/src/providers/manga/brmangas.ts +144 -144
- package/src/providers/meta/anilist.ts +2108 -2108
- package/src/providers/meta/mal.ts +635 -635
- package/src/providers/meta/tmdb.ts +470 -470
- package/src/providers/movies/himovies/create-himovies.ts +529 -529
- package/src/providers/movies/himovies/himovies.ts +90 -90
- package/src/providers/movies/index.ts +15 -15
- package/src/providers/movies/multimovies.ts +495 -495
- package/src/providers/movies/multistream/index.ts +232 -231
- package/src/providers/movies/multistream/utils.ts +147 -270
- package/src/utils/ExtractorManager.ts +311 -311
- package/src/utils/ProviderManager.ts +423 -424
- package/src/utils/create-extractor-context.ts +36 -22
- package/src/utils/create-provider-context.ts +117 -107
- package/src/utils/extension-utils.ts +105 -114
- package/src/utils/index.ts +96 -95
- package/src/utils/provider-maps.ts +31 -0
- package/src/utils/providers-list.ts +27 -27
- package/src/utils/url-polyfill.ts +642 -642
- package/src/utils/utils.ts +374 -374
|
@@ -1,163 +1,163 @@
|
|
|
1
|
-
import { type ExtractorContext, type IVideo, type ISource, type IVideoExtractor } from '../models';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* MegaCloud extractor function
|
|
5
|
-
* @param ctx ExtractorContext containing axios, load, USER_AGENT
|
|
6
|
-
* @returns Object with extract method implementing IVideoExtractor interface
|
|
7
|
-
*/
|
|
8
|
-
export function MegaCloud(ctx: ExtractorContext): IVideoExtractor {
|
|
9
|
-
const serverName = 'MegaCloud';
|
|
10
|
-
const sources: IVideo[] = [];
|
|
11
|
-
const { axios, load, USER_AGENT, PolyURL } = ctx;
|
|
12
|
-
/**
|
|
13
|
-
* Thanks to https://github.com/yogesh-hacker for the original implementation.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
async function getSources(embed_url: URL, site: string) {
|
|
17
|
-
const regex = /\/([^/?]+)(?=\?)/;
|
|
18
|
-
const xrax = embed_url.toString().match(regex)?.[1];
|
|
19
|
-
const basePath = embed_url.pathname.split('/').slice(0, 4).join('/');
|
|
20
|
-
|
|
21
|
-
const url = `${embed_url.origin}${basePath}/getSources?id=${xrax}}`;
|
|
22
|
-
const getKeyType = url.includes('mega') ? 'mega' : url.includes('videostr') ? 'vidstr' : 'rabbit';
|
|
23
|
-
// console.log(`🔗 Fetching sources from: ${url} with key type: ${getKeyType}`);
|
|
24
|
-
//gets the base64 encoded string from the URL and key in parallel
|
|
25
|
-
let key;
|
|
26
|
-
|
|
27
|
-
const headers = {
|
|
28
|
-
'Accept': '*/*',
|
|
29
|
-
'X-Requested-With': 'XMLHttpRequest',
|
|
30
|
-
'Referer': site,
|
|
31
|
-
'User-Agent': USER_AGENT,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
try {
|
|
35
|
-
const { data: keyData } = await axios?.get(
|
|
36
|
-
'https://raw.githubusercontent.com/yogesh-hacker/MegacloudKeys/refs/heads/main/keys.json'
|
|
37
|
-
);
|
|
38
|
-
key = keyData;
|
|
39
|
-
} catch (err) {
|
|
40
|
-
console.error('❌ Error fetching key:', err);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
// console.log(`🔗 Fetched data: ${key[getKeyType]}`);
|
|
44
|
-
let videoTag;
|
|
45
|
-
let embedRes;
|
|
46
|
-
try {
|
|
47
|
-
embedRes = await axios?.get(embed_url.href, { headers });
|
|
48
|
-
const $ = load(embedRes.data);
|
|
49
|
-
videoTag = $('#megacloud-player');
|
|
50
|
-
} catch (error) {
|
|
51
|
-
console.error('❌ Error fetching embed URL:', error);
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (!videoTag.length) {
|
|
56
|
-
console.error('❌ Looks like URL expired!');
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const rawText = embedRes.data;
|
|
61
|
-
|
|
62
|
-
let nonceMatch = rawText.match(/\b[a-zA-Z0-9]{48}\b/);
|
|
63
|
-
if (!nonceMatch) {
|
|
64
|
-
const altMatch = rawText.match(/\b([a-zA-Z0-9]{16})\b.*?\b([a-zA-Z0-9]{16})\b.*?\b([a-zA-Z0-9]{16})\b/);
|
|
65
|
-
if (altMatch) nonceMatch = [altMatch.slice(1).join('')];
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const nonce = nonceMatch?.[0];
|
|
69
|
-
if (!nonce) return console.error('❌ Nonce not found!');
|
|
70
|
-
const fileId = videoTag.attr('data-id');
|
|
71
|
-
|
|
72
|
-
const { data: encryptedResData } = await axios.get(
|
|
73
|
-
`${embed_url.origin}${basePath}/getSources?id=${fileId}&_k=${nonce}`,
|
|
74
|
-
{
|
|
75
|
-
headers,
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
// console.log(
|
|
79
|
-
// `🔗 Encrypted response:`,
|
|
80
|
-
// encryptedResData,
|
|
81
|
-
// `${embed_url.origin}${basePath}/getSources?id=${xrax}&_k=${nonce}`
|
|
82
|
-
// );
|
|
83
|
-
const encrypted = encryptedResData.encrypted;
|
|
84
|
-
const sources = encryptedResData.sources;
|
|
85
|
-
let videoSrc = [];
|
|
86
|
-
|
|
87
|
-
if (encrypted) {
|
|
88
|
-
const decodeUrl =
|
|
89
|
-
'https://script.google.com/macros/s/AKfycbxHbYHbrGMXYD2-bC-C43D3njIbU-wGiYQuJL61H4vyy6YVXkybMNNEPJNPPuZrD1gRVA/exec';
|
|
90
|
-
|
|
91
|
-
const params = new URLSearchParams({
|
|
92
|
-
encrypted_data: sources,
|
|
93
|
-
nonce: nonce,
|
|
94
|
-
secret: key[getKeyType],
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
const decodeRes = await axios.get(`${decodeUrl}?${params.toString()}`);
|
|
98
|
-
videoSrc = JSON.parse(decodeRes.data.replace(/\n/g, ' ').match(/\\\[.*?\\\\]/)?.[0]);
|
|
99
|
-
// console.log(`🔗 Video URL: ${videoUrl}`, decodeRes.data.match(/"file":"(.*?)"/));
|
|
100
|
-
} else {
|
|
101
|
-
videoSrc = sources;
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
sources: videoSrc,
|
|
105
|
-
tracks: encryptedResData.tracks,
|
|
106
|
-
intro: encryptedResData?.intro,
|
|
107
|
-
outro: encryptedResData?.outro,
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
// @ts-ignore
|
|
111
|
-
const extract = async (embedIframeURL: PolyURL, referer = 'https://hianime.to'): Promise<ISource> => {
|
|
112
|
-
const extractedData: ISource = {
|
|
113
|
-
subtitles: [],
|
|
114
|
-
intro: { start: 0, end: 0 },
|
|
115
|
-
outro: { start: 0, end: 0 },
|
|
116
|
-
sources: [],
|
|
117
|
-
};
|
|
118
|
-
// console.log(ctx);
|
|
119
|
-
try {
|
|
120
|
-
const resp = await getSources(embedIframeURL, referer);
|
|
121
|
-
|
|
122
|
-
if (!resp) return extractedData;
|
|
123
|
-
|
|
124
|
-
if (Array.isArray(resp.sources)) {
|
|
125
|
-
extractedData.sources = resp.sources.map((s: { file: any; type: string }) => ({
|
|
126
|
-
url: s.file,
|
|
127
|
-
isM3U8: s.type === 'hls',
|
|
128
|
-
type: s.type,
|
|
129
|
-
}));
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
extractedData.intro = resp.intro ? resp.intro : extractedData.intro;
|
|
133
|
-
extractedData.outro = resp.outro ? resp.outro : extractedData.outro;
|
|
134
|
-
|
|
135
|
-
extractedData.subtitles = resp.tracks.map((track: { file: any; label: any; kind: any }) => ({
|
|
136
|
-
url: track.file,
|
|
137
|
-
lang: track.label ? track.label : track.kind,
|
|
138
|
-
}));
|
|
139
|
-
|
|
140
|
-
extractedData.intro = resp.intro ?? extractedData.intro;
|
|
141
|
-
extractedData.outro = resp.outro ?? extractedData.outro;
|
|
142
|
-
|
|
143
|
-
extractedData.subtitles =
|
|
144
|
-
resp.tracks?.map((track: { file: string; label?: string; kind: string }) => ({
|
|
145
|
-
url: track.file,
|
|
146
|
-
lang: track.label || track.kind,
|
|
147
|
-
})) ?? [];
|
|
148
|
-
|
|
149
|
-
// console.log(`[MegaCloud] Extracted ${extractedData.sources.length} source(s)`);
|
|
150
|
-
|
|
151
|
-
return extractedData;
|
|
152
|
-
} catch (err) {
|
|
153
|
-
// console.error('[MegaCloud] Extraction error', err);
|
|
154
|
-
throw err;
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
return {
|
|
159
|
-
serverName,
|
|
160
|
-
sources,
|
|
161
|
-
extract,
|
|
162
|
-
};
|
|
163
|
-
}
|
|
1
|
+
import { type ExtractorContext, type IVideo, type ISource, type IVideoExtractor } from '../models';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* MegaCloud extractor function
|
|
5
|
+
* @param ctx ExtractorContext containing axios, load, USER_AGENT
|
|
6
|
+
* @returns Object with extract method implementing IVideoExtractor interface
|
|
7
|
+
*/
|
|
8
|
+
export function MegaCloud(ctx: ExtractorContext): IVideoExtractor {
|
|
9
|
+
const serverName = 'MegaCloud';
|
|
10
|
+
const sources: IVideo[] = [];
|
|
11
|
+
const { axios, load, USER_AGENT, PolyURL } = ctx;
|
|
12
|
+
/**
|
|
13
|
+
* Thanks to https://github.com/yogesh-hacker for the original implementation.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
async function getSources(embed_url: URL, site: string) {
|
|
17
|
+
const regex = /\/([^/?]+)(?=\?)/;
|
|
18
|
+
const xrax = embed_url.toString().match(regex)?.[1];
|
|
19
|
+
const basePath = embed_url.pathname.split('/').slice(0, 4).join('/');
|
|
20
|
+
|
|
21
|
+
const url = `${embed_url.origin}${basePath}/getSources?id=${xrax}}`;
|
|
22
|
+
const getKeyType = url.includes('mega') ? 'mega' : url.includes('videostr') ? 'vidstr' : 'rabbit';
|
|
23
|
+
// console.log(`🔗 Fetching sources from: ${url} with key type: ${getKeyType}`);
|
|
24
|
+
//gets the base64 encoded string from the URL and key in parallel
|
|
25
|
+
let key;
|
|
26
|
+
|
|
27
|
+
const headers = {
|
|
28
|
+
'Accept': '*/*',
|
|
29
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
30
|
+
'Referer': site,
|
|
31
|
+
'User-Agent': USER_AGENT,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
const { data: keyData } = await axios?.get(
|
|
36
|
+
'https://raw.githubusercontent.com/yogesh-hacker/MegacloudKeys/refs/heads/main/keys.json'
|
|
37
|
+
);
|
|
38
|
+
key = keyData;
|
|
39
|
+
} catch (err) {
|
|
40
|
+
console.error('❌ Error fetching key:', err);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
// console.log(`🔗 Fetched data: ${key[getKeyType]}`);
|
|
44
|
+
let videoTag;
|
|
45
|
+
let embedRes;
|
|
46
|
+
try {
|
|
47
|
+
embedRes = await axios?.get(embed_url.href, { headers });
|
|
48
|
+
const $ = load(embedRes.data);
|
|
49
|
+
videoTag = $('#megacloud-player');
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error('❌ Error fetching embed URL:', error);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (!videoTag.length) {
|
|
56
|
+
console.error('❌ Looks like URL expired!');
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const rawText = embedRes.data;
|
|
61
|
+
|
|
62
|
+
let nonceMatch = rawText.match(/\b[a-zA-Z0-9]{48}\b/);
|
|
63
|
+
if (!nonceMatch) {
|
|
64
|
+
const altMatch = rawText.match(/\b([a-zA-Z0-9]{16})\b.*?\b([a-zA-Z0-9]{16})\b.*?\b([a-zA-Z0-9]{16})\b/);
|
|
65
|
+
if (altMatch) nonceMatch = [altMatch.slice(1).join('')];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const nonce = nonceMatch?.[0];
|
|
69
|
+
if (!nonce) return console.error('❌ Nonce not found!');
|
|
70
|
+
const fileId = videoTag.attr('data-id');
|
|
71
|
+
|
|
72
|
+
const { data: encryptedResData } = await axios.get(
|
|
73
|
+
`${embed_url.origin}${basePath}/getSources?id=${fileId}&_k=${nonce}`,
|
|
74
|
+
{
|
|
75
|
+
headers,
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
// console.log(
|
|
79
|
+
// `🔗 Encrypted response:`,
|
|
80
|
+
// encryptedResData,
|
|
81
|
+
// `${embed_url.origin}${basePath}/getSources?id=${xrax}&_k=${nonce}`
|
|
82
|
+
// );
|
|
83
|
+
const encrypted = encryptedResData.encrypted;
|
|
84
|
+
const sources = encryptedResData.sources;
|
|
85
|
+
let videoSrc = [];
|
|
86
|
+
|
|
87
|
+
if (encrypted) {
|
|
88
|
+
const decodeUrl =
|
|
89
|
+
'https://script.google.com/macros/s/AKfycbxHbYHbrGMXYD2-bC-C43D3njIbU-wGiYQuJL61H4vyy6YVXkybMNNEPJNPPuZrD1gRVA/exec';
|
|
90
|
+
|
|
91
|
+
const params = new URLSearchParams({
|
|
92
|
+
encrypted_data: sources,
|
|
93
|
+
nonce: nonce,
|
|
94
|
+
secret: key[getKeyType],
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const decodeRes = await axios.get(`${decodeUrl}?${params.toString()}`);
|
|
98
|
+
videoSrc = JSON.parse(decodeRes.data.replace(/\n/g, ' ').match(/\\\[.*?\\\\]/)?.[0]);
|
|
99
|
+
// console.log(`🔗 Video URL: ${videoUrl}`, decodeRes.data.match(/"file":"(.*?)"/));
|
|
100
|
+
} else {
|
|
101
|
+
videoSrc = sources;
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
sources: videoSrc,
|
|
105
|
+
tracks: encryptedResData.tracks,
|
|
106
|
+
intro: encryptedResData?.intro,
|
|
107
|
+
outro: encryptedResData?.outro,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
// @ts-ignore
|
|
111
|
+
const extract = async (embedIframeURL: PolyURL, referer = 'https://hianime.to'): Promise<ISource> => {
|
|
112
|
+
const extractedData: ISource = {
|
|
113
|
+
subtitles: [],
|
|
114
|
+
intro: { start: 0, end: 0 },
|
|
115
|
+
outro: { start: 0, end: 0 },
|
|
116
|
+
sources: [],
|
|
117
|
+
};
|
|
118
|
+
// console.log(ctx);
|
|
119
|
+
try {
|
|
120
|
+
const resp = await getSources(embedIframeURL, referer);
|
|
121
|
+
|
|
122
|
+
if (!resp) return extractedData;
|
|
123
|
+
|
|
124
|
+
if (Array.isArray(resp.sources)) {
|
|
125
|
+
extractedData.sources = resp.sources.map((s: { file: any; type: string }) => ({
|
|
126
|
+
url: s.file,
|
|
127
|
+
isM3U8: s.type === 'hls',
|
|
128
|
+
type: s.type,
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
extractedData.intro = resp.intro ? resp.intro : extractedData.intro;
|
|
133
|
+
extractedData.outro = resp.outro ? resp.outro : extractedData.outro;
|
|
134
|
+
|
|
135
|
+
extractedData.subtitles = resp.tracks.map((track: { file: any; label: any; kind: any }) => ({
|
|
136
|
+
url: track.file,
|
|
137
|
+
lang: track.label ? track.label : track.kind,
|
|
138
|
+
}));
|
|
139
|
+
|
|
140
|
+
extractedData.intro = resp.intro ?? extractedData.intro;
|
|
141
|
+
extractedData.outro = resp.outro ?? extractedData.outro;
|
|
142
|
+
|
|
143
|
+
extractedData.subtitles =
|
|
144
|
+
resp.tracks?.map((track: { file: string; label?: string; kind: string }) => ({
|
|
145
|
+
url: track.file,
|
|
146
|
+
lang: track.label || track.kind,
|
|
147
|
+
})) ?? [];
|
|
148
|
+
|
|
149
|
+
// console.log(`[MegaCloud] Extracted ${extractedData.sources.length} source(s)`);
|
|
150
|
+
|
|
151
|
+
return extractedData;
|
|
152
|
+
} catch (err) {
|
|
153
|
+
// console.error('[MegaCloud] Extraction error', err);
|
|
154
|
+
throw err;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
return {
|
|
159
|
+
serverName,
|
|
160
|
+
sources,
|
|
161
|
+
extract,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { VideoExtractor, type IVideo } from '../models';
|
|
3
|
-
|
|
4
|
-
class MixDrop extends VideoExtractor {
|
|
5
|
-
protected override serverName = 'MixDrop';
|
|
6
|
-
protected override sources: IVideo[] = [];
|
|
7
|
-
|
|
8
|
-
override extract = async (videoUrl: URL): Promise<IVideo[]> => {
|
|
9
|
-
try {
|
|
10
|
-
const { data } = await axios.get(videoUrl.href);
|
|
11
|
-
|
|
12
|
-
const formated = eval(/(eval)(\(f.*?)(\n<\/script>)/m.exec(data.replace(/\n/g, ' '))![2]!.replace('eval', ''));
|
|
13
|
-
|
|
14
|
-
const [poster, source] = formated
|
|
15
|
-
.match(/poster="([^"]+)"|wurl="([^"]+)"/g)
|
|
16
|
-
.map((x: string) => x.split(`="`)[1]!.replace(/"/g, ''))
|
|
17
|
-
.map((x: string) => (x.startsWith('http') ? x : `https:${x}`));
|
|
18
|
-
|
|
19
|
-
this.sources.push({
|
|
20
|
-
url: source,
|
|
21
|
-
isM3U8: source.includes('.m3u8'),
|
|
22
|
-
poster: poster,
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
return this.sources;
|
|
26
|
-
} catch (err) {
|
|
27
|
-
throw new Error((err as Error).message);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
export default MixDrop;
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { VideoExtractor, type IVideo } from '../models';
|
|
3
|
+
|
|
4
|
+
class MixDrop extends VideoExtractor {
|
|
5
|
+
protected override serverName = 'MixDrop';
|
|
6
|
+
protected override sources: IVideo[] = [];
|
|
7
|
+
|
|
8
|
+
override extract = async (videoUrl: URL): Promise<IVideo[]> => {
|
|
9
|
+
try {
|
|
10
|
+
const { data } = await axios.get(videoUrl.href);
|
|
11
|
+
|
|
12
|
+
const formated = eval(/(eval)(\(f.*?)(\n<\/script>)/m.exec(data.replace(/\n/g, ' '))![2]!.replace('eval', ''));
|
|
13
|
+
|
|
14
|
+
const [poster, source] = formated
|
|
15
|
+
.match(/poster="([^"]+)"|wurl="([^"]+)"/g)
|
|
16
|
+
.map((x: string) => x.split(`="`)[1]!.replace(/"/g, ''))
|
|
17
|
+
.map((x: string) => (x.startsWith('http') ? x : `https:${x}`));
|
|
18
|
+
|
|
19
|
+
this.sources.push({
|
|
20
|
+
url: source,
|
|
21
|
+
isM3U8: source.includes('.m3u8'),
|
|
22
|
+
poster: poster,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return this.sources;
|
|
26
|
+
} catch (err) {
|
|
27
|
+
throw new Error((err as Error).message);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export default MixDrop;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { VideoExtractor, type IVideo } from '../models';
|
|
3
|
-
|
|
4
|
-
class Mp4Upload extends VideoExtractor {
|
|
5
|
-
protected override serverName = 'mp4upload';
|
|
6
|
-
protected override sources: IVideo[] = [];
|
|
7
|
-
|
|
8
|
-
override extract = async (videoUrl: URL): Promise<IVideo[]> => {
|
|
9
|
-
try {
|
|
10
|
-
const { data } = await axios.get(videoUrl.href);
|
|
11
|
-
|
|
12
|
-
const playerSrc = data
|
|
13
|
-
.replace(/\n/g, ' ')
|
|
14
|
-
.match(/player\.src\(\s*{\s*type:\s*"[^"]+",\s*src:\s*"([^"]+)"\s*}\s*\);/);
|
|
15
|
-
const streamUrl = playerSrc[1];
|
|
16
|
-
|
|
17
|
-
if (!streamUrl) throw new Error('Stream url not found');
|
|
18
|
-
|
|
19
|
-
this.sources.push({
|
|
20
|
-
quality: 'auto',
|
|
21
|
-
url: streamUrl,
|
|
22
|
-
isM3U8: streamUrl.includes('.m3u8'),
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
return this.sources;
|
|
26
|
-
} catch (err) {
|
|
27
|
-
throw new Error((err as Error).message);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
export default Mp4Upload;
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { VideoExtractor, type IVideo } from '../models';
|
|
3
|
+
|
|
4
|
+
class Mp4Upload extends VideoExtractor {
|
|
5
|
+
protected override serverName = 'mp4upload';
|
|
6
|
+
protected override sources: IVideo[] = [];
|
|
7
|
+
|
|
8
|
+
override extract = async (videoUrl: URL): Promise<IVideo[]> => {
|
|
9
|
+
try {
|
|
10
|
+
const { data } = await axios.get(videoUrl.href);
|
|
11
|
+
|
|
12
|
+
const playerSrc = data
|
|
13
|
+
.replace(/\n/g, ' ')
|
|
14
|
+
.match(/player\.src\(\s*{\s*type:\s*"[^"]+",\s*src:\s*"([^"]+)"\s*}\s*\);/);
|
|
15
|
+
const streamUrl = playerSrc[1];
|
|
16
|
+
|
|
17
|
+
if (!streamUrl) throw new Error('Stream url not found');
|
|
18
|
+
|
|
19
|
+
this.sources.push({
|
|
20
|
+
quality: 'auto',
|
|
21
|
+
url: streamUrl,
|
|
22
|
+
isM3U8: streamUrl.includes('.m3u8'),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return this.sources;
|
|
26
|
+
} catch (err) {
|
|
27
|
+
throw new Error((err as Error).message);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export default Mp4Upload;
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { VideoExtractor, type IVideo, type ISubtitle } from '../models';
|
|
3
|
-
|
|
4
|
-
class StreamHub extends VideoExtractor {
|
|
5
|
-
protected override serverName = 'StreamHub';
|
|
6
|
-
protected override sources: IVideo[] = [];
|
|
7
|
-
|
|
8
|
-
override extract = async (videoUrl: URL): Promise<{ sources: IVideo[] } & { subtitles: ISubtitle[] }> => {
|
|
9
|
-
try {
|
|
10
|
-
const result: { sources: IVideo[]; subtitles: ISubtitle[] } = {
|
|
11
|
-
sources: [],
|
|
12
|
-
subtitles: [],
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const { data } = await axios.get(videoUrl.href).catch(() => {
|
|
16
|
-
throw new Error('Video not found');
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const unpackedData = eval(
|
|
20
|
-
/(eval)(\(f.*?)(\n<\/script>)/m.exec(data.replace(/\n/g, ' '))![2]!.replace('eval', '')
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
const links = unpackedData.match(new RegExp('sources:\\[\\{src:"(.*?)"')) ?? [];
|
|
24
|
-
const m3u8Content = await axios.get(links[1], {
|
|
25
|
-
headers: {
|
|
26
|
-
Referer: links[1],
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
result.sources.push({
|
|
31
|
-
quality: 'auto',
|
|
32
|
-
url: links[1],
|
|
33
|
-
isM3U8: links[1].includes('.m3u8'),
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
if (m3u8Content.data.includes('EXTM3U')) {
|
|
37
|
-
const videoList = m3u8Content.data.split('#EXT-X-STREAM-INF:');
|
|
38
|
-
for (const video of videoList ?? []) {
|
|
39
|
-
if (!video.includes('m3u8')) continue;
|
|
40
|
-
|
|
41
|
-
const url = video.split('\n')[1];
|
|
42
|
-
const quality = video.split('RESOLUTION=')[1].split(',')[0].split('x')[1];
|
|
43
|
-
|
|
44
|
-
result.sources.push({
|
|
45
|
-
url: url,
|
|
46
|
-
quality: `${quality}p`,
|
|
47
|
-
isM3U8: url.includes('.m3u8'),
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return result;
|
|
53
|
-
} catch (err) {
|
|
54
|
-
throw new Error((err as Error).message);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
export default StreamHub;
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { VideoExtractor, type IVideo, type ISubtitle } from '../models';
|
|
3
|
+
|
|
4
|
+
class StreamHub extends VideoExtractor {
|
|
5
|
+
protected override serverName = 'StreamHub';
|
|
6
|
+
protected override sources: IVideo[] = [];
|
|
7
|
+
|
|
8
|
+
override extract = async (videoUrl: URL): Promise<{ sources: IVideo[] } & { subtitles: ISubtitle[] }> => {
|
|
9
|
+
try {
|
|
10
|
+
const result: { sources: IVideo[]; subtitles: ISubtitle[] } = {
|
|
11
|
+
sources: [],
|
|
12
|
+
subtitles: [],
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const { data } = await axios.get(videoUrl.href).catch(() => {
|
|
16
|
+
throw new Error('Video not found');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const unpackedData = eval(
|
|
20
|
+
/(eval)(\(f.*?)(\n<\/script>)/m.exec(data.replace(/\n/g, ' '))![2]!.replace('eval', '')
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const links = unpackedData.match(new RegExp('sources:\\[\\{src:"(.*?)"')) ?? [];
|
|
24
|
+
const m3u8Content = await axios.get(links[1], {
|
|
25
|
+
headers: {
|
|
26
|
+
Referer: links[1],
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
result.sources.push({
|
|
31
|
+
quality: 'auto',
|
|
32
|
+
url: links[1],
|
|
33
|
+
isM3U8: links[1].includes('.m3u8'),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
if (m3u8Content.data.includes('EXTM3U')) {
|
|
37
|
+
const videoList = m3u8Content.data.split('#EXT-X-STREAM-INF:');
|
|
38
|
+
for (const video of videoList ?? []) {
|
|
39
|
+
if (!video.includes('m3u8')) continue;
|
|
40
|
+
|
|
41
|
+
const url = video.split('\n')[1];
|
|
42
|
+
const quality = video.split('RESOLUTION=')[1].split(',')[0].split('x')[1];
|
|
43
|
+
|
|
44
|
+
result.sources.push({
|
|
45
|
+
url: url,
|
|
46
|
+
quality: `${quality}p`,
|
|
47
|
+
isM3U8: url.includes('.m3u8'),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return result;
|
|
53
|
+
} catch (err) {
|
|
54
|
+
throw new Error((err as Error).message);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export default StreamHub;
|