diff --git a/app/components/ReleasePlayer/PlayerParsing.ts b/app/components/ReleasePlayer/PlayerParsing.ts index bb87f33..8b57b7f 100644 --- a/app/components/ReleasePlayer/PlayerParsing.ts +++ b/app/components/ReleasePlayer/PlayerParsing.ts @@ -61,15 +61,6 @@ export async function _fetchPlayer( return data; } -function decryptKodikLink(enc: string) { - const decryptedBase64 = enc.replace(/[a-zA-Z]/g, (e: any) => { - return String.fromCharCode( - (e <= "Z" ? 90 : 122) >= (e = e.charCodeAt(0) + 18) ? e : e - 26 - ); - }); - return atob(decryptedBase64); -} - export const _fetchKodikManifest = async ( url: string, setPlayerError: (state) => void @@ -84,107 +75,52 @@ export const _fetchKodikManifest = async ( if (!lowQualityLink.includes("//")) { // check if link is encrypted, else do nothing - lowQualityLink = decryptKodikLink(lowQualityLink); + const decryptedBase64 = lowQualityLink.replace(/[a-zA-Z]/g, (e) => { + return String.fromCharCode( + (e <= "Z" ? 90 : 122) >= (e = e.charCodeAt(0) + 18) ? e : e - 26 + ); + }); + lowQualityLink = atob(decryptedBase64); } if (lowQualityLink.includes("https://")) { - // strip the https prefix, since we add it manually + // string the https prefix, since we add it manually lowQualityLink = lowQualityLink.replace("https://", "//"); } let manifest = `https:${lowQualityLink.replace("360.mp4:hls:", "")}`; let poster = `https:${lowQualityLink.replace("360.mp4:hls:manifest.m3u8", "thumb001.jpg")}`; - if ( - lowQualityLink.includes("animetvseries") || - lowQualityLink.includes("tvseries") - ) { - // if link includes "animetvseries" or "tvseries" we need to construct manifest ourselves + if (lowQualityLink.includes("animetvseries")) { + // if link includes "animetvseries" we need to construct manifest ourselves let blobTxt = "#EXTM3U\n"; if (data.links.hasOwnProperty("240")) { blobTxt += "#EXT-X-STREAM-INF:RESOLUTION=427x240,BANDWIDTH=200000\n"; - let link = data.links["240"][0].src; - let dec = null; - link.includes("//") ? - link.startsWith("https:") ? - (blobTxt += `${link}\n`) - : (blobTxt += `https:${link}\n`) - : (dec = decryptKodikLink(link)); - - dec ? - dec.startsWith("https:") ? - (blobTxt += `${dec}\n`) - : (blobTxt += `https:${dec}\n`) - : null; + !data.links["240"][0].src.startsWith("https:") ? + (blobTxt += `https:${data.links["240"][0].src}\n`) + : (blobTxt += `${data.links["240"][0].src}\n`); } if (data.links.hasOwnProperty("360")) { blobTxt += "#EXT-X-STREAM-INF:RESOLUTION=578x360,BANDWIDTH=400000\n"; - let link = data.links["360"][0].src; - let dec = null; - link.includes("//") ? - link.startsWith("https:") ? - (blobTxt += `${link}\n`) - : (blobTxt += `https:${link}\n`) - : (dec = decryptKodikLink(link)); - - dec ? - dec.startsWith("https:") ? - (blobTxt += `${dec}\n`) - : (blobTxt += `https:${dec}\n`) - : null; + !data.links["360"][0].src.startsWith("https:") ? + (blobTxt += `https:${data.links["360"][0].src}\n`) + : (blobTxt += `${data.links["360"][0].src}\n`); } if (data.links.hasOwnProperty("480")) { blobTxt += "#EXT-X-STREAM-INF:RESOLUTION=854x480,BANDWIDTH=596000\n"; - let link = data.links["480"][0].src; - let dec = null; - link.includes("//") ? - link.startsWith("https:") ? - (blobTxt += `${link}\n`) - : (blobTxt += `https:${link}\n`) - : (dec = decryptKodikLink(link)); - - dec ? - dec.startsWith("https:") ? - (blobTxt += `${dec}\n`) - : (blobTxt += `https:${dec}\n`) - : null; + !data.links["480"][0].src.startsWith("https:") ? + (blobTxt += `https:${data.links["480"][0].src}\n`) + : (blobTxt += `${data.links["480"][0].src}\n`); } if (data.links.hasOwnProperty("720")) { blobTxt += "#EXT-X-STREAM-INF:RESOLUTION=1280x720,BANDWIDTH=1280000\n"; - let link = data.links["720"][0].src; - let dec = null; - link.includes("//") ? - link.startsWith("https:") ? - (blobTxt += `${link}\n`) - : (blobTxt += `https:${link}\n`) - : (dec = decryptKodikLink(link)); - - dec ? - dec.startsWith("https:") ? - (blobTxt += `${dec}\n`) - : (blobTxt += `https:${dec}\n`) - : null; - } - - if (data.links.hasOwnProperty("1080")) { - blobTxt += "#EXT-X-STREAM-INF:RESOLUTION=1920x1080,BANDWIDTH=2560000\n"; - let link = data.links["1080"][0].src; - let dec = null; - link.includes("//") ? - link.startsWith("https:") ? - (blobTxt += `${link}\n`) - : (blobTxt += `https:${link}\n`) - : (dec = decryptKodikLink(link)); - - dec ? - dec.startsWith("https:") ? - (blobTxt += `${dec}\n`) - : (blobTxt += `https:${dec}\n`) - : null; + !data.links["720"][0].src.startsWith("https:") ? + (blobTxt += `https:${data.links["720"][0].src}\n`) + : (blobTxt += `${data.links["720"][0].src}\n`); } let file = new File([blobTxt], "manifest.m3u8", { @@ -203,7 +139,7 @@ export const _fetchAnilibriaManifest = async ( ) => { const id = url.split("?id=")[1].split("&ep=")[0]; const epid = url.split("?id=")[1].split("&ep=")[1]; - const _url = `https://api.anilibria.tv/v3/title?id=${id}`; + const _url = `https://api.anilibria.tv/v3/title?id=${id}` const data = await _fetchPlayer( `https://anix-player.wah.su/?url=${_url}&player=libria`, setPlayerError