Update animekai/dub/animekai.js
This commit is contained in:
@@ -223,16 +223,16 @@ async function extractStreamUrl(url) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const decryptedUrls = await processStreams(streamUrls);
|
const decryptedUrls = await processStreams(streamUrls);
|
||||||
const decryptedDub = decryptedUrls.Dub || decryptedUrls.Sub || decryptedUrls.Softsub;
|
const decryptedSoftsub = decryptedUrls.Softsub || decryptedUrls.Dub || decryptedUrls.Sub;
|
||||||
|
|
||||||
console.log(decryptedDub);
|
|
||||||
const headers = {
|
const headers = {
|
||||||
"Referer": "https://anikai.to/",
|
"Referer": "https://anikai.to/",
|
||||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"
|
||||||
};
|
};
|
||||||
|
|
||||||
if (decryptedDub) {
|
if (decryptedSoftsub) {
|
||||||
const response = await fetchv2(decryptedDub.replace("/e/", "/media/"), headers);
|
const mediaUrl = decryptedSoftsub.replace("/e/", "/media/");
|
||||||
|
const response = await fetchv2(mediaUrl, headers);
|
||||||
const responseJson = await response.json();
|
const responseJson = await response.json();
|
||||||
const result = responseJson?.result;
|
const result = responseJson?.result;
|
||||||
|
|
||||||
@@ -243,9 +243,26 @@ async function extractStreamUrl(url) {
|
|||||||
|
|
||||||
const finalResponse = await fetchv2("https://enc-dec.app/api/dec-mega", { "Content-Type": "application/json" }, "POST", JSON.stringify(postData));
|
const finalResponse = await fetchv2("https://enc-dec.app/api/dec-mega", { "Content-Type": "application/json" }, "POST", JSON.stringify(postData));
|
||||||
const finalJson = await finalResponse.json();
|
const finalJson = await finalResponse.json();
|
||||||
|
|
||||||
const m3u8Link = finalJson?.result?.sources?.[0]?.file;
|
const m3u8Link = finalJson?.result?.sources?.[0]?.file;
|
||||||
|
|
||||||
return m3u8Link;
|
const tracks = finalJson?.result?.tracks || [];
|
||||||
|
const arabicSub = tracks.find(track => track.label && (track.label.includes("Arabic") || track.label.includes("العربية")));
|
||||||
|
let subtitleUrl = null;
|
||||||
|
if (arabicSub) {
|
||||||
|
subtitleUrl = arabicSub.file;
|
||||||
|
} else {
|
||||||
|
const englishSub = tracks.find(track => track.label && track.label.includes("English"));
|
||||||
|
if (englishSub) {
|
||||||
|
subtitleUrl = englishSub.file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const finalResult = {
|
||||||
|
stream: m3u8Link,
|
||||||
|
subtitles: subtitleUrl ? "https://deno-proxies-sznvnpnxwhbv.deno.dev/?url="+ encodeURIComponent(subtitleUrl) : null
|
||||||
|
};
|
||||||
|
return JSON.stringify(finalResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "error";
|
return "error";
|
||||||
|
|||||||
Reference in New Issue
Block a user