@vyla-entertainment/sdk 1.11.0 → 1.13.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.
@@ -1,151 +0,0 @@
1
- import { USER_AGENT } from '../utils/helpers.js';
2
-
3
- const BASE_URL = "https://mapple.club";
4
- const PROXY_HEADERS = { Referer: `${BASE_URL}/`, Origin: BASE_URL, "User-Agent": USER_AGENT };
5
-
6
- const K = new Uint32Array([0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]);
7
- const W_BUF = new Uint32Array(64);
8
-
9
- function sha256Into(buf, total, out) {
10
- let h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a, h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19;
11
- const dv = new DataView(buf.buffer, buf.byteOffset, total);
12
- for (let off = 0; off < total; off += 64) {
13
- for (let i = 0; i < 16; i++) W_BUF[i] = dv.getUint32(off + i * 4, false);
14
- for (let i = 16; i < 64; i++) {
15
- const a = W_BUF[i - 15], b = W_BUF[i - 2];
16
- const s0 = ((a >>> 7) | (a << 25)) ^ ((a >>> 18) | (a << 14)) ^ (a >>> 3);
17
- const s1 = ((b >>> 17) | (b << 15)) ^ ((b >>> 19) | (b << 13)) ^ (b >>> 10);
18
- W_BUF[i] = (W_BUF[i - 16] + s0 + W_BUF[i - 7] + s1) | 0;
19
- }
20
- let a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7;
21
- for (let i = 0; i < 64; i++) {
22
- const S1 = ((e >>> 6) | (e << 26)) ^ ((e >>> 11) | (e << 21)) ^ ((e >>> 25) | (e << 7));
23
- const ch = (e & f) ^ (~e & g);
24
- const t1 = (h + S1 + ch + K[i] + W_BUF[i]) | 0;
25
- const S0 = ((a >>> 2) | (a << 30)) ^ ((a >>> 13) | (a << 19)) ^ ((a >>> 22) | (a << 10));
26
- const maj = (a & b) ^ (a & c) ^ (b & c);
27
- const t2 = (S0 + maj) | 0;
28
- h = g; g = f; f = e; e = (d + t1) | 0; d = c; c = b; b = a; a = (t1 + t2) | 0;
29
- }
30
- h0 = (h0 + a) | 0; h1 = (h1 + b) | 0; h2 = (h2 + c) | 0; h3 = (h3 + d) | 0; h4 = (h4 + e) | 0; h5 = (h5 + f) | 0; h6 = (h6 + g) | 0; h7 = (h7 + h) | 0;
31
- }
32
- const odv = new DataView(out.buffer, out.byteOffset, 32);
33
- odv.setUint32(0, h0 >>> 0, false); odv.setUint32(4, h1 >>> 0, false); odv.setUint32(8, h2 >>> 0, false); odv.setUint32(12, h3 >>> 0, false); odv.setUint32(16, h4 >>> 0, false); odv.setUint32(20, h5 >>> 0, false); odv.setUint32(24, h6 >>> 0, false); odv.setUint32(28, h7 >>> 0, false);
34
- }
35
-
36
- function solvePoW(challenge, difficulty) {
37
- const encoder = new TextEncoder();
38
- const cBuf = encoder.encode(challenge);
39
- const maxLen = cBuf.length + 16;
40
- const total = (maxLen + 1 + 8 + 63) & ~63;
41
- const buf = new Uint8Array(total);
42
- buf.set(cBuf);
43
- const hash = new Uint8Array(32);
44
- const maskBytes = Math.floor(difficulty / 8);
45
- const maskBits = difficulty % 8;
46
- const finalMask = maskBits > 0 ? (0xff << (8 - maskBits)) & 0xff : 0;
47
- const dv = new DataView(buf.buffer);
48
- for (let nonce = 0; nonce < 10000000; nonce++) {
49
- const str = nonce.toString();
50
- const len = cBuf.length + str.length;
51
- for (let i = 0; i < str.length; i++) buf[cBuf.length + i] = str.charCodeAt(i);
52
- buf[len] = 0x80;
53
- for (let i = len + 1; i < total - 8; i++) buf[i] = 0;
54
- dv.setUint32(total - 4, len * 8, false);
55
- dv.setUint32(total - 8, 0, false);
56
- sha256Into(buf, total, hash);
57
- let ok = true;
58
- for (let i = 0; i < maskBytes; i++) if (hash[i] !== 0) { ok = false; break; }
59
- if (ok && (finalMask === 0 || (hash[maskBytes] & finalMask) === 0)) return { found: true, nonce: str };
60
- }
61
- return { found: false };
62
- }
63
-
64
- const SERVER_LIST = [{ id: "mapple", name: "Mapple" }, { id: "s1", name: "Nexus" }, { id: "s2", name: "Cipher" }, { id: "s3", name: "Pulse" }, { id: "s4", name: "Vertex" }, { id: "s10", name: "Chimp" }];
65
-
66
- export async function getStream(args) {
67
- const { id, s, e, server } = args;
68
- const isTv = s != null && e != null;
69
- const mediaType = isTv ? "tv" : "movie";
70
- const tvSlug = isTv ? `${s}-${e}` : "";
71
- const pageUrl = isTv ? `${BASE_URL}/watch/tv/${id}/${s}/${e}` : `${BASE_URL}/watch/movie/${id}`;
72
- try {
73
- const pageRes = await fetch(pageUrl, { headers: PROXY_HEADERS, signal: AbortSignal.timeout(10000) });
74
- if (!pageRes.ok) return null;
75
- const html = await pageRes.text();
76
- const reqMatch = html.match(/window\.__REQUEST_TOKEN__\s*=\s*"([^"]+)"/);
77
- if (!reqMatch) return null;
78
- const requestToken = reqMatch[1];
79
- const cookies = pageRes.headers.getSetCookie();
80
- const cookieHeader = cookies.map(c => c.split(';')[0]).join('; ');
81
-
82
- const initHeaders = { "Content-Type": "application/json", ...PROXY_HEADERS, Referer: pageUrl };
83
- if (cookieHeader) initHeaders.Cookie = cookieHeader;
84
-
85
- const initRes = await fetch(`${BASE_URL}/api/playback-init`, {
86
- method: "POST",
87
- headers: initHeaders,
88
- body: JSON.stringify({ mediaId: Number(id), mediaType, requestToken }),
89
- signal: AbortSignal.timeout(10000)
90
- });
91
- const initData = await initRes.json();
92
- let streamToken = initData.token;
93
- if (initData.requiresPow && initData.pow) {
94
- const powRes = solvePoW(initData.pow.challenge, initData.pow.difficulty);
95
- if (powRes.found) {
96
- const solveRes = await fetch(`${BASE_URL}/api/playback-init`, {
97
- method: "POST",
98
- headers: initHeaders,
99
- body: JSON.stringify({ mediaId: Number(id), mediaType, requestToken, pow: { challengeId: initData.pow.challengeId, nonce: powRes.nonce } }),
100
- signal: AbortSignal.timeout(10000)
101
- });
102
- streamToken = (await solveRes.json()).token;
103
- }
104
- }
105
- if (!streamToken) return null;
106
- let targets = SERVER_LIST;
107
- if (server && server !== "all") {
108
- const clean = server.replace("Mapple - ", "");
109
- targets = SERVER_LIST.filter(sv => sv.name === clean);
110
- if (!targets.length) targets = SERVER_LIST;
111
- }
112
- const allUrls = [];
113
- for (const srv of targets) {
114
- try {
115
- const encryptRes = await fetch(`${BASE_URL}/api/encrypt`, {
116
- method: "POST",
117
- headers: initHeaders,
118
- body: JSON.stringify({
119
- data: {
120
- mediaId: Number(id),
121
- mediaType,
122
- tv_slug: tvSlug,
123
- source: srv.id,
124
- apikey: "mptv_sk_a8f29c4e7b3d1f"
125
- }
126
- }),
127
- signal: AbortSignal.timeout(8000)
128
- });
129
- const encryptData = await encryptRes.json();
130
- if (!encryptData.encrypted) continue;
131
-
132
- const streamUrl = `${BASE_URL}/api/stream-encrypted?data=${encodeURIComponent(encryptData.encrypted)}&requestToken=${encodeURIComponent(requestToken)}&token=${encodeURIComponent(streamToken)}`;
133
- const streamRes = await fetch(streamUrl, {
134
- headers: { ...PROXY_HEADERS, Referer: pageUrl, ...(cookieHeader ? { Cookie: cookieHeader } : {}) },
135
- signal: AbortSignal.timeout(8000)
136
- });
137
- const streamData = await streamRes.json();
138
- if (streamData.success && streamData.data?.stream_url) {
139
- let fileUrl = streamData.data.stream_url;
140
- if (fileUrl.includes('omena-puu') || fileUrl.includes('nocach')) fileUrl += fileUrl.includes('?') ? '&format=.m3u8' : '?format=.m3u8';
141
- allUrls.push({ url: fileUrl, server: `Mapple - ${srv.name}`, headers: PROXY_HEADERS, skipProxy: false, skipVerify: true, skipHlsCheck: true });
142
- }
143
- } catch { }
144
- }
145
- return allUrls.length ? { allUrls } : null;
146
- } catch { return null; }
147
- }
148
-
149
- export async function getSources() { return SERVER_LIST.map(s => `Mapple - ${s.name}`); }
150
- export const SKIP_VERIFY = true;
151
- export const MULTI_URL = true;
@@ -1,47 +0,0 @@
1
- import { fetchJson } from '../utils/helpers.js';
2
-
3
- const CONFIGURATION = 'W3siaWQiOiJkZWZhdWx0IiwibmFtZSI6Ik1lZ2FTb3VyY2UgZGVmYXVsdCIsInVybCI6Imh0dHBzOi8vZ2l0aHViLmNvbS96b3JldS9tZWdhc291cmNlX3NjcmFwZXJzL3Jhdy9yZWZzL2hlYWRzL21haW4vZGVmYXVsdF9zY3JhcGVyLnB5IiwiZGVzY3JpcHRpb24iOiJEZWZhdWx0IHNjcmFwZXIgaG9zdGVkIG9uIEdpdEh1Yi4ifV0';
4
- const BASE_URL = `https://megasource.wasmer.app/${CONFIGURATION}`;
5
-
6
- async function getImdbId(tmdbApiKey, tmdbId, s, e) {
7
- const key = tmdbApiKey;
8
- if (!key) return null;
9
- try {
10
- const url = s != null && e != null
11
- ? `https://api.themoviedb.org/3/tv/${tmdbId}/external_ids?api_key=${key}`
12
- : `https://api.themoviedb.org/3/movie/${tmdbId}?api_key=${key}`;
13
- const res = await fetchJson(url);
14
- return res?.imdb_id || null;
15
- } catch { return null; }
16
- }
17
-
18
- export async function getStream({ id, s, e, sdk }) {
19
- const tmdbApiKey = sdk?.tmdbApiKey || null;
20
- if (!tmdbApiKey) return null;
21
- try {
22
- const imdbId = await getImdbId(tmdbApiKey, id, s, e);
23
- if (!imdbId) return null;
24
-
25
- const path = s != null && e != null
26
- ? `/stream/series/${imdbId}:${s}:${e}.json`
27
- : `/stream/movie/${imdbId}.json`;
28
-
29
- const res = await fetchJson(`${BASE_URL}${path}`);
30
- if (!res?.streams?.length) return null;
31
-
32
- const allUrls = res.streams.map(stream => {
33
- if (!stream.url) return null;
34
- const headers = stream.behaviorHints?.proxyHeaders?.request || {};
35
- return {
36
- url: stream.url,
37
- server: `MegaSource - ${stream.title ? ` ${stream.title}` : ''}`,
38
- headers: Object.keys(headers).length > 0 ? headers : undefined,
39
- skipProxy: Object.keys(headers).length > 0 && stream.behaviorHints?.notWebReady === false
40
- };
41
- }).filter(Boolean);
42
-
43
- return allUrls.length ? { allUrls } : null;
44
- } catch {
45
- return null;
46
- }
47
- }
@@ -1,103 +0,0 @@
1
- import { fetchJson, USER_AGENT } from '../utils/helpers.js';
2
-
3
- const API_BASE = 'https://api.meowtv.ru';
4
- const REFERER = 'https://meowtv.ru/';
5
- const ENC_DEC_API = 'https://enc-dec.app/api/dec-meowtv';
6
-
7
- const HEADERS = {
8
- 'User-Agent': USER_AGENT,
9
- 'Accept': 'application/json',
10
- 'Referer': REFERER,
11
- 'Origin': 'https://meowtv.ru',
12
- 'Accept-Language': 'en-US,en;q=0.9'
13
- };
14
-
15
- const SERVERS = [
16
- 'hindiv3'
17
- ];
18
-
19
- const TIMEOUT_MS = 15000;
20
-
21
- export const VERIFY_HEADERS = { 'User-Agent': USER_AGENT, 'Referer': REFERER, 'Origin': 'https://meowtv.ru' };
22
-
23
- async function decryptPayload(payload) {
24
- try {
25
- const response = await fetchJson(ENC_DEC_API, {
26
- method: 'POST',
27
- headers: { 'Content-Type': 'application/json' },
28
- body: JSON.stringify({ data: payload })
29
- });
30
-
31
- if (response?.status !== 200 || !response?.result) {
32
- return null;
33
- }
34
-
35
- return typeof response.result === 'string' ? JSON.parse(response.result) : response.result;
36
- } catch (e) {
37
- return null;
38
- }
39
- }
40
-
41
- export async function getStream({ id, s, e, server }) {
42
- try {
43
- const isTv = !!s;
44
- let targets = SERVERS;
45
- if (server && server !== 'all') {
46
- const cleanName = server.replace('MeowTV - ', '');
47
- targets = SERVERS.includes(cleanName) ? [cleanName] : [targets[0]];
48
- }
49
-
50
- const results = await Promise.all(targets.map(async srv => {
51
- try {
52
- return await Promise.race([
53
- (async () => {
54
- const path = isTv
55
- ? `/streams/tv/${id}/${s}/${e}?s=${encodeURIComponent(srv)}`
56
- : `/streams/movie/${id}?s=${encodeURIComponent(srv)}`;
57
-
58
- const payload = await fetchJson(`${API_BASE}${path}`, {
59
- headers: HEADERS
60
- });
61
-
62
- if (!payload) return null;
63
-
64
- const data = await decryptPayload(payload);
65
- if (!data) return null;
66
-
67
- const urls = [];
68
- if (data?.url?.startsWith('http')) {
69
- urls.push({
70
- url: data.url,
71
- server: `MeowTV - ${srv}`,
72
- });
73
- }
74
-
75
- if (Array.isArray(data?.streams)) {
76
- for (const stream of data.streams) {
77
- if (stream?.url?.startsWith('http')) {
78
- urls.push({
79
- url: stream.url,
80
- server: `MeowTV - ${srv} (${stream.language || 'Unknown'})`,
81
- });
82
- }
83
- }
84
- }
85
- return urls;
86
- })(),
87
- new Promise((_, reject) => setTimeout(() => reject(new Error('Timeout exceeded')), TIMEOUT_MS))
88
- ]);
89
- } catch (err) {
90
- return null;
91
- }
92
- }));
93
-
94
- const allUrls = results.filter(Boolean).flat();
95
- return allUrls.length ? { allUrls } : null;
96
- } catch (e) {
97
- return null;
98
- }
99
- }
100
-
101
- export async function getSources() {
102
- return SERVERS.map(s => `MeowTV - ${s}`);
103
- }
@@ -1,46 +0,0 @@
1
- import { fetchJson } from '../utils/helpers.js';
2
-
3
- const BASE_URL = `https://nova-streamz.vercel.app`;
4
-
5
- async function getImdbId(tmdbApiKey, tmdbId, s, e) {
6
- const key = tmdbApiKey;
7
- if (!key) return null;
8
- try {
9
- const url = s != null && e != null
10
- ? `https://api.themoviedb.org/3/tv/${tmdbId}/external_ids?api_key=${key}`
11
- : `https://api.themoviedb.org/3/movie/${tmdbId}?api_key=${key}`;
12
- const res = await fetchJson(url);
13
- return res?.imdb_id || null;
14
- } catch { return null; }
15
- }
16
-
17
- export async function getStream({ id, s, e, sdk }) {
18
- const tmdbApiKey = sdk?.tmdbApiKey || null;
19
- if (!tmdbApiKey) return null;
20
- try {
21
- const imdbId = await getImdbId(tmdbApiKey, id, s, e);
22
- if (!imdbId) return null;
23
-
24
- const path = s != null && e != null
25
- ? `/stream/series/${imdbId}:${s}:${e}.json`
26
- : `/stream/movie/${imdbId}.json`;
27
-
28
- const res = await fetchJson(`${BASE_URL}${path}`);
29
- if (!res?.streams?.length) return null;
30
-
31
- const allUrls = res.streams.map(stream => {
32
- if (!stream.url) return null;
33
- const headers = stream.behaviorHints?.proxyHeaders?.request || {};
34
- return {
35
- url: stream.url,
36
- server: `Nova - ${stream.name.replace('Nova ', '') || 'Server'}${stream.title ? ` ${stream.title.split(' | ')[0] || ''}` : ''}`,
37
- headers: Object.keys(headers).length > 0 ? headers : undefined,
38
- skipProxy: Object.keys(headers).length > 0 && stream.behaviorHints?.notWebReady === false
39
- };
40
- }).filter(Boolean);
41
-
42
- return allUrls.length ? { allUrls } : null;
43
- } catch {
44
- return null;
45
- }
46
- }
@@ -1,122 +0,0 @@
1
- import { USER_AGENT, fetchJson, getTmdbInfo } from '../utils/helpers.js';
2
-
3
- const BASE_URL = 'https://providers.peestream.in';
4
-
5
- export async function getStream(args) {
6
- const { id, s, e, server, tmdbApiKey } = args;
7
- const isTv = s != null && e != null;
8
- const type = isTv ? 'tv' : 'movie';
9
-
10
- let title = args.title || '';
11
- let releaseYear = args.year || '';
12
- let imdbId = args.imdbId || '';
13
-
14
- if (!title) {
15
- try {
16
- const info = await getTmdbInfo(id, type, s, tmdbApiKey);
17
- if (info) {
18
- title = info.title || '';
19
- if (info.year) releaseYear = info.year;
20
- if (info.imdbId) imdbId = info.imdbId;
21
- }
22
- } catch { }
23
- }
24
-
25
- const queryParams = new URLSearchParams({
26
- type,
27
- tmdbId: String(id),
28
- title: title || String(id)
29
- });
30
- if (releaseYear) queryParams.set('releaseYear', String(releaseYear));
31
- if (imdbId) queryParams.set('imdbId', String(imdbId));
32
- if (isTv) {
33
- queryParams.set('season', String(s));
34
- queryParams.set('episode', String(e));
35
- }
36
-
37
- const allUrls = [];
38
-
39
- try {
40
- const scrapeUrl = `${BASE_URL}/scrape?${queryParams.toString()}`;
41
- const res = await fetch(scrapeUrl, {
42
- headers: {
43
- 'User-Agent': USER_AGENT,
44
- 'Accept': 'text/event-stream',
45
- 'Referer': `${BASE_URL}/`
46
- },
47
- signal: AbortSignal.timeout(15000)
48
- });
49
-
50
- if (res.ok) {
51
- const text = await res.text();
52
- const events = text.split('\n\n');
53
- for (const ev of events) {
54
- if (ev.includes('event: completed')) {
55
- const dataMatch = ev.match(/data:\s*(.+)/);
56
- if (dataMatch) {
57
- try {
58
- const parsed = JSON.parse(dataMatch[1].trim());
59
- const stream = parsed.stream;
60
- const streamUrl = stream?.playlist || stream?.url || stream?.file;
61
- if (streamUrl) {
62
- allUrls.push({
63
- url: streamUrl,
64
- server: `PeeStream - ${parsed.sourceId || 'Poseidon'}`,
65
- quality: 'Auto',
66
- type: stream.type === 'hls' || streamUrl.includes('.m3u8') ? 'hls' : 'mp4',
67
- headers: stream.headers || {
68
- 'User-Agent': USER_AGENT
69
- }
70
- });
71
- }
72
- } catch { }
73
- }
74
- }
75
- }
76
- }
77
- } catch { }
78
-
79
- if (!allUrls.length) {
80
- try {
81
- const searchUrl = `${BASE_URL}/api/search?q=${encodeURIComponent(title || id)}&type=${type}&tmdbId=${id}${isTv ? `&season=${s}&episode=${e}` : ''}`;
82
- const data = await fetchJson(searchUrl, {
83
- headers: {
84
- 'User-Agent': USER_AGENT,
85
- 'Accept': 'application/json',
86
- 'Referer': `${BASE_URL}/`
87
- },
88
- signal: AbortSignal.timeout(10000)
89
- });
90
-
91
- if (data && Array.isArray(data.results)) {
92
- for (const result of data.results) {
93
- const pName = result.providerName || result.provider || 'PeeStream';
94
- for (const stream of result.streams || []) {
95
- if (!stream || !stream.url) continue;
96
- allUrls.push({
97
- url: stream.url,
98
- server: `PeeStream - ${stream.name || pName}`,
99
- quality: stream.quality || 'Auto',
100
- type: stream.type === 'm3u8' || stream.url.includes('.m3u8') ? 'hls' : 'mp4',
101
- headers: stream.headers || {
102
- 'User-Agent': USER_AGENT
103
- }
104
- });
105
- }
106
- }
107
- }
108
- } catch { }
109
- }
110
-
111
- if (server && server !== 'all') {
112
- const clean = server.toLowerCase().replace('peestream - ', '');
113
- const filtered = allUrls.filter(u => u.server.toLowerCase().includes(clean));
114
- if (filtered.length) return { allUrls: filtered };
115
- }
116
-
117
- return allUrls.length ? { allUrls } : null;
118
- }
119
-
120
- export async function getSources() {
121
- return ['PeeStream - vaplayer'];
122
- }
@@ -1,43 +0,0 @@
1
- import { fetchJson, fetchText, USER_AGENT } from '../utils/helpers.js';
2
-
3
- const API_BASE = 'https://enc-dec.app/api';
4
- const HEADERS = { 'User-Agent': USER_AGENT, 'Referer': 'https://vidcore.net/', 'X-Requested-With': 'XMLHttpRequest' };
5
-
6
- async function getDynamicServers(id, s, e) {
7
- try {
8
- const html = await fetchText(s != null && e != null ? `https://vidcore.net/tv/${id}/${s}/${e}/` : `https://vidcore.net/movie/${id}/`, { headers: HEADERS });
9
-
10
- const match = html.match(/\\"(?:en|token)\\":\\"(.*?)\\"/) || html.match(/"(?:en|token)":"(.*?)"/);
11
- if (!match?.[1]) return null;
12
-
13
- const encData = await fetchJson(`${API_BASE}/enc-vidcore?text=${encodeURIComponent(match[1])}`);
14
- if (!encData?.result) return null;
15
- const { servers: serversUrl, stream: streamUrl, token } = encData.result;
16
- const reqHeaders = { ...HEADERS, 'X-CSRF-Token': token };
17
- const serversEncrypted = await fetchText(serversUrl, { method: 'POST', headers: reqHeaders });
18
- const decData = await fetchJson(`${API_BASE}/dec-vidcore`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ text: serversEncrypted }) });
19
- return decData?.result ? { servers: decData.result, streamUrl, reqHeaders } : null;
20
- } catch { return null; }
21
- }
22
-
23
- export async function getStream({ id, s, e }) {
24
- const data = await getDynamicServers(id, s, e);
25
- if (!data?.servers?.length) return null;
26
- for (const srv of data.servers) {
27
- try {
28
- const streamEncrypted = await fetchText(`${data.streamUrl}/${srv.data}`, { method: 'POST', headers: data.reqHeaders });
29
- const decData = await fetchJson(`${API_BASE}/dec-vidcore`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ text: streamEncrypted }) });
30
- const url = decData?.result?.url;
31
- if (url) {
32
- const r = await fetch(url, { headers: { ...HEADERS, 'Range': 'bytes=0-511' }, signal: AbortSignal.timeout(5000) });
33
- if (r.ok || r.status === 206) return { url, subtitles: (decData.result.captions || []).map(c => ({ url: c.file, lang: c.label || 'Unknown' })), headers: { ...HEADERS, 'Origin': 'https://vidcore.net' }, server: srv.name };
34
- }
35
- } catch { }
36
- }
37
- return null;
38
- }
39
-
40
- export async function getSources(args) {
41
- const data = await getDynamicServers(args.id, args.s, args.e);
42
- return data?.servers ? data.servers.map(s => s.name) : [];
43
- }
@@ -1,94 +0,0 @@
1
- import { getTmdbInfo, fetchJson, fetchText, USER_AGENT } from '../utils/helpers.js';
2
-
3
- const SPEEDRACE_BASE = "https://api.speedracelight.com";
4
- const HEADERS = { "Accept": "*/*", "Origin": "https://player.videasy.to", "Referer": "https://player.videasy.to/", "User-Agent": USER_AGENT };
5
- const SERVERS = [
6
- { id: 'cdn', name: 'Yoru' },
7
- { id: 'm4uhd', name: 'Breach' },
8
- { id: 'vsrc', name: 'Neon' },
9
- { id: 'hdmovie', name: 'Vyse' },
10
- { id: 'meine', name: 'Killjoy' },
11
- { id: 'lamovie', name: 'Omen' },
12
- { id: 'superflix', name: 'Raze' }
13
- ];
14
-
15
- export async function getStream({ id, s, e, server, sdk }) {
16
- const tmdbApiKey = sdk?.tmdbApiKey || null;
17
- if (!tmdbApiKey) return null;
18
- try {
19
- const isTv = s != null && e != null;
20
- const info = await getTmdbInfo(tmdbApiKey, id, isTv ? 'tv' : 'movie');
21
- if (!info?.titles?.length) return null;
22
-
23
- const seedData = await fetchJson(`${SPEEDRACE_BASE}/seed?mediaId=${id}`, { headers: HEADERS, signal: AbortSignal.timeout(5000) });
24
- const seed = seedData?.seed;
25
- if (!seed) return null;
26
-
27
- const encTitle = encodeURIComponent(encodeURIComponent(info.titles[0]));
28
- let targets = SERVERS;
29
-
30
- if (server && server !== 'all') {
31
- const cleanName = server.replace('VidEasy - ', '');
32
- targets = SERVERS.filter(sv => sv.name === cleanName);
33
- if (!targets.length) targets = SERVERS;
34
- }
35
-
36
- const settled = await Promise.allSettled(targets.map(async srv => {
37
- let url = `${SPEEDRACE_BASE}/${srv.id}/sources-with-title?title=${encTitle}&mediaType=${isTv ? 'tv' : 'movie'}&year=${info.year || ''}&tmdbId=${id}&imdbId=${info.imdbId || "tt0000000"}&enc=2&seed=${seed}`;
38
- if (isTv) url += `&episodeId=${e}&seasonId=${s}`;
39
-
40
- const encText = await fetchText(url, { headers: HEADERS, signal: AbortSignal.timeout(10000) });
41
- const decJson = await fetchJson("https://enc-dec.app/api/dec-videasy", {
42
- method: 'POST',
43
- headers: { 'Content-Type': 'application/json' },
44
- body: JSON.stringify({ text: encText, id: String(id), seed }),
45
- signal: AbortSignal.timeout(10000)
46
- });
47
-
48
- if (decJson.status !== 200 || !decJson.result) throw new Error();
49
-
50
- let sourcesArray = [];
51
- let subsArray = [];
52
-
53
- if (Array.isArray(decJson.result)) {
54
- sourcesArray = decJson.result;
55
- } else if (decJson.result.sources && Array.isArray(decJson.result.sources)) {
56
- sourcesArray = decJson.result.sources;
57
- if (decJson.result.subtitles && Array.isArray(decJson.result.subtitles)) {
58
- subsArray = decJson.result.subtitles.map(sub => ({
59
- url: sub.url || sub.file,
60
- lang: sub.language || sub.lang || sub.label || 'Unknown'
61
- })).filter(sub => sub.url);
62
- }
63
- } else {
64
- sourcesArray = [decJson.result];
65
- }
66
-
67
- return sourcesArray.map(res => {
68
- const streamUrl = res.url || res.file || res.link || res.playlist || res.stream;
69
- return streamUrl ? {
70
- url: streamUrl,
71
- quality: res.quality || "Auto",
72
- server: `VidEasy - ${srv.name}`,
73
- type: streamUrl.includes('.m3u8') ? 'hls' : 'mp4',
74
- headers: HEADERS,
75
- subtitles: subsArray.length > 0 ? subsArray : undefined,
76
- skipProxy: false,
77
- skipVerify: true,
78
- skipHlsCheck: true
79
- } : null;
80
- }).filter(Boolean);
81
- }));
82
-
83
- const allUrls = [];
84
- for (const r of settled) {
85
- if (r.status === 'fulfilled' && r.value) allUrls.push(...r.value);
86
- }
87
-
88
- return allUrls.length ? { allUrls } : null;
89
- } catch { return null; }
90
- }
91
-
92
- export async function getSources() {
93
- return SERVERS.map(s => `VidEasy - ${s.name}`);
94
- }
@@ -1,53 +0,0 @@
1
- import { fetchJson, fetchText, USER_AGENT } from '../utils/helpers.js';
2
-
3
- const API_BASE = 'https://enc-dec.app/api';
4
- const DOMAIN = 'https://vidfast.vc';
5
- const HEADERS = { 'User-Agent': USER_AGENT, 'Referer': `${DOMAIN}/`, 'X-Requested-With': 'XMLHttpRequest' };
6
-
7
- async function getVidfastMeta(id, s, e) {
8
- try {
9
- const embedUrl = s != null && e != null ? `${DOMAIN}/tv/${id}/${s}/${e}/` : `${DOMAIN}/movie/${id}/`;
10
- const html = await fetchText(embedUrl, { headers: { 'User-Agent': USER_AGENT } });
11
-
12
- const match = html.match(/\\"(?:en|token)\\":\\"(.*?)\\"/) || html.match(/"(?:en|token)":"(.*?)"/);
13
- if (!match?.[1]) return null;
14
-
15
- const encData = await fetchJson(`${API_BASE}/enc-vidfast?text=${encodeURIComponent(match[1])}`);
16
- if (encData.status !== 200 || !encData.result) return null;
17
-
18
- const { servers: serversUrl, stream: streamUrl, token } = encData.result;
19
- const reqHeaders = { ...HEADERS, 'X-CSRF-Token': token };
20
-
21
- const serversEncrypted = await fetchText(serversUrl, { method: 'POST', headers: reqHeaders });
22
- const decServersData = await fetchJson(`${API_BASE}/dec-vidfast`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ text: serversEncrypted }) });
23
-
24
- if (decServersData.status !== 200 || !decServersData.result) return null;
25
- return { servers: decServersData.result, streamUrl, reqHeaders };
26
- } catch { return null; }
27
- }
28
-
29
- export async function getStream({ id, s, e, server }) {
30
- const meta = await getVidfastMeta(id, s, e);
31
- if (!meta?.servers?.length) return null;
32
- const { servers, streamUrl, reqHeaders } = meta;
33
- let targets = servers;
34
- if (server && server !== 'all') {
35
- const cleanName = server.replace('VidFast - ', '');
36
- targets = servers.filter(srv => srv.name === cleanName);
37
- if (!targets.length) targets = servers;
38
- }
39
- const results = await Promise.allSettled(targets.map(async srv => {
40
- const streamEncrypted = await fetchText(`${streamUrl}/${srv.data}`, { method: 'POST', headers: reqHeaders });
41
- const decStreamData = await fetchJson(`${API_BASE}/dec-vidfast`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ text: streamEncrypted }) });
42
- if (decStreamData.status !== 200 || !decStreamData.result?.url) throw new Error();
43
- return { url: decStreamData.result.url, server: `VidFast - ${srv.name || 'Server'}`, type: decStreamData.result.url.includes('.m3u8') ? 'hls' : 'mp4', subtitles: (decStreamData.result.captions || []).map(c => ({ url: c.file, lang: c.label || 'Unknown' })), headers: { ...HEADERS, 'Origin': DOMAIN } };
44
- }));
45
- const allUrls = [];
46
- for (const r of results) if (r.status === 'fulfilled') allUrls.push(r.value);
47
- return allUrls.length ? { allUrls } : null;
48
- }
49
-
50
- export async function getSources(args) {
51
- const meta = await getVidfastMeta(args.id, args.s, args.e);
52
- return meta?.servers ? meta.servers.map(srv => `VidFast - ${srv.name}`) : [];
53
- }