From 1aa6f864e2e41b57e60a8cd653063376b7e7bcd4 Mon Sep 17 00:00:00 2001 From: real-zephex Date: Tue, 19 Mar 2024 09:37:36 +0530 Subject: fix: redirects to 404 when an anime stream is not available --- src/app/video/[animeId]/page.jsx | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/app/video') 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 ( -- cgit v1.2.3