This commit is contained in:
+24
-4
@@ -98,13 +98,33 @@ async function extractStreamUrl(slug) {
|
|||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
if (data?.sources?.length) {
|
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({
|
streams.push({
|
||||||
title: `${server.id} - ${source.quality} - ${subType.toUpperCase()}`,
|
title: `${server.id} - ${quality} - ${subType.toUpperCase()}`,
|
||||||
streamUrl: `https://mega-cloud.top/proxy${source.url}`,
|
streamUrl: streamUrl,
|
||||||
headers: headers
|
headers: headers
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`Error fetching streams for server ${server.id} (${subType}):`, e);
|
console.error(`Error fetching streams for server ${server.id} (${subType}):`, e);
|
||||||
|
|||||||
Reference in New Issue
Block a user