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,120 +1,120 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { VideoExtractor, type IVideo, type ISubtitle } from '../models';
|
|
3
|
-
import { USER_AGENT } from '../utils';
|
|
4
|
-
|
|
5
|
-
class StreamWish extends VideoExtractor {
|
|
6
|
-
protected override serverName = 'streamwish';
|
|
7
|
-
protected override sources: IVideo[] = [];
|
|
8
|
-
|
|
9
|
-
override extract = async (
|
|
10
|
-
videoUrl: URL,
|
|
11
|
-
referer?: string
|
|
12
|
-
): Promise<{ sources: IVideo[] } & { subtitles: ISubtitle[] }> => {
|
|
13
|
-
try {
|
|
14
|
-
const options = {
|
|
15
|
-
headers: {
|
|
16
|
-
'Accept':
|
|
17
|
-
'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
|
|
18
|
-
'Accept-Encoding': '*',
|
|
19
|
-
'Accept-Language': 'en-US,en;q=0.9',
|
|
20
|
-
'Cache-Control': 'max-age=0',
|
|
21
|
-
'Priority': 'u=0, i',
|
|
22
|
-
'Origin': videoUrl.origin,
|
|
23
|
-
'Referer': referer ?? videoUrl.origin,
|
|
24
|
-
'Sec-Ch-Ua': '"Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"',
|
|
25
|
-
'Sec-Ch-Ua-Mobile': '?0',
|
|
26
|
-
'Sec-Ch-Ua-Platform': 'Windows',
|
|
27
|
-
'Sec-Fetch-Dest': 'document',
|
|
28
|
-
'Sec-Fetch-Mode': 'navigate',
|
|
29
|
-
'Sec-Fetch-Site': 'none',
|
|
30
|
-
'Sec-Fetch-User': '?1',
|
|
31
|
-
'Upgrade-Insecure-Requests': '1',
|
|
32
|
-
'User-Agent': USER_AGENT,
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
const { data } = await axios.get(videoUrl.href, options);
|
|
36
|
-
|
|
37
|
-
// Code adapted from Zenda-Cross (https://github.com/Zenda-Cross/vega-app/blob/main/src/lib/providers/multi/multiGetStream.ts)
|
|
38
|
-
// Thank you to Zenda-Cross for the original implementation.
|
|
39
|
-
const functionRegex = /eval\(function\((.*?)\)\{.*?return p\}.*?\('(.*?)'\.split/;
|
|
40
|
-
const match = functionRegex.exec(data);
|
|
41
|
-
let p = '';
|
|
42
|
-
if (match) {
|
|
43
|
-
const params = match[1]?.split(',').map((param) => param.trim());
|
|
44
|
-
const encodedString = match[0];
|
|
45
|
-
|
|
46
|
-
p = encodedString.split("',36,")?.[0]?.trim()!;
|
|
47
|
-
const a = 36;
|
|
48
|
-
let c = encodedString.split("',36,")[1]?.slice(2).split('|').length!;
|
|
49
|
-
const k = encodedString.split("',36,")[1]?.slice(2).split('|')!;
|
|
50
|
-
while (c--) {
|
|
51
|
-
if (k[c]) {
|
|
52
|
-
const regex = new RegExp('\\b' + c.toString(a) + '\\b', 'g');
|
|
53
|
-
p = p.replace(regex, k[c]!);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// console.log('Decoded String:', p);
|
|
58
|
-
} else {
|
|
59
|
-
//console.log('No match found');
|
|
60
|
-
}
|
|
61
|
-
let link = p.match(/https?:\/\/[^"]+?\.m3u8[^"]*/)![0];
|
|
62
|
-
// console.log('Decoded Links:', link);
|
|
63
|
-
const subtitleMatches = p?.match(/{file:"([^"]+)",(label:"([^"]+)",)?kind:"(thumbnails|captions)"/g) ?? [];
|
|
64
|
-
// console.log(subtitleMatches, 'subtitleMatches');
|
|
65
|
-
const subtitles: ISubtitle[] = subtitleMatches.map((sub) => {
|
|
66
|
-
const lang = sub?.match(/label:"([^"]+)"/)?.[1] ?? '';
|
|
67
|
-
const url = sub?.match(/file:"([^"]+)"/)?.[1] ?? '';
|
|
68
|
-
const kind = sub?.match(/kind:"([^"]+)"/)?.[1] ?? '';
|
|
69
|
-
if (kind.includes('thumbnail')) {
|
|
70
|
-
return {
|
|
71
|
-
lang: kind,
|
|
72
|
-
url: `https://streamwish.com${url}`,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
return {
|
|
76
|
-
lang: lang,
|
|
77
|
-
url: url,
|
|
78
|
-
};
|
|
79
|
-
});
|
|
80
|
-
if (link.includes('hls2"')) {
|
|
81
|
-
link = link.replace('hls2"', '').replace(new RegExp('"', 'g'), '');
|
|
82
|
-
}
|
|
83
|
-
const linkParser = new URL(link);
|
|
84
|
-
linkParser.searchParams.set('i', '0.4');
|
|
85
|
-
this.sources.push({
|
|
86
|
-
quality: 'default',
|
|
87
|
-
url: linkParser.href,
|
|
88
|
-
isM3U8: link.includes('.m3u8'),
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
try {
|
|
92
|
-
const m3u8Content = await axios.get(this.sources[0]!.url, options);
|
|
93
|
-
|
|
94
|
-
if (m3u8Content.data.includes('EXTM3U')) {
|
|
95
|
-
const videoList = m3u8Content.data.split('#EXT-X-STREAM-INF:');
|
|
96
|
-
for (const video of videoList ?? []) {
|
|
97
|
-
if (!video.includes('m3u8')) continue;
|
|
98
|
-
|
|
99
|
-
const url = link.split('master.m3u8')[0] + video.split('\n')[1];
|
|
100
|
-
const quality = video.split('RESOLUTION=')[1].split(',')[0].split('x')[1];
|
|
101
|
-
|
|
102
|
-
this.sources.push({
|
|
103
|
-
url: url,
|
|
104
|
-
quality: `${quality}p`,
|
|
105
|
-
isM3U8: url.includes('.m3u8'),
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
} catch (e) {}
|
|
110
|
-
|
|
111
|
-
return {
|
|
112
|
-
sources: this.sources,
|
|
113
|
-
subtitles: subtitles,
|
|
114
|
-
};
|
|
115
|
-
} catch (err) {
|
|
116
|
-
throw new Error((err as Error).message);
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
export default StreamWish;
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { VideoExtractor, type IVideo, type ISubtitle } from '../models';
|
|
3
|
+
import { USER_AGENT } from '../utils';
|
|
4
|
+
|
|
5
|
+
class StreamWish extends VideoExtractor {
|
|
6
|
+
protected override serverName = 'streamwish';
|
|
7
|
+
protected override sources: IVideo[] = [];
|
|
8
|
+
|
|
9
|
+
override extract = async (
|
|
10
|
+
videoUrl: URL,
|
|
11
|
+
referer?: string
|
|
12
|
+
): Promise<{ sources: IVideo[] } & { subtitles: ISubtitle[] }> => {
|
|
13
|
+
try {
|
|
14
|
+
const options = {
|
|
15
|
+
headers: {
|
|
16
|
+
'Accept':
|
|
17
|
+
'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
|
|
18
|
+
'Accept-Encoding': '*',
|
|
19
|
+
'Accept-Language': 'en-US,en;q=0.9',
|
|
20
|
+
'Cache-Control': 'max-age=0',
|
|
21
|
+
'Priority': 'u=0, i',
|
|
22
|
+
'Origin': videoUrl.origin,
|
|
23
|
+
'Referer': referer ?? videoUrl.origin,
|
|
24
|
+
'Sec-Ch-Ua': '"Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"',
|
|
25
|
+
'Sec-Ch-Ua-Mobile': '?0',
|
|
26
|
+
'Sec-Ch-Ua-Platform': 'Windows',
|
|
27
|
+
'Sec-Fetch-Dest': 'document',
|
|
28
|
+
'Sec-Fetch-Mode': 'navigate',
|
|
29
|
+
'Sec-Fetch-Site': 'none',
|
|
30
|
+
'Sec-Fetch-User': '?1',
|
|
31
|
+
'Upgrade-Insecure-Requests': '1',
|
|
32
|
+
'User-Agent': USER_AGENT,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
const { data } = await axios.get(videoUrl.href, options);
|
|
36
|
+
|
|
37
|
+
// Code adapted from Zenda-Cross (https://github.com/Zenda-Cross/vega-app/blob/main/src/lib/providers/multi/multiGetStream.ts)
|
|
38
|
+
// Thank you to Zenda-Cross for the original implementation.
|
|
39
|
+
const functionRegex = /eval\(function\((.*?)\)\{.*?return p\}.*?\('(.*?)'\.split/;
|
|
40
|
+
const match = functionRegex.exec(data);
|
|
41
|
+
let p = '';
|
|
42
|
+
if (match) {
|
|
43
|
+
const params = match[1]?.split(',').map((param) => param.trim());
|
|
44
|
+
const encodedString = match[0];
|
|
45
|
+
|
|
46
|
+
p = encodedString.split("',36,")?.[0]?.trim()!;
|
|
47
|
+
const a = 36;
|
|
48
|
+
let c = encodedString.split("',36,")[1]?.slice(2).split('|').length!;
|
|
49
|
+
const k = encodedString.split("',36,")[1]?.slice(2).split('|')!;
|
|
50
|
+
while (c--) {
|
|
51
|
+
if (k[c]) {
|
|
52
|
+
const regex = new RegExp('\\b' + c.toString(a) + '\\b', 'g');
|
|
53
|
+
p = p.replace(regex, k[c]!);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// console.log('Decoded String:', p);
|
|
58
|
+
} else {
|
|
59
|
+
//console.log('No match found');
|
|
60
|
+
}
|
|
61
|
+
let link = p.match(/https?:\/\/[^"]+?\.m3u8[^"]*/)![0];
|
|
62
|
+
// console.log('Decoded Links:', link);
|
|
63
|
+
const subtitleMatches = p?.match(/{file:"([^"]+)",(label:"([^"]+)",)?kind:"(thumbnails|captions)"/g) ?? [];
|
|
64
|
+
// console.log(subtitleMatches, 'subtitleMatches');
|
|
65
|
+
const subtitles: ISubtitle[] = subtitleMatches.map((sub) => {
|
|
66
|
+
const lang = sub?.match(/label:"([^"]+)"/)?.[1] ?? '';
|
|
67
|
+
const url = sub?.match(/file:"([^"]+)"/)?.[1] ?? '';
|
|
68
|
+
const kind = sub?.match(/kind:"([^"]+)"/)?.[1] ?? '';
|
|
69
|
+
if (kind.includes('thumbnail')) {
|
|
70
|
+
return {
|
|
71
|
+
lang: kind,
|
|
72
|
+
url: `https://streamwish.com${url}`,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
lang: lang,
|
|
77
|
+
url: url,
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
if (link.includes('hls2"')) {
|
|
81
|
+
link = link.replace('hls2"', '').replace(new RegExp('"', 'g'), '');
|
|
82
|
+
}
|
|
83
|
+
const linkParser = new URL(link);
|
|
84
|
+
linkParser.searchParams.set('i', '0.4');
|
|
85
|
+
this.sources.push({
|
|
86
|
+
quality: 'default',
|
|
87
|
+
url: linkParser.href,
|
|
88
|
+
isM3U8: link.includes('.m3u8'),
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
const m3u8Content = await axios.get(this.sources[0]!.url, options);
|
|
93
|
+
|
|
94
|
+
if (m3u8Content.data.includes('EXTM3U')) {
|
|
95
|
+
const videoList = m3u8Content.data.split('#EXT-X-STREAM-INF:');
|
|
96
|
+
for (const video of videoList ?? []) {
|
|
97
|
+
if (!video.includes('m3u8')) continue;
|
|
98
|
+
|
|
99
|
+
const url = link.split('master.m3u8')[0] + video.split('\n')[1];
|
|
100
|
+
const quality = video.split('RESOLUTION=')[1].split(',')[0].split('x')[1];
|
|
101
|
+
|
|
102
|
+
this.sources.push({
|
|
103
|
+
url: url,
|
|
104
|
+
quality: `${quality}p`,
|
|
105
|
+
isM3U8: url.includes('.m3u8'),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
} catch (e) {}
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
sources: this.sources,
|
|
113
|
+
subtitles: subtitles,
|
|
114
|
+
};
|
|
115
|
+
} catch (err) {
|
|
116
|
+
throw new Error((err as Error).message);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
export default StreamWish;
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { VideoExtractor, type IVideo, type ISubtitle } from '../models';
|
|
3
|
-
|
|
4
|
-
class VidHide extends VideoExtractor {
|
|
5
|
-
protected override serverName = 'VidHide';
|
|
6
|
-
protected override sources: IVideo[] = [];
|
|
7
|
-
|
|
8
|
-
override extract = async (videoUrl: URL): Promise<IVideo[]> => {
|
|
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
|
-
const links = unpackedData.match(/https?:\/\/[^"]+?\.m3u8[^"]*/g) ?? [];
|
|
23
|
-
const m3u8Link = links[0];
|
|
24
|
-
const m3u8Content = await axios.get(m3u8Link, {
|
|
25
|
-
headers: {
|
|
26
|
-
Referer: m3u8Link,
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
result.sources.push({
|
|
31
|
-
quality: 'auto',
|
|
32
|
-
url: m3u8Link,
|
|
33
|
-
isM3U8: m3u8Link.includes('.m3u8'),
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
if (m3u8Content.data.includes('EXTM3U')) {
|
|
37
|
-
const pathWithoutMaster = m3u8Link.split('/master.m3u8')[0];
|
|
38
|
-
const videoList = m3u8Content.data.split('#EXT-X-STREAM-INF:');
|
|
39
|
-
for (const video of videoList ?? []) {
|
|
40
|
-
if (!video.includes('m3u8')) continue;
|
|
41
|
-
|
|
42
|
-
const url = video.split('\n')[1];
|
|
43
|
-
const quality = video.split('RESOLUTION=')[1]?.split(',')[0].split('x')[1];
|
|
44
|
-
|
|
45
|
-
result.sources.push({
|
|
46
|
-
url: `${pathWithoutMaster}/${url}`,
|
|
47
|
-
quality: `${quality}p`,
|
|
48
|
-
isM3U8: url.includes('.m3u8'),
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return result.sources;
|
|
54
|
-
} catch (err) {
|
|
55
|
-
throw new Error((err as Error).message);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
export default VidHide;
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { VideoExtractor, type IVideo, type ISubtitle } from '../models';
|
|
3
|
+
|
|
4
|
+
class VidHide extends VideoExtractor {
|
|
5
|
+
protected override serverName = 'VidHide';
|
|
6
|
+
protected override sources: IVideo[] = [];
|
|
7
|
+
|
|
8
|
+
override extract = async (videoUrl: URL): Promise<IVideo[]> => {
|
|
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
|
+
const links = unpackedData.match(/https?:\/\/[^"]+?\.m3u8[^"]*/g) ?? [];
|
|
23
|
+
const m3u8Link = links[0];
|
|
24
|
+
const m3u8Content = await axios.get(m3u8Link, {
|
|
25
|
+
headers: {
|
|
26
|
+
Referer: m3u8Link,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
result.sources.push({
|
|
31
|
+
quality: 'auto',
|
|
32
|
+
url: m3u8Link,
|
|
33
|
+
isM3U8: m3u8Link.includes('.m3u8'),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
if (m3u8Content.data.includes('EXTM3U')) {
|
|
37
|
+
const pathWithoutMaster = m3u8Link.split('/master.m3u8')[0];
|
|
38
|
+
const videoList = m3u8Content.data.split('#EXT-X-STREAM-INF:');
|
|
39
|
+
for (const video of videoList ?? []) {
|
|
40
|
+
if (!video.includes('m3u8')) continue;
|
|
41
|
+
|
|
42
|
+
const url = video.split('\n')[1];
|
|
43
|
+
const quality = video.split('RESOLUTION=')[1]?.split(',')[0].split('x')[1];
|
|
44
|
+
|
|
45
|
+
result.sources.push({
|
|
46
|
+
url: `${pathWithoutMaster}/${url}`,
|
|
47
|
+
quality: `${quality}p`,
|
|
48
|
+
isM3U8: url.includes('.m3u8'),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return result.sources;
|
|
54
|
+
} catch (err) {
|
|
55
|
+
throw new Error((err as Error).message);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export default VidHide;
|