aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorreal-zephex <[email protected]>2024-03-19 09:37:36 +0530
committerreal-zephex <[email protected]>2024-03-19 09:37:36 +0530
commit1aa6f864e2e41b57e60a8cd653063376b7e7bcd4 (patch)
tree8292d9401e4b3260d5872711d2f0720a2ec79ad4 /src
parentfixes: change the file extension to .jsx and fixed the video player sizes for... (diff)
downloaddramalama-1aa6f864e2e41b57e60a8cd653063376b7e7bcd4.tar.xz
dramalama-1aa6f864e2e41b57e60a8cd653063376b7e7bcd4.zip
fix: redirects to 404 when an anime stream is not available
Diffstat (limited to 'src')
-rw-r--r--src/app/video/[animeId]/page.jsx9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/app/video/[animeId]/page.jsx b/src/app/video/[animeId]/page.jsx
index d7e68f9..02f6197 100644
--- a/src/app/video/[animeId]/page.jsx
+++ b/src/app/video/[animeId]/page.jsx
@@ -6,13 +6,22 @@ import {
plyrLayoutIcons,
} from "@vidstack/react/player/layouts/plyr";
import "../video.css";
+import { redirect } from "next/navigation";
export default async function Video({ params }) {
const id = params.animeId;
+
+ // Getting the episode number and the anime name. Kindly ignore!
const words = id.split("-");
const last_two = words.slice(-2).join(" ");
const remainingWords = words.slice(0, -2).join(" ");
+
const data = await getVideoLink(id);
+
+ if (data.message) {
+ redirect("/404");
+ }
+
const link = data.sources[3].url;
return (