This commit is contained in:
+24
-4
@@ -98,13 +98,33 @@ async function extractStreamUrl(slug) {
|
||||
const data = await res.json();
|
||||
|
||||
if (data?.sources?.length) {
|
||||
data.sources.forEach(source => {
|
||||
for (const source of data.sources) {
|
||||
let streamUrl = `https://mega-cloud.top/proxy${source.url}`;
|
||||
let quality = source.quality;
|
||||
|
||||
if (server.id === 'kite') {
|
||||
try {
|
||||
const m3u8Res = await fetchv2(streamUrl, headers);
|
||||
const m3u8Content = await m3u8Res.text();
|
||||
const lines = m3u8Content.split('\n').filter(line => line.trim() !== '');
|
||||
const targetLine = lines.find(line => !line.startsWith('#'));
|
||||
if (targetLine) {
|
||||
streamUrl = `https://mega-cloud.top/proxy/oppai/kite/${targetLine.trim()}`;
|
||||
}
|
||||
if (quality.toLowerCase() === 'master') {
|
||||
quality = '1080p';
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Error rewriting kite URL:", e);
|
||||
}
|
||||
}
|
||||
|
||||
streams.push({
|
||||
title: `${server.id} - ${source.quality} - ${subType.toUpperCase()}`,
|
||||
streamUrl: `https://mega-cloud.top/proxy${source.url}`,
|
||||
title: `${server.id} - ${quality} - ${subType.toUpperCase()}`,
|
||||
streamUrl: streamUrl,
|
||||
headers: headers
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(`Error fetching streams for server ${server.id} (${subType}):`, e);
|
||||
|
||||
Reference in New Issue
Block a user