diff --git a/ashi/ashi.js b/ashi/ashi.js index 69436d5..63eee85 100644 --- a/ashi/ashi.js +++ b/ashi/ashi.js @@ -542,13 +542,14 @@ async function extractStreamUrl(url) { const streams = []; - const subStream = decryptedSub ? await getStream(decryptedSub.replace("megaup22", "megaup.site")) : null; + const [subStream, dubStream, rawStream] = await Promise.all([ + decryptedSub ? getStream(decryptedSub) : Promise.resolve(null), + decryptedDub ? getStream(decryptedDub) : Promise.resolve(null), + decryptedRaw ? getStream(decryptedRaw) : Promise.resolve(null) + ]); + if (subStream) streams.push("Hardsub English", subStream); - - const dubStream = decryptedDub ? await getStream(decryptedDub.replace("megaup22", "megaup.site")) : null; if (dubStream) streams.push("Dubbed English", dubStream); - - const rawStream = decryptedRaw ? await getStream(decryptedRaw.replace("megaup22", "megaup.site")) : null; if (rawStream) streams.push("Original audio", rawStream); const final = { @@ -666,14 +667,19 @@ async function extractStreamUrl(url) { "Useragent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36" }; - const finalResponse = await fetchv2("https://ilovekai.simplepostrequest.workers.dev/iloveass", {}, "POST", JSON.stringify(postData)); - const finalJson = await finalResponse.json(); + const [finalJson, m3u8Text] = await Promise.all([ + fetchv2("https://ilovekai.simplepostrequest.workers.dev/iloveass", {}, "POST", JSON.stringify(postData)).then(r => r.json()), + (async () => { + const finalResponse = await fetchv2("https://ilovekai.simplepostrequest.workers.dev/iloveass", {}, "POST", JSON.stringify(postData)); + const finalJson = await finalResponse.json(); + const m3u8Link = finalJson?.result?.sources?.[0]?.file; + const m3u8Response = await fetchv2(m3u8Link); + return m3u8Response.text(); + })() + ]); const m3u8Link = finalJson?.result?.sources?.[0]?.file; - const m3u8Response = await fetchv2(m3u8Link); - const m3u8Text = await m3u8Response.text(); - const baseUrl = m3u8Link.substring(0, m3u8Link.lastIndexOf('/') + 1); const streams = [];