@vyla-entertainment/sdk 1.20.0 → 1.22.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/package.json +3 -2
- package/src/config.js +99 -67
- package/src/health.js +60 -20
- package/src/sdk.d.ts +94 -121
- package/src/sdk.js +82 -78
- package/src/sources/111477.js +88 -100
- package/src/sources/123anime.js +120 -56
- package/src/sources/3eyedraven.js +82 -135
- package/src/sources/4movies.js +77 -0
- package/src/sources/aether.js +99 -0
- package/src/sources/castle.js +415 -0
- package/src/sources/cinecat.js +37 -18
- package/src/sources/cinemaarmy.js +179 -180
- package/src/sources/cinesrc.js +401 -397
- package/src/sources/cno.js +101 -94
- package/src/sources/dulo.js +134 -149
- package/src/sources/flaxmovies.js +114 -105
- package/src/sources/framextv.js +126 -0
- package/src/sources/frost.js +38 -29
- package/src/sources/fsonline.js +95 -47
- package/src/sources/hdhub.js +43 -36
- package/src/sources/hexa.js +60 -53
- package/src/sources/hyper.js +42 -35
- package/src/sources/kickassanime.js +117 -124
- package/src/sources/kisskh.js +114 -59
- package/src/sources/lmscript.js +72 -70
- package/src/sources/lookmovie.js +80 -79
- package/src/sources/meowtv.js +140 -0
- package/src/sources/movenerds.js +74 -124
- package/src/sources/movy.js +197 -209
- package/src/sources/net79.js +59 -55
- package/src/sources/peestream.js +126 -138
- package/src/sources/pengu.js +46 -49
- package/src/sources/pstream.js +73 -67
- package/src/sources/purstream.js +96 -104
- package/src/sources/rivestream.js +182 -176
- package/src/sources/rivo.js +58 -53
- package/src/sources/streamaggregator.js +114 -128
- package/src/sources/thugtv.js +70 -62
- package/src/sources/vidapi.js +122 -114
- package/src/sources/vidcore.js +14 -122
- package/src/sources/vidfast.js +14 -122
- package/src/sources/vidlink.js +78 -27
- package/src/sources/vidora.js +74 -42
- package/src/sources/vidup.js +14 -122
- package/src/sources/vidvault.js +133 -187
- package/src/sources/vidy.js +192 -187
- package/src/sources/vidzee.js +189 -183
- package/src/sources/vixsrc.js +123 -113
- package/src/sources/watchout.js +60 -46
- package/src/sources/xdownloader.js +127 -128
- package/src/sources/yapgrid.js +68 -62
- package/src/sources/yastream.js +35 -29
- package/src/subtitles.js +105 -122
- package/src/utils/helpers.js +586 -247
- package/src/sources/bcine.js +0 -202
- package/src/sources/cinezo.js +0 -55
- package/src/sources/vidrock.js +0 -145
package/src/sources/vidy.js
CHANGED
|
@@ -1,187 +1,192 @@
|
|
|
1
|
-
import { getUA } from
|
|
2
|
-
|
|
3
|
-
const API_URL =
|
|
4
|
-
const SERVERS = [
|
|
5
|
-
const MAGIC = [109, 118, 109, 49];
|
|
6
|
-
|
|
7
|
-
function imul(a, b) {
|
|
8
|
-
return Math.imul(a | 0, b | 0) >>> 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function pFn(e) {
|
|
12
|
-
e = e >>> 0;
|
|
13
|
-
e = (e ^ (e >>> 16)) >>> 0;
|
|
14
|
-
e = imul(e, 2246822507);
|
|
15
|
-
e = (e ^ (e >>> 13)) >>> 0;
|
|
16
|
-
e = imul(e, 3266489909);
|
|
17
|
-
e = (e ^ (e >>> 16)) >>> 0;
|
|
18
|
-
return e;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function gFn(e, t) {
|
|
22
|
-
e = e >>> 0;
|
|
23
|
-
t = t & 31;
|
|
24
|
-
if (t === 0) return e;
|
|
25
|
-
return ((e << t) | (e >>> (32 - t))) >>> 0;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function decryptVidy(ciphertext, seedStr, mediaId) {
|
|
29
|
-
let padded = ciphertext.replace(/-/g,
|
|
30
|
-
while (padded.length % 4) padded +=
|
|
31
|
-
|
|
32
|
-
const raw = new Uint8Array(Buffer.from(padded,
|
|
33
|
-
const length = raw.length;
|
|
34
|
-
|
|
35
|
-
let tFnv = 2166136261;
|
|
36
|
-
for (let i = 0; i < seedStr.length; i++) {
|
|
37
|
-
tFnv = imul((tFnv ^ seedStr.charCodeAt(i)) >>> 0, 16777619);
|
|
38
|
-
}
|
|
39
|
-
const fnvRes = pFn(tFnv);
|
|
40
|
-
|
|
41
|
-
const innerArg = (((mediaId >>> 0) ^ 2654435769) >>> 0);
|
|
42
|
-
const inner = pFn(innerArg);
|
|
43
|
-
let n = pFn(((fnvRes ^ inner) >>> 0));
|
|
44
|
-
|
|
45
|
-
const S = {};
|
|
46
|
-
for (let e = 0; e < 8; e++) {
|
|
47
|
-
const t = n % 61;
|
|
48
|
-
n = gFn((n + 2654435769) >>> 0, 7 + (7 & e));
|
|
49
|
-
S[t] = ((n ^ pFn(n)) >>> 0);
|
|
50
|
-
n = pFn((n + t) >>> 0);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
let acc = pFn(((2779096485 ^ n) >>> 0));
|
|
54
|
-
const keystream = new Uint8Array(length);
|
|
55
|
-
let sCnt = 0;
|
|
56
|
-
let idx = 0;
|
|
57
|
-
|
|
58
|
-
while (idx < length) {
|
|
59
|
-
const sVal = acc;
|
|
60
|
-
const o = sVal % 61;
|
|
61
|
-
const hasO = Object.prototype.hasOwnProperty.call(S, o);
|
|
62
|
-
const iVal = hasO ? -1 : 0;
|
|
63
|
-
const d = hasO ? S[o] : 0;
|
|
64
|
-
const nTerm = ((d ^ imul(2654435769, sCnt + 1)) >>> 0);
|
|
65
|
-
sCnt += 1;
|
|
66
|
-
const aTerm = sVal;
|
|
67
|
-
let lVal = (((aTerm ^ nTerm) | (aTerm & nTerm & iVal)) >>> 0);
|
|
68
|
-
const term1 = gFn((lVal + sVal) >>> 0, 31 & o);
|
|
69
|
-
const term2 = gFn(sVal, (31 & imul(o, 7)) >>> 0);
|
|
70
|
-
lVal = ((term1 ^ term2) >>> 0);
|
|
71
|
-
const newS = pFn((lVal + 2654435769) >>> 0);
|
|
72
|
-
S[o] = newS;
|
|
73
|
-
acc = newS;
|
|
74
|
-
const tVal = newS;
|
|
75
|
-
|
|
76
|
-
keystream[idx++] = tVal & 0xFF;
|
|
77
|
-
if (idx < length) keystream[idx++] = (tVal >>> 8) & 0xFF;
|
|
78
|
-
if (idx < length) keystream[idx++] = (tVal >>> 16) & 0xFF;
|
|
79
|
-
if (idx < length) keystream[idx++] = (tVal >>> 24) & 0xFF;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
for (let i = 0; i < length; i++) {
|
|
83
|
-
raw[i] ^= keystream[i];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
for (let i = 0; i < MAGIC.length; i++) {
|
|
87
|
-
if (raw[i] !== MAGIC[i]) {
|
|
88
|
-
throw new Error(
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return new TextDecoder().decode(raw.slice(MAGIC.length));
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export async function getStream(args) {
|
|
96
|
-
const { id, s
|
|
97
|
-
const isTv = s != null && e != null;
|
|
98
|
-
const mediaId = Number(id);
|
|
99
|
-
|
|
100
|
-
const headers = {
|
|
101
|
-
|
|
102
|
-
Referer:
|
|
103
|
-
Origin:
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
try {
|
|
107
|
-
const seedUrl = new URL(`${API_URL}/seed`);
|
|
108
|
-
seedUrl.searchParams.set(
|
|
109
|
-
|
|
110
|
-
const seedRes = await fetch(seedUrl.toString(), {
|
|
111
|
-
headers,
|
|
112
|
-
signal: AbortSignal.timeout(6000),
|
|
113
|
-
});
|
|
114
|
-
if (!seedRes.ok) return null;
|
|
115
|
-
|
|
116
|
-
const seedData = await seedRes.json();
|
|
117
|
-
const seed = seedData?.seed;
|
|
118
|
-
if (!seed) return null;
|
|
119
|
-
|
|
120
|
-
for (const server of SERVERS) {
|
|
121
|
-
try {
|
|
122
|
-
const srcUrl = new URL(`${API_URL}/${server}/sources`);
|
|
123
|
-
srcUrl.searchParams.set(
|
|
124
|
-
srcUrl.searchParams.set(
|
|
125
|
-
srcUrl.searchParams.set(
|
|
126
|
-
srcUrl.searchParams.set(
|
|
127
|
-
if (isTv) {
|
|
128
|
-
srcUrl.searchParams.set(
|
|
129
|
-
srcUrl.searchParams.set(
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const res = await fetch(srcUrl.toString(), {
|
|
133
|
-
headers,
|
|
134
|
-
signal: AbortSignal.timeout(6000),
|
|
135
|
-
});
|
|
136
|
-
if (!res.ok) continue;
|
|
137
|
-
|
|
138
|
-
const text = await res.text();
|
|
139
|
-
|
|
140
|
-
let data;
|
|
141
|
-
try {
|
|
142
|
-
data = JSON.parse(decryptVidy(text, seed, mediaId));
|
|
143
|
-
} catch {
|
|
144
|
-
continue;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const sources = data?.sources || [];
|
|
148
|
-
const playlist = data?.playlist ||
|
|
149
|
-
if (!sources.length && !playlist) continue;
|
|
150
|
-
|
|
151
|
-
let streamUrl = playlist;
|
|
152
|
-
let quality =
|
|
153
|
-
|
|
154
|
-
for (const src of sources) {
|
|
155
|
-
if (src?.quality ===
|
|
156
|
-
streamUrl = src.url;
|
|
157
|
-
quality =
|
|
158
|
-
break;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
if (!streamUrl && sources.length) {
|
|
162
|
-
streamUrl = sources[0]?.url ||
|
|
163
|
-
quality = sources[0]?.quality ||
|
|
164
|
-
}
|
|
165
|
-
if (!streamUrl) continue;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
url: streamUrl,
|
|
169
|
-
headers
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
1
|
+
import { getUA } from '../utils/helpers.js';
|
|
2
|
+
|
|
3
|
+
const API_URL = 'https://api.wecollege.net';
|
|
4
|
+
const SERVERS = ['miami', 'atlanta', 'seattle', 'denver', 'dallas', 'tampa'];
|
|
5
|
+
const MAGIC = [109, 118, 109, 49];
|
|
6
|
+
|
|
7
|
+
function imul(a, b) {
|
|
8
|
+
return Math.imul(a | 0, b | 0) >>> 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function pFn(e) {
|
|
12
|
+
e = e >>> 0;
|
|
13
|
+
e = (e ^ (e >>> 16)) >>> 0;
|
|
14
|
+
e = imul(e, 2246822507);
|
|
15
|
+
e = (e ^ (e >>> 13)) >>> 0;
|
|
16
|
+
e = imul(e, 3266489909);
|
|
17
|
+
e = (e ^ (e >>> 16)) >>> 0;
|
|
18
|
+
return e;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function gFn(e, t) {
|
|
22
|
+
e = e >>> 0;
|
|
23
|
+
t = t & 31;
|
|
24
|
+
if (t === 0) return e;
|
|
25
|
+
return ((e << t) | (e >>> (32 - t))) >>> 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function decryptVidy(ciphertext, seedStr, mediaId) {
|
|
29
|
+
let padded = ciphertext.replace(/-/g, '+').replace(/_/g, '/');
|
|
30
|
+
while (padded.length % 4) padded += '=';
|
|
31
|
+
|
|
32
|
+
const raw = new Uint8Array(Buffer.from(padded, 'base64'));
|
|
33
|
+
const length = raw.length;
|
|
34
|
+
|
|
35
|
+
let tFnv = 2166136261;
|
|
36
|
+
for (let i = 0; i < seedStr.length; i++) {
|
|
37
|
+
tFnv = imul((tFnv ^ seedStr.charCodeAt(i)) >>> 0, 16777619);
|
|
38
|
+
}
|
|
39
|
+
const fnvRes = pFn(tFnv);
|
|
40
|
+
|
|
41
|
+
const innerArg = (((mediaId >>> 0) ^ 2654435769) >>> 0);
|
|
42
|
+
const inner = pFn(innerArg);
|
|
43
|
+
let n = pFn(((fnvRes ^ inner) >>> 0));
|
|
44
|
+
|
|
45
|
+
const S = {};
|
|
46
|
+
for (let e = 0; e < 8; e++) {
|
|
47
|
+
const t = n % 61;
|
|
48
|
+
n = gFn((n + 2654435769) >>> 0, 7 + (7 & e));
|
|
49
|
+
S[t] = ((n ^ pFn(n)) >>> 0);
|
|
50
|
+
n = pFn((n + t) >>> 0);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let acc = pFn(((2779096485 ^ n) >>> 0));
|
|
54
|
+
const keystream = new Uint8Array(length);
|
|
55
|
+
let sCnt = 0;
|
|
56
|
+
let idx = 0;
|
|
57
|
+
|
|
58
|
+
while (idx < length) {
|
|
59
|
+
const sVal = acc;
|
|
60
|
+
const o = sVal % 61;
|
|
61
|
+
const hasO = Object.prototype.hasOwnProperty.call(S, o);
|
|
62
|
+
const iVal = hasO ? -1 : 0;
|
|
63
|
+
const d = hasO ? S[o] : 0;
|
|
64
|
+
const nTerm = ((d ^ imul(2654435769, sCnt + 1)) >>> 0);
|
|
65
|
+
sCnt += 1;
|
|
66
|
+
const aTerm = sVal;
|
|
67
|
+
let lVal = (((aTerm ^ nTerm) | (aTerm & nTerm & iVal)) >>> 0);
|
|
68
|
+
const term1 = gFn((lVal + sVal) >>> 0, 31 & o);
|
|
69
|
+
const term2 = gFn(sVal, (31 & imul(o, 7)) >>> 0);
|
|
70
|
+
lVal = ((term1 ^ term2) >>> 0);
|
|
71
|
+
const newS = pFn((lVal + 2654435769) >>> 0);
|
|
72
|
+
S[o] = newS;
|
|
73
|
+
acc = newS;
|
|
74
|
+
const tVal = newS;
|
|
75
|
+
|
|
76
|
+
keystream[idx++] = tVal & 0xFF;
|
|
77
|
+
if (idx < length) keystream[idx++] = (tVal >>> 8) & 0xFF;
|
|
78
|
+
if (idx < length) keystream[idx++] = (tVal >>> 16) & 0xFF;
|
|
79
|
+
if (idx < length) keystream[idx++] = (tVal >>> 24) & 0xFF;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
for (let i = 0; i < length; i++) {
|
|
83
|
+
raw[i] ^= keystream[i];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
for (let i = 0; i < MAGIC.length; i++) {
|
|
87
|
+
if (raw[i] !== MAGIC[i]) {
|
|
88
|
+
throw new Error('Vidy decrypt failed: magic header mismatch');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return new TextDecoder().decode(raw.slice(MAGIC.length));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export async function getStream(args) {
|
|
96
|
+
const { id, s, e } = args || {};
|
|
97
|
+
const isTv = s != null && e != null;
|
|
98
|
+
const mediaId = Number(id);
|
|
99
|
+
|
|
100
|
+
const headers = {
|
|
101
|
+
'User-Agent': getUA(),
|
|
102
|
+
Referer: 'https://www.vidy.st/',
|
|
103
|
+
Origin: 'https://www.vidy.st',
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
try {
|
|
107
|
+
const seedUrl = new URL(`${API_URL}/seed`);
|
|
108
|
+
seedUrl.searchParams.set('mediaId', String(id));
|
|
109
|
+
|
|
110
|
+
const seedRes = await fetch(seedUrl.toString(), {
|
|
111
|
+
headers,
|
|
112
|
+
signal: AbortSignal.timeout(6000),
|
|
113
|
+
});
|
|
114
|
+
if (!seedRes.ok) return null;
|
|
115
|
+
|
|
116
|
+
const seedData = await seedRes.json();
|
|
117
|
+
const seed = seedData?.seed;
|
|
118
|
+
if (!seed) return null;
|
|
119
|
+
|
|
120
|
+
for (const server of SERVERS) {
|
|
121
|
+
try {
|
|
122
|
+
const srcUrl = new URL(`${API_URL}/${server}/sources`);
|
|
123
|
+
srcUrl.searchParams.set('mediaType', isTv ? 'tv' : 'movie');
|
|
124
|
+
srcUrl.searchParams.set('tmdbId', String(id));
|
|
125
|
+
srcUrl.searchParams.set('enc', '2');
|
|
126
|
+
srcUrl.searchParams.set('seed', seed);
|
|
127
|
+
if (isTv) {
|
|
128
|
+
srcUrl.searchParams.set('seasonId', String(s));
|
|
129
|
+
srcUrl.searchParams.set('episodeId', String(e));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const res = await fetch(srcUrl.toString(), {
|
|
133
|
+
headers,
|
|
134
|
+
signal: AbortSignal.timeout(6000),
|
|
135
|
+
});
|
|
136
|
+
if (!res.ok) continue;
|
|
137
|
+
|
|
138
|
+
const text = await res.text();
|
|
139
|
+
|
|
140
|
+
let data;
|
|
141
|
+
try {
|
|
142
|
+
data = JSON.parse(decryptVidy(text, seed, mediaId));
|
|
143
|
+
} catch {
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const sources = data?.sources || [];
|
|
148
|
+
const playlist = data?.playlist || '';
|
|
149
|
+
if (!sources.length && !playlist) continue;
|
|
150
|
+
|
|
151
|
+
let streamUrl = playlist;
|
|
152
|
+
let quality = '1080p';
|
|
153
|
+
|
|
154
|
+
for (const src of sources) {
|
|
155
|
+
if (src?.quality === '1080p' && src?.url) {
|
|
156
|
+
streamUrl = src.url;
|
|
157
|
+
quality = '1080p';
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (!streamUrl && sources.length) {
|
|
162
|
+
streamUrl = sources[0]?.url || '';
|
|
163
|
+
quality = sources[0]?.quality || '';
|
|
164
|
+
}
|
|
165
|
+
if (!streamUrl) continue;
|
|
166
|
+
|
|
167
|
+
const allUrls = [{
|
|
168
|
+
url: streamUrl,
|
|
169
|
+
headers,
|
|
170
|
+
server: 'Vidy',
|
|
171
|
+
quality,
|
|
172
|
+
type: streamUrl.includes('.m3u8') ? 'hls' : 'mp4',
|
|
173
|
+
}];
|
|
174
|
+
|
|
175
|
+
return {
|
|
176
|
+
url: streamUrl,
|
|
177
|
+
headers,
|
|
178
|
+
server: 'Vidy',
|
|
179
|
+
quality,
|
|
180
|
+
type: streamUrl.includes('.m3u8') ? 'hls' : 'mp4',
|
|
181
|
+
allUrls,
|
|
182
|
+
};
|
|
183
|
+
} catch {
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return null;
|
|
189
|
+
} catch {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
}
|