mirror of
https://git.luna-app.eu/50n50/sources
synced 2025-12-21 21:26:19 +01:00
Update 1movies/1movies.js
This commit is contained in:
parent
0540a0c298
commit
d6d09ad331
1 changed files with 38 additions and 7 deletions
|
|
@ -233,14 +233,45 @@ async function extractStreamUrl(url) {
|
|||
const finalResponse = await fetchv2("https://ilovekai.simplepostrequest.workers.dev/ilovebush", {}, "POST", JSON.stringify(postData));
|
||||
const finalJson = await finalResponse.json();
|
||||
|
||||
const m3u8Link = finalJson?.result?.sources?.[0]?.file;
|
||||
const m3u8Link = finalJson?.result?.sources?.[0]?.file;
|
||||
|
||||
const m3u8Response = await fetchv2(m3u8Link);
|
||||
const m3u8Text = await m3u8Response.text();
|
||||
|
||||
const returnValue = {
|
||||
stream: m3u8Link,
|
||||
subtitles: englishSubUrl
|
||||
};
|
||||
console.log(JSON.stringify(returnValue));
|
||||
return JSON.stringify(returnValue);
|
||||
const baseUrl = m3u8Link.substring(0, m3u8Link.lastIndexOf('/') + 1);
|
||||
|
||||
const streams = [];
|
||||
const lines = m3u8Text.split('\n');
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i].trim();
|
||||
if (line.startsWith('#EXT-X-STREAM-INF:')) {
|
||||
const resolutionMatch = line.match(/RESOLUTION=(\d+x\d+)/);
|
||||
let quality = 'Unknown';
|
||||
|
||||
if (resolutionMatch) {
|
||||
const [width, height] = resolutionMatch[1].split('x');
|
||||
quality = `${height}p`;
|
||||
}
|
||||
|
||||
if (i + 1 < lines.length) {
|
||||
const streamPath = lines[i + 1].trim();
|
||||
const streamUrl = baseUrl + streamPath;
|
||||
|
||||
streams.push({
|
||||
title: quality,
|
||||
streamUrl: streamUrl
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const returnValue = {
|
||||
streams: streams,
|
||||
subtitle: englishSubUrl !== "N/A" ? englishSubUrl : ""
|
||||
};
|
||||
console.log("RETURN: " + JSON.stringify(returnValue));
|
||||
return JSON.stringify(returnValue);
|
||||
} catch (error) {
|
||||
console.log("Fetch error:"+ error);
|
||||
return "https://error.org";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue