react-native-consumet 0.7.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Consumet.podspec +26 -26
- package/LICENSE +673 -673
- package/README.md +49 -49
- package/android/build.gradle +106 -106
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +4 -4
- package/android/src/main/AndroidManifestNew.xml +3 -3
- package/android/src/main/java/com/consumet/ConsumetModule.kt +49 -49
- package/android/src/main/java/com/consumet/ConsumetPackage.kt +33 -33
- package/ios/Consumet.h +6 -6
- package/ios/Consumet.mm +18 -18
- package/lib/commonjs/extractors/luffy.js +2 -1
- package/lib/commonjs/extractors/luffy.js.map +1 -1
- package/lib/commonjs/extractors/megacloud/index.js +12 -27
- package/lib/commonjs/extractors/megacloud/index.js.map +1 -1
- package/lib/commonjs/extractors/megacloud/megacloud.getsrcs.js +99 -0
- package/lib/commonjs/extractors/megacloud/megacloud.getsrcs.js.map +1 -0
- package/lib/commonjs/extractors/vidcloud.js +39 -48
- package/lib/commonjs/extractors/vidcloud.js.map +1 -1
- package/lib/commonjs/extractors/voe.js.map +1 -1
- package/lib/commonjs/models/types.js +1 -0
- package/lib/commonjs/models/types.js.map +1 -1
- package/lib/commonjs/providers/anime/animeowl.js +55 -53
- package/lib/commonjs/providers/anime/animeowl.js.map +1 -1
- package/lib/commonjs/providers/meta/anilist.js +22 -7
- package/lib/commonjs/providers/meta/anilist.js.map +1 -1
- package/lib/commonjs/providers/meta/tmdb.js +1 -1
- package/lib/commonjs/providers/meta/tmdb.js.map +1 -1
- package/lib/commonjs/providers/movies/himovies.js +16 -16
- package/lib/commonjs/providers/movies/index.js +3 -1
- package/lib/commonjs/providers/movies/index.js.map +1 -1
- package/lib/commonjs/providers/movies/multimovies.js +2 -2
- package/lib/commonjs/providers/movies/multimovies.js.map +1 -1
- package/lib/commonjs/providers/movies/multistream/index.js +208 -0
- package/lib/commonjs/providers/movies/multistream/index.js.map +1 -0
- package/lib/commonjs/providers/movies/multistream/utils.js +267 -0
- package/lib/commonjs/providers/movies/multistream/utils.js.map +1 -0
- package/lib/commonjs/providers/movies/netflixmirror.js +2 -2
- package/lib/commonjs/providers/movies/netflixmirror.js.map +1 -1
- package/lib/commonjs/utils/utils.js +58 -34
- package/lib/commonjs/utils/utils.js.map +1 -1
- package/lib/module/extractors/luffy.js +2 -1
- package/lib/module/extractors/luffy.js.map +1 -1
- package/lib/module/extractors/megacloud/index.js +12 -26
- package/lib/module/extractors/megacloud/index.js.map +1 -1
- package/lib/module/extractors/megacloud/megacloud.getsrcs.js +95 -0
- package/lib/module/extractors/megacloud/megacloud.getsrcs.js.map +1 -0
- package/lib/module/extractors/vidcloud.js +38 -47
- package/lib/module/extractors/vidcloud.js.map +1 -1
- package/lib/module/extractors/voe.js.map +1 -1
- package/lib/module/models/types.js +1 -0
- package/lib/module/models/types.js.map +1 -1
- package/lib/module/providers/anime/animeowl.js +56 -53
- package/lib/module/providers/anime/animeowl.js.map +1 -1
- package/lib/module/providers/meta/anilist.js +22 -7
- package/lib/module/providers/meta/anilist.js.map +1 -1
- package/lib/module/providers/meta/tmdb.js +1 -1
- package/lib/module/providers/meta/tmdb.js.map +1 -1
- package/lib/module/providers/movies/himovies.js +16 -16
- package/lib/module/providers/movies/index.js +3 -1
- package/lib/module/providers/movies/index.js.map +1 -1
- package/lib/module/providers/movies/multimovies.js +2 -2
- package/lib/module/providers/movies/multimovies.js.map +1 -1
- package/lib/module/providers/movies/multistream/index.js +205 -0
- package/lib/module/providers/movies/multistream/index.js.map +1 -0
- package/lib/module/providers/movies/multistream/utils.js +259 -0
- package/lib/module/providers/movies/multistream/utils.js.map +1 -0
- package/lib/module/providers/movies/netflixmirror.js +2 -2
- package/lib/module/providers/movies/netflixmirror.js.map +1 -1
- package/lib/module/utils/utils.js +55 -30
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/typescript/commonjs/src/extractors/luffy.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/megacloud/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/megacloud/megacloud.getsrcs.d.ts +10 -0
- package/lib/typescript/commonjs/src/extractors/megacloud/megacloud.getsrcs.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/extractors/vidcloud.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/types.d.ts +2 -1
- package/lib/typescript/commonjs/src/models/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/animeowl.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/meta/anilist.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/meta/tmdb.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/index.d.ts +2 -0
- package/lib/typescript/commonjs/src/providers/movies/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/multimovies.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/multistream/index.d.ts +37 -0
- package/lib/typescript/commonjs/src/providers/movies/multistream/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/movies/multistream/utils.d.ts +10 -0
- package/lib/typescript/commonjs/src/providers/movies/multistream/utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/movies/netflixmirror.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/utils.d.ts +8 -8
- package/lib/typescript/commonjs/src/utils/utils.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/luffy.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/megacloud/index.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/megacloud/megacloud.getsrcs.d.ts +10 -0
- package/lib/typescript/module/src/extractors/megacloud/megacloud.getsrcs.d.ts.map +1 -0
- package/lib/typescript/module/src/extractors/vidcloud.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +1 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/models/types.d.ts +2 -1
- package/lib/typescript/module/src/models/types.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/animeowl.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/meta/anilist.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/meta/tmdb.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/index.d.ts +2 -0
- package/lib/typescript/module/src/providers/movies/index.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/multimovies.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/multistream/index.d.ts +37 -0
- package/lib/typescript/module/src/providers/movies/multistream/index.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/movies/multistream/utils.d.ts +10 -0
- package/lib/typescript/module/src/providers/movies/multistream/utils.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/movies/netflixmirror.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/index.d.ts +1 -1
- package/lib/typescript/module/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/utils.d.ts +8 -8
- package/lib/typescript/module/src/utils/utils.d.ts.map +1 -1
- package/package.json +3 -2
- package/react-native.config.js +12 -12
- package/src/extractors/luffy.ts +33 -32
- package/src/extractors/megacloud/index.ts +14 -27
- package/src/extractors/megacloud/megacloud.getsrcs.ts +104 -0
- package/src/extractors/vidcloud.ts +39 -49
- package/src/extractors/voe.ts +3 -3
- package/src/index.tsx +137 -137
- package/src/models/types.ts +1 -0
- package/src/providers/anime/animeowl.ts +565 -564
- package/src/providers/meta/anilist.ts +20 -7
- package/src/providers/meta/tmdb.ts +1 -2
- package/src/providers/movies/himovies.ts +495 -495
- package/src/providers/movies/index.ts +2 -0
- package/src/providers/movies/multimovies.ts +3 -3
- package/src/providers/movies/multistream/index.ts +232 -0
- package/src/providers/movies/multistream/utils.ts +393 -0
- package/src/providers/movies/netflixmirror.ts +2 -2
- package/src/utils/index.ts +2 -2
- package/src/utils/utils.ts +66 -31
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-consumet",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.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",
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
"!**/.*"
|
|
42
42
|
],
|
|
43
43
|
"scripts": {
|
|
44
|
-
"example": "yarn workspace react-native-consumet-bare-example",
|
|
44
|
+
"bare-example": "yarn workspace react-native-consumet-bare-example",
|
|
45
|
+
"expo-example": "yarn workspace react-native-consumet-expo-example",
|
|
45
46
|
"test": "jest",
|
|
46
47
|
"typecheck": "tsc",
|
|
47
48
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
package/react-native.config.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @type {import('@react-native-community/cli-types').UserDependencyConfig}
|
|
3
|
-
*/
|
|
4
|
-
module.exports = {
|
|
5
|
-
dependency: {
|
|
6
|
-
platforms: {
|
|
7
|
-
android: {
|
|
8
|
-
cmakeListsPath: 'generated/jni/CMakeLists.txt',
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* @type {import('@react-native-community/cli-types').UserDependencyConfig}
|
|
3
|
+
*/
|
|
4
|
+
module.exports = {
|
|
5
|
+
dependency: {
|
|
6
|
+
platforms: {
|
|
7
|
+
android: {
|
|
8
|
+
cmakeListsPath: 'generated/jni/CMakeLists.txt',
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
package/src/extractors/luffy.ts
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import { VideoExtractor, type IVideo } from '../models';
|
|
2
|
-
import { deobfuscateScript } from '../NativeConsumet';
|
|
3
|
-
|
|
4
|
-
class Luffy extends VideoExtractor {
|
|
5
|
-
protected override serverName = 'luffy';
|
|
6
|
-
protected override sources: IVideo[] = [];
|
|
7
|
-
|
|
8
|
-
private readonly host = 'https://animeowl.me';
|
|
9
|
-
|
|
10
|
-
override extract = async (videoUrl: URL): Promise<IVideo[]> => {
|
|
11
|
-
try {
|
|
12
|
-
const { data: server } = await this.client.get(videoUrl.href!);
|
|
13
|
-
const jwtRegex = /([A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+)/;
|
|
14
|
-
const { data: script } = await this.client.get(`${this.host}/players/${videoUrl.href!.split('/').pop()}.v2.js`);
|
|
15
|
-
const c = await deobfuscateScript(script);
|
|
16
|
-
|
|
17
|
-
const jwt = c ? jwtRegex.exec(c!)![0] : '';
|
|
18
|
-
server.luffy?.map((item: any) => {
|
|
19
|
-
this.sources.push({
|
|
20
|
-
quality: item.url.match(/[?&]resolution=([^&]+)/)?.[1],
|
|
21
|
-
url: item.url + jwt,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
1
|
+
import { VideoExtractor, type IVideo } from '../models';
|
|
2
|
+
import { deobfuscateScript } from '../NativeConsumet';
|
|
3
|
+
|
|
4
|
+
class Luffy extends VideoExtractor {
|
|
5
|
+
protected override serverName = 'luffy';
|
|
6
|
+
protected override sources: IVideo[] = [];
|
|
7
|
+
|
|
8
|
+
private readonly host = 'https://animeowl.me';
|
|
9
|
+
|
|
10
|
+
override extract = async (videoUrl: URL): Promise<IVideo[]> => {
|
|
11
|
+
try {
|
|
12
|
+
const { data: server } = await this.client.get(videoUrl.href!);
|
|
13
|
+
const jwtRegex = /([A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+)/;
|
|
14
|
+
const { data: script } = await this.client.get(`${this.host}/players/${videoUrl.href!.split('/').pop()}.v2.js`);
|
|
15
|
+
const c = await deobfuscateScript(script);
|
|
16
|
+
|
|
17
|
+
const jwt = c ? jwtRegex.exec(c!)![0] : '';
|
|
18
|
+
server.luffy?.map((item: any) => {
|
|
19
|
+
this.sources.push({
|
|
20
|
+
quality: item.url.match(/[?&]resolution=([^&]+)/)?.[1],
|
|
21
|
+
url: item.url + jwt,
|
|
22
|
+
isM3U8: item.url.includes('.m3u8'),
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return this.sources ?? ([] as IVideo[]);
|
|
27
|
+
} catch (err) {
|
|
28
|
+
console.log(err);
|
|
29
|
+
throw new Error((err as Error).message);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export default Luffy;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type ISource, type IVideo, VideoExtractor } from '../../models';
|
|
2
|
-
import
|
|
3
|
-
import { USER_AGENT } from '../../utils';
|
|
2
|
+
import { getSources } from './megacloud.getsrcs';
|
|
4
3
|
|
|
5
4
|
class MegaCloud extends VideoExtractor {
|
|
6
5
|
protected override serverName = 'MegaCloud';
|
|
@@ -20,41 +19,29 @@ class MegaCloud extends VideoExtractor {
|
|
|
20
19
|
},
|
|
21
20
|
sources: [],
|
|
22
21
|
};
|
|
23
|
-
const
|
|
24
|
-
const xrax = embedIframeURL.toString().match(regex)?.[1];
|
|
25
|
-
const basePath = embedIframeURL.pathname.split('/').slice(0, 4).join('/');
|
|
26
|
-
const url = `${embedIframeURL.origin}${basePath}/getSources?id=${xrax}`;
|
|
27
|
-
|
|
28
|
-
const getKeyType = url.includes('mega') ? 'mega' : url.includes('videostr') ? 'vidstr' : 'rabbit';
|
|
29
|
-
//gets the base64 encoded string from the URL and key in parallel
|
|
30
|
-
const [{ data }, { data: key }] = await Promise.all([
|
|
31
|
-
this.client.get(url, {
|
|
32
|
-
headers: {
|
|
33
|
-
'User-Agent': USER_AGENT,
|
|
34
|
-
'Referer': referer,
|
|
35
|
-
'X-Requested-With': 'XMLHttpRequest',
|
|
36
|
-
},
|
|
37
|
-
}),
|
|
38
|
-
this.client.get('https://raw.githubusercontent.com/yogesh-hacker/MegacloudKeys/refs/heads/main/keys.json'),
|
|
39
|
-
]);
|
|
40
|
-
|
|
41
|
-
const sources = CryptoJS.AES.decrypt(data.sources, key[getKeyType]).toString(CryptoJS.enc.Utf8);
|
|
42
|
-
const resp = JSON.parse(sources);
|
|
22
|
+
const resp = await getSources(embedIframeURL, referer);
|
|
43
23
|
|
|
44
24
|
if (!resp) return extractedData;
|
|
45
25
|
|
|
46
|
-
if (Array.isArray(resp)) {
|
|
47
|
-
extractedData.sources = resp.map((s: { file: any; type: string }) => ({
|
|
26
|
+
if (Array.isArray(resp.sources)) {
|
|
27
|
+
extractedData.sources = resp.sources.map((s: { file: any; type: string }) => ({
|
|
48
28
|
url: s.file,
|
|
49
29
|
isM3U8: s.type === 'hls',
|
|
50
30
|
type: s.type,
|
|
51
31
|
}));
|
|
32
|
+
} else {
|
|
33
|
+
extractedData.sources = [
|
|
34
|
+
{
|
|
35
|
+
url: resp.sources,
|
|
36
|
+
isM3U8: resp.sources.includes('.m3u8'),
|
|
37
|
+
},
|
|
38
|
+
];
|
|
52
39
|
}
|
|
53
40
|
|
|
54
|
-
extractedData.intro =
|
|
55
|
-
extractedData.outro =
|
|
41
|
+
extractedData.intro = resp.intro ? resp.intro : extractedData.intro;
|
|
42
|
+
extractedData.outro = resp.outro ? resp.outro : extractedData.outro;
|
|
56
43
|
|
|
57
|
-
extractedData.subtitles =
|
|
44
|
+
extractedData.subtitles = resp.tracks.map((track: { file: any; label: any; kind: any }) => ({
|
|
58
45
|
url: track.file,
|
|
59
46
|
lang: track.label ? track.label : track.kind,
|
|
60
47
|
}));
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import CryptoJS from 'crypto-js';
|
|
2
|
+
import { USER_AGENT } from '../../utils/utils';
|
|
3
|
+
import axios from 'axios';
|
|
4
|
+
import { load } from 'cheerio';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Thanks to https://github.com/yogesh-hacker for the original implementation.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export async function getSources(embed_url: URL, site: string) {
|
|
11
|
+
const regex = /\/([^\/?]+)(?=\?)/;
|
|
12
|
+
const xrax = embed_url.toString().match(regex)?.[1];
|
|
13
|
+
const basePath = embed_url.pathname.split('/').slice(0, 4).join('/');
|
|
14
|
+
|
|
15
|
+
const url = `${embed_url.origin}${basePath}/getSources?id=${xrax}}`;
|
|
16
|
+
const getKeyType = url.includes('mega') ? 'mega' : url.includes('videostr') ? 'vidstr' : 'rabbit';
|
|
17
|
+
// console.log(`🔗 Fetching sources from: ${url} with key type: ${getKeyType}`);
|
|
18
|
+
//gets the base64 encoded string from the URL and key in parallel
|
|
19
|
+
let key;
|
|
20
|
+
|
|
21
|
+
const headers = {
|
|
22
|
+
'Accept': '*/*',
|
|
23
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
24
|
+
'Referer': site,
|
|
25
|
+
'User-Agent': USER_AGENT,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const { data: keyData } = await axios.get(
|
|
30
|
+
'https://raw.githubusercontent.com/yogesh-hacker/MegacloudKeys/refs/heads/main/keys.json'
|
|
31
|
+
);
|
|
32
|
+
key = keyData;
|
|
33
|
+
} catch (err) {
|
|
34
|
+
console.error('❌ Error fetching key:', err);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
// console.log(`🔗 Fetched data: ${key[getKeyType]}`);
|
|
38
|
+
let videoTag;
|
|
39
|
+
let embedRes;
|
|
40
|
+
try {
|
|
41
|
+
embedRes = await axios.get(embed_url.href, { headers });
|
|
42
|
+
const $ = load(embedRes.data);
|
|
43
|
+
videoTag = $('#megacloud-player');
|
|
44
|
+
} catch (error) {
|
|
45
|
+
console.error('❌ Error fetching embed URL:', error);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (!videoTag.length) {
|
|
50
|
+
console.error('❌ Looks like URL expired!');
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const rawText = embedRes.data;
|
|
55
|
+
|
|
56
|
+
let nonceMatch = rawText.match(/\b[a-zA-Z0-9]{48}\b/);
|
|
57
|
+
if (!nonceMatch) {
|
|
58
|
+
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/);
|
|
59
|
+
if (altMatch) nonceMatch = [altMatch.slice(1).join('')];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const nonce = nonceMatch?.[0];
|
|
63
|
+
if (!nonce) return console.error('❌ Nonce not found!');
|
|
64
|
+
const fileId = videoTag.attr('data-id');
|
|
65
|
+
|
|
66
|
+
const { data: encryptedResData } = await axios.get(
|
|
67
|
+
`${embed_url.origin}${basePath}/getSources?id=${fileId}&_k=${nonce}`,
|
|
68
|
+
{
|
|
69
|
+
headers,
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
// console.log(
|
|
73
|
+
// `🔗 Encrypted response:`,
|
|
74
|
+
// encryptedResData,
|
|
75
|
+
// `${embed_url.origin}${basePath}/getSources?id=${xrax}&_k=${nonce}`
|
|
76
|
+
// );
|
|
77
|
+
const encrypted = encryptedResData.encrypted;
|
|
78
|
+
const sources = encryptedResData.sources;
|
|
79
|
+
let videoUrl = '';
|
|
80
|
+
|
|
81
|
+
if (encrypted) {
|
|
82
|
+
const decodeUrl =
|
|
83
|
+
'https://script.google.com/macros/s/AKfycbx-yHTwupis_JD0lNzoOnxYcEYeXmJZrg7JeMxYnEZnLBy5V0--UxEvP-y9txHyy1TX9Q/exec';
|
|
84
|
+
|
|
85
|
+
const params = new URLSearchParams({
|
|
86
|
+
encrypted_data: sources,
|
|
87
|
+
nonce: nonce,
|
|
88
|
+
secret: key[getKeyType],
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const decodeRes = await axios.get(`${decodeUrl}?${params.toString()}`);
|
|
92
|
+
videoUrl = decodeRes.data.match(/"file":"(.*?)"/)?.[1]?.replace(/\\\//g, '/') || '';
|
|
93
|
+
// console.log(`🔗 Video URL: ${videoUrl}`, decodeRes.data.match(/"file":"(.*?)"/));
|
|
94
|
+
} else {
|
|
95
|
+
videoUrl = sources[0]?.file;
|
|
96
|
+
// console.log(`🔗 Video URL: ${videoUrl}`, sources);
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
sources: videoUrl,
|
|
100
|
+
tracks: encryptedResData.tracks,
|
|
101
|
+
intro: encryptedResData?.intro,
|
|
102
|
+
outro: encryptedResData?.outro,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
import { VideoExtractor, type IVideo, type ISubtitle, type Intro } from '../models';
|
|
2
3
|
import { USER_AGENT } from '../utils';
|
|
3
|
-
import
|
|
4
|
+
import { getSources } from './megacloud/megacloud.getsrcs';
|
|
4
5
|
|
|
5
6
|
class VidCloud extends VideoExtractor {
|
|
6
7
|
protected override serverName = 'VidCloud';
|
|
@@ -24,63 +25,52 @@ class VidCloud extends VideoExtractor {
|
|
|
24
25
|
},
|
|
25
26
|
};
|
|
26
27
|
|
|
27
|
-
const
|
|
28
|
-
const xrax = videoUrl.toString().match(regex)?.[1];
|
|
29
|
-
const basePath = videoUrl.pathname.split('/').slice(0, 4).join('/');
|
|
30
|
-
const url = `${videoUrl.origin}${basePath}/getSources?id=${xrax}`;
|
|
28
|
+
const resp = await getSources(videoUrl, referer);
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const [{ data }, { data: key }] = await Promise.all([
|
|
36
|
-
this.client.get(url, {
|
|
37
|
-
headers: {
|
|
38
|
-
'User-Agent': USER_AGENT,
|
|
39
|
-
'Referer': referer,
|
|
40
|
-
'X-Requested-With': 'XMLHttpRequest',
|
|
41
|
-
},
|
|
42
|
-
}),
|
|
43
|
-
this.client.get('https://raw.githubusercontent.com/yogesh-hacker/MegacloudKeys/refs/heads/main/keys.json'),
|
|
44
|
-
]);
|
|
45
|
-
|
|
46
|
-
const sources = CryptoJS.AES.decrypt(data.sources, key[getKeyType]).toString(CryptoJS.enc.Utf8);
|
|
47
|
-
const resp = JSON.parse(sources);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
for (const source of resp) {
|
|
51
|
-
const { data } = await this.client.get(source.file, options);
|
|
52
|
-
const urls = data
|
|
53
|
-
.split('\n')
|
|
54
|
-
.filter((line: string) => line.includes('.m3u8') || line.endsWith('m3u8')) as string[];
|
|
55
|
-
const qualities = data.split('\n').filter((line: string) => line.includes('RESOLUTION=')) as string[];
|
|
30
|
+
if (!resp) {
|
|
31
|
+
throw new Error('Failed to get sources from getSources function');
|
|
32
|
+
}
|
|
56
33
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
34
|
+
if (Array.isArray(resp.sources)) {
|
|
35
|
+
for (const source of resp.sources) {
|
|
36
|
+
const { data } = await this.client.get(source.file, options);
|
|
37
|
+
const urls = data
|
|
38
|
+
.split('\n')
|
|
39
|
+
.filter((line: string) => line.includes('.m3u8') || line.endsWith('m3u8')) as string[];
|
|
40
|
+
const qualities = data.split('\n').filter((line: string) => line.includes('RESOLUTION=')) as string[];
|
|
60
41
|
|
|
61
|
-
|
|
62
|
-
|
|
42
|
+
const TdArray = qualities.map((s, i) => {
|
|
43
|
+
const f1 = s.split('x')[1];
|
|
44
|
+
const f2 = urls[i];
|
|
63
45
|
|
|
64
|
-
|
|
65
|
-
this.sources.push({
|
|
66
|
-
url: f2!,
|
|
67
|
-
quality: f1,
|
|
68
|
-
isM3U8: f2!.includes('.m3u8') || f2!.endsWith('m3u8'),
|
|
46
|
+
return [f1, f2];
|
|
69
47
|
});
|
|
48
|
+
|
|
49
|
+
for (const [f1, f2] of TdArray) {
|
|
50
|
+
this.sources.push({
|
|
51
|
+
url: f2!,
|
|
52
|
+
quality: f1,
|
|
53
|
+
isM3U8: f2!.includes('.m3u8') || f2!.endsWith('m3u8'),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
result.sources.push(...this.sources);
|
|
70
57
|
}
|
|
71
|
-
result.sources.push(...this.sources);
|
|
72
58
|
}
|
|
73
59
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
60
|
+
if (resp.sources && typeof resp.sources === 'string') {
|
|
61
|
+
result.sources.push({
|
|
62
|
+
url: resp.sources,
|
|
63
|
+
isM3U8: resp.sources.includes('.m3u8') || resp.sources.endsWith('m3u8'),
|
|
64
|
+
quality: 'auto',
|
|
65
|
+
});
|
|
66
|
+
}
|
|
79
67
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
68
|
+
if (resp.tracks && Array.isArray(resp.tracks)) {
|
|
69
|
+
result.subtitles = resp.tracks.map((s: any) => ({
|
|
70
|
+
url: s.file,
|
|
71
|
+
lang: s.label ? s.label : 'Default (maybe)',
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
84
74
|
|
|
85
75
|
return result;
|
|
86
76
|
} catch (err) {
|
package/src/extractors/voe.ts
CHANGED
|
@@ -28,7 +28,7 @@ class Voe extends VideoExtractor {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
function rot13(input: string): string {
|
|
31
|
-
return input.replace(/[a-zA-Z]/g, c => {
|
|
31
|
+
return input.replace(/[a-zA-Z]/g, (c) => {
|
|
32
32
|
const base = c <= 'Z' ? 65 : 97;
|
|
33
33
|
return String.fromCharCode(((c.charCodeAt(0) - base + 13) % 26) + base);
|
|
34
34
|
});
|
|
@@ -49,7 +49,7 @@ class Voe extends VideoExtractor {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
function charShift(input: string, shift: number): string {
|
|
52
|
-
return [...input].map(c => String.fromCharCode(c.charCodeAt(0) - shift)).join('');
|
|
52
|
+
return [...input].map((c) => String.fromCharCode(c.charCodeAt(0) - shift)).join('');
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
function reverse(input: string): string {
|
|
@@ -69,7 +69,7 @@ class Voe extends VideoExtractor {
|
|
|
69
69
|
const $ = load(res.data);
|
|
70
70
|
const scriptContent = $('script').html();
|
|
71
71
|
const pageUrl = scriptContent
|
|
72
|
-
? scriptContent.match(/window\.location\.href\s*=\s*'(https:\/\/[^']+)';/)?.[1] ?? ''
|
|
72
|
+
? (scriptContent.match(/window\.location\.href\s*=\s*'(https:\/\/[^']+)';/)?.[1] ?? '')
|
|
73
73
|
: '';
|
|
74
74
|
|
|
75
75
|
const { data } = await this.client.get(pageUrl);
|