@vyla-entertainment/sdk 1.12.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.
- package/package.json +1 -1
- package/src/config.js +7 -230
- package/src/sources/dulo.js +150 -0
- package/src/sources/streamaggregator.js +5 -3
- package/src/sources/4khdhub.js +0 -324
- package/src/sources/cinejoy.js +0 -195
- package/src/sources/cinesrc.js +0 -212
- package/src/sources/cinesu.js +0 -148
- package/src/sources/downloadeverything.js +0 -338
- package/src/sources/frame.js +0 -88
- package/src/sources/fsharetv.js +0 -44
- package/src/sources/fsonic.js +0 -49
- package/src/sources/hexa.js +0 -82
- package/src/sources/luna.js +0 -125
- package/src/sources/meowtv.js +0 -142
- package/src/sources/peestream.js +0 -122
- package/src/sources/vadapav.js +0 -85
- package/src/sources/vidcore.js +0 -43
- package/src/sources/vidfast.js +0 -53
- package/src/sources/vuflix.js +0 -249
package/src/sources/vuflix.js
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import { getUA } from '../utils/helpers.js';
|
|
2
|
-
|
|
3
|
-
const API_BASE = 'https://vuflix.co';
|
|
4
|
-
const REFERER = 'https://vuflix.co/';
|
|
5
|
-
const ORIGIN = 'https://vuflix.co';
|
|
6
|
-
|
|
7
|
-
let cachedProviders = null;
|
|
8
|
-
let lastProvidersFetch = 0;
|
|
9
|
-
|
|
10
|
-
const FALLBACK_PROVIDERS = [
|
|
11
|
-
{ id: 'vsembed', name: 'Sigma' },
|
|
12
|
-
{ id: 'moonflix', name: 'Source 40' },
|
|
13
|
-
{ id: 'megasource', name: 'Source 39' },
|
|
14
|
-
{ id: 'hdghar', name: 'Source 44' },
|
|
15
|
-
{ id: 'moviebox', name: 'Pi' },
|
|
16
|
-
{ id: 'cineplay', name: '4K' },
|
|
17
|
-
{ id: 'huhu', name: 'Beta' },
|
|
18
|
-
{ id: 'bingr', name: 'Upsilon' },
|
|
19
|
-
{ id: 'onlyflix', name: 'Gamma' },
|
|
20
|
-
{ id: 'vaplayer', name: 'Alpha' },
|
|
21
|
-
{ id: 'flixhqz', name: 'Gamma' },
|
|
22
|
-
{ id: 'castle', name: 'Source 40' },
|
|
23
|
-
{ id: 'cinejoy', name: '4K2' },
|
|
24
|
-
{ id: 'filesun', name: 'Tau' },
|
|
25
|
-
{ id: 'yoru', name: 'Yoru' },
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
async function getProviders(ua) {
|
|
29
|
-
if (cachedProviders && Date.now() - lastProvidersFetch < 900000) {
|
|
30
|
-
return cachedProviders;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
try {
|
|
34
|
-
const res = await fetch(`${API_BASE}/api/player/providers`, {
|
|
35
|
-
headers: {
|
|
36
|
-
'User-Agent': ua,
|
|
37
|
-
Referer: REFERER,
|
|
38
|
-
Origin: ORIGIN,
|
|
39
|
-
Accept: 'application/json, text/plain, */*',
|
|
40
|
-
},
|
|
41
|
-
signal: AbortSignal.timeout(6000),
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
if (res.ok) {
|
|
45
|
-
const data = await res.json();
|
|
46
|
-
if (data?.ok && Array.isArray(data.providers)) {
|
|
47
|
-
const list = data.providers
|
|
48
|
-
.filter(p => p && typeof p.id === 'string' && p.id.trim().length > 0)
|
|
49
|
-
.map(p => ({
|
|
50
|
-
id: p.id.trim(),
|
|
51
|
-
name: p.publicLabel || p.providerName || p.name || p.id,
|
|
52
|
-
}));
|
|
53
|
-
|
|
54
|
-
if (list.length > 0) {
|
|
55
|
-
cachedProviders = list;
|
|
56
|
-
lastProvidersFetch = Date.now();
|
|
57
|
-
return list;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
} catch { }
|
|
62
|
-
|
|
63
|
-
return FALLBACK_PROVIDERS;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function unwrapUrl(rawUrl, ua) {
|
|
67
|
-
const defaultHeaders = {
|
|
68
|
-
'User-Agent': ua,
|
|
69
|
-
Referer: REFERER,
|
|
70
|
-
Origin: ORIGIN,
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
if (!rawUrl || typeof rawUrl !== 'string') {
|
|
74
|
-
return { url: '', headers: defaultHeaders };
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (!rawUrl.includes('v-relay?t=') && !rawUrl.includes('a-relay?t=')) {
|
|
78
|
-
return { url: rawUrl, headers: defaultHeaders };
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
try {
|
|
82
|
-
const parsedUrl = new URL(rawUrl);
|
|
83
|
-
const t = parsedUrl.searchParams.get('t');
|
|
84
|
-
if (!t) return { url: rawUrl, headers: defaultHeaders };
|
|
85
|
-
|
|
86
|
-
let b64 = t.replace(/-/g, '+').replace(/_/g, '/');
|
|
87
|
-
while (b64.length % 4 !== 0) {
|
|
88
|
-
b64 += '=';
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const jsonStr = Buffer.from(b64, 'base64').toString('utf8');
|
|
92
|
-
const parsed = JSON.parse(jsonStr);
|
|
93
|
-
|
|
94
|
-
if (parsed && typeof parsed === 'object') {
|
|
95
|
-
const directUrl = (parsed.u || '').trim();
|
|
96
|
-
const headersMap = { ...defaultHeaders };
|
|
97
|
-
|
|
98
|
-
if (parsed.h && typeof parsed.h === 'object') {
|
|
99
|
-
for (const [key, value] of Object.entries(parsed.h)) {
|
|
100
|
-
headersMap[key] = String(value);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (directUrl) {
|
|
105
|
-
return { url: directUrl, headers: headersMap };
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
} catch { }
|
|
109
|
-
|
|
110
|
-
return { url: rawUrl, headers: defaultHeaders };
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export async function getStream({ id, s, e }) {
|
|
114
|
-
const isTv = Boolean(s && e);
|
|
115
|
-
const mediaType = isTv ? 'tv' : 'movie';
|
|
116
|
-
const ua = getUA();
|
|
117
|
-
|
|
118
|
-
const baseParams = new URLSearchParams({
|
|
119
|
-
type: mediaType,
|
|
120
|
-
tmdbId: String(id),
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
if (isTv) {
|
|
124
|
-
baseParams.set('season', String(s));
|
|
125
|
-
baseParams.set('episode', String(e));
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
const providers = await getProviders(ua);
|
|
129
|
-
const seenUrls = new Set();
|
|
130
|
-
const allUrls = [];
|
|
131
|
-
|
|
132
|
-
const defaultHeaders = {
|
|
133
|
-
'User-Agent': ua,
|
|
134
|
-
Referer: REFERER,
|
|
135
|
-
Origin: ORIGIN,
|
|
136
|
-
Accept: 'application/json, text/plain, */*',
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
const tasks = providers.map(async (prov) => {
|
|
140
|
-
try {
|
|
141
|
-
const url = `${API_BASE}/api/player/sources?${baseParams.toString()}&provider=${encodeURIComponent(prov.id)}`;
|
|
142
|
-
const res = await fetch(url, {
|
|
143
|
-
headers: defaultHeaders,
|
|
144
|
-
signal: AbortSignal.timeout(8000),
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
if (!res.ok) return;
|
|
148
|
-
const data = await res.json();
|
|
149
|
-
if (!data?.ok || !Array.isArray(data.sources)) return;
|
|
150
|
-
|
|
151
|
-
for (const item of data.sources) {
|
|
152
|
-
if (!item || typeof item !== 'object') continue;
|
|
153
|
-
|
|
154
|
-
const providerName = item.providerName || item.publicLabel || prov.name;
|
|
155
|
-
const primaryRawUrl = (item.url || '').trim();
|
|
156
|
-
const itemType = (item.type || 'hls').toLowerCase();
|
|
157
|
-
const itemLabel = item.label || '';
|
|
158
|
-
|
|
159
|
-
if (Array.isArray(item.qualities) && item.qualities.length > 0) {
|
|
160
|
-
for (const q of item.qualities) {
|
|
161
|
-
if (!q || typeof q !== 'object') continue;
|
|
162
|
-
const qRawUrl = (q.url || '').trim();
|
|
163
|
-
if (!qRawUrl) continue;
|
|
164
|
-
|
|
165
|
-
const unwrapped = unwrapUrl(qRawUrl, ua);
|
|
166
|
-
if (!unwrapped.url || seenUrls.has(unwrapped.url)) continue;
|
|
167
|
-
seenUrls.add(unwrapped.url);
|
|
168
|
-
|
|
169
|
-
const qQuality = q.quality || 'Auto';
|
|
170
|
-
allUrls.push({
|
|
171
|
-
url: unwrapped.url,
|
|
172
|
-
label: `${providerName} · ${qQuality}`,
|
|
173
|
-
headers: unwrapped.headers,
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
if (Array.isArray(item.candidates) && item.candidates.length > 0) {
|
|
179
|
-
let candIndex = 1;
|
|
180
|
-
for (const c of item.candidates) {
|
|
181
|
-
if (!c || typeof c !== 'object') continue;
|
|
182
|
-
const cRawUrl = (c.url || '').trim();
|
|
183
|
-
if (!cRawUrl) continue;
|
|
184
|
-
|
|
185
|
-
const unwrapped = unwrapUrl(cRawUrl, ua);
|
|
186
|
-
if (!unwrapped.url || seenUrls.has(unwrapped.url)) continue;
|
|
187
|
-
seenUrls.add(unwrapped.url);
|
|
188
|
-
|
|
189
|
-
const cQuality = c.quality || '1080p';
|
|
190
|
-
allUrls.push({
|
|
191
|
-
url: unwrapped.url,
|
|
192
|
-
label: `${providerName} · Mirror ${candIndex} · ${cQuality}`,
|
|
193
|
-
headers: unwrapped.headers,
|
|
194
|
-
});
|
|
195
|
-
candIndex++;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (Array.isArray(item.audioTracks) && item.audioTracks.length > 0) {
|
|
200
|
-
for (const a of item.audioTracks) {
|
|
201
|
-
if (!a || typeof a !== 'object') continue;
|
|
202
|
-
const aRawUrl = (a.switchUrl || a.url || '').trim();
|
|
203
|
-
if (!aRawUrl) continue;
|
|
204
|
-
|
|
205
|
-
const unwrapped = unwrapUrl(aRawUrl, ua);
|
|
206
|
-
if (!unwrapped.url || seenUrls.has(unwrapped.url)) continue;
|
|
207
|
-
seenUrls.add(unwrapped.url);
|
|
208
|
-
|
|
209
|
-
const rawLabel = (a.label || a.name || a.language || 'Audio').trim();
|
|
210
|
-
const cleanLabel = rawLabel.replace(/\s*audio\s*$/i, '').trim() || 'Audio';
|
|
211
|
-
|
|
212
|
-
allUrls.push({
|
|
213
|
-
url: unwrapped.url,
|
|
214
|
-
label: `${providerName} · ${cleanLabel} Audio`,
|
|
215
|
-
headers: unwrapped.headers,
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (primaryRawUrl) {
|
|
221
|
-
const unwrapped = unwrapUrl(primaryRawUrl, ua);
|
|
222
|
-
if (unwrapped.url && !seenUrls.has(unwrapped.url)) {
|
|
223
|
-
seenUrls.add(unwrapped.url);
|
|
224
|
-
|
|
225
|
-
let displayQuality = item.quality || (itemType === 'mp4' ? 'MP4' : 'HD');
|
|
226
|
-
let cleanLabel = itemLabel || providerName;
|
|
227
|
-
let label = cleanLabel.startsWith('[') ? cleanLabel : `${providerName} · ${displayQuality}`;
|
|
228
|
-
|
|
229
|
-
allUrls.push({
|
|
230
|
-
url: unwrapped.url,
|
|
231
|
-
label,
|
|
232
|
-
headers: unwrapped.headers,
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
} catch { }
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
await Promise.all(tasks);
|
|
241
|
-
|
|
242
|
-
if (allUrls.length === 0) return null;
|
|
243
|
-
|
|
244
|
-
return {
|
|
245
|
-
url: allUrls[0].url,
|
|
246
|
-
allUrls,
|
|
247
|
-
headers: allUrls[0].headers,
|
|
248
|
-
};
|
|
249
|
-
}
|