mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-10 02:04:38 +00:00
fix: kodik encrypted links decrypting
This commit is contained in:
parent
84698dafca
commit
2d4eacfdf8
1 changed files with 25 additions and 8 deletions
|
@ -105,18 +105,30 @@ export const ReleasePlayerCustom = (props: {
|
||||||
}
|
}
|
||||||
|
|
||||||
const _fetchKodikManifest = async (url: string) => {
|
const _fetchKodikManifest = async (url: string) => {
|
||||||
|
// Fetch data through a proxy
|
||||||
const data = await _fetchPlayer(
|
const data = await _fetchPlayer(
|
||||||
`https://anix-player.wah.su/?url=${url}&player=kodik`
|
`https://anix-player.wah.su/?url=${url}&player=kodik`
|
||||||
);
|
);
|
||||||
if (data) {
|
if (data) {
|
||||||
let lowQualityLink = data.links["360"][0].src;
|
let lowQualityLink = data.links["360"][0].src; // we assume that 360p is always present
|
||||||
if (lowQualityLink.includes("https://")) {
|
|
||||||
|
if (!lowQualityLink.includes("//")) { // check if link is encrypted, else do nothing
|
||||||
|
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://")) { // string the https prefix, since we add it manually
|
||||||
lowQualityLink = lowQualityLink.replace("https://", "//");
|
lowQualityLink = lowQualityLink.replace("https://", "//");
|
||||||
}
|
}
|
||||||
|
|
||||||
let manifest = `https:${lowQualityLink.replace("360.mp4:hls:", "")}`;
|
let manifest = `https:${lowQualityLink.replace("360.mp4:hls:", "")}`;
|
||||||
let poster = `https:${lowQualityLink.replace("360.mp4:hls:manifest.m3u8", "thumb001.jpg")}`;
|
let poster = `https:${lowQualityLink.replace("360.mp4:hls:manifest.m3u8", "thumb001.jpg")}`;
|
||||||
|
|
||||||
if (lowQualityLink.includes("animetvseries")) {
|
if (lowQualityLink.includes("animetvseries")) { // if link includes "animetvseries" we need to construct manifest ourselves
|
||||||
let blobTxt = "#EXTM3U\n";
|
let blobTxt = "#EXTM3U\n";
|
||||||
|
|
||||||
if (data.links.hasOwnProperty("240")) {
|
if (data.links.hasOwnProperty("240")) {
|
||||||
|
@ -212,7 +224,7 @@ export const ReleasePlayerCustom = (props: {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
__getInfo();
|
__getInfo();
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [props.id, props.token]);
|
}, [props.id, props.token]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -245,7 +257,7 @@ export const ReleasePlayerCustom = (props: {
|
||||||
if (voiceover.selected) {
|
if (voiceover.selected) {
|
||||||
__getInfo();
|
__getInfo();
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [voiceover.selected]);
|
}, [voiceover.selected]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -286,7 +298,7 @@ export const ReleasePlayerCustom = (props: {
|
||||||
if (source.selected) {
|
if (source.selected) {
|
||||||
__getInfo();
|
__getInfo();
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [source.selected]);
|
}, [source.selected]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -349,7 +361,7 @@ export const ReleasePlayerCustom = (props: {
|
||||||
setPlayerError(null);
|
setPlayerError(null);
|
||||||
__getInfo();
|
__getInfo();
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [episode.selected]);
|
}, [episode.selected]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -437,7 +449,12 @@ export const ReleasePlayerCustom = (props: {
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
: <iframe src={playerProps.src} className="w-full aspect-video" allowFullScreen={true} />}
|
: <iframe
|
||||||
|
src={playerProps.src}
|
||||||
|
className="w-full aspect-video"
|
||||||
|
allowFullScreen={true}
|
||||||
|
/>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue