more seasons

This commit is contained in:
Tejas Panchal
2025-07-29 18:40:32 +05:30
parent 20fce020c2
commit dc6f37da0c
5 changed files with 48 additions and 54 deletions

View File

@@ -1,10 +1,8 @@
/* eslint-disable react/prop-types */ /* eslint-disable react/prop-types */
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import BouncingLoader from "../ui/bouncingloader/Bouncingloader"; import BouncingLoader from "../ui/bouncingloader/Bouncingloader";
import axios from "axios";
export default function IframePlayer({ export default function IframePlayer({
animeId,
episodeId, episodeId,
serverName, serverName,
servertype, servertype,
@@ -14,7 +12,6 @@ export default function IframePlayer({
playNext, playNext,
autoNext, autoNext,
}) { }) {
const api_url=import.meta.env.VITE_API_URL;
const baseURL = const baseURL =
serverName.toLowerCase() === "hd-1" serverName.toLowerCase() === "hd-1"
? import.meta.env.VITE_BASE_IFRAME_URL ? import.meta.env.VITE_BASE_IFRAME_URL
@@ -37,26 +34,7 @@ export default function IframePlayer({
setIframeLoaded(false); setIframeLoaded(false);
setIframeSrc(""); setIframeSrc("");
const lowerName = serverName.toLowerCase(); setIframeSrc(`${baseURL}/${episodeId}/${servertype}`);
if (lowerName === "hd-1" || lowerName === "hd-4") {
setIframeSrc(`${baseURL}/${episodeId}/${servertype}`);
} else if (lowerName === "hd-2" || lowerName === "hd-3") {
try {
const res = await axios.get(
`${api_url}/stream?id=${animeId}?ep=${episodeId}&server=${serverName}&type=${servertype}`
);
const link = res?.data?.results?.streamingLink?.link;
if (link) {
setIframeSrc(`${link}&_debug=true`);
} else {
console.error("Streaming link not found in response");
}
} catch (err) {
console.error("Failed to fetch streaming link:", err);
}
}
}; };
loadIframeUrl(); loadIframeUrl();

View File

@@ -50,7 +50,6 @@ export default function Player({
thumbnail, thumbnail,
intro, intro,
outro, outro,
serverName,
autoSkipIntro, autoSkipIntro,
autoPlay, autoPlay,
autoNext, autoNext,
@@ -213,6 +212,11 @@ export default function Player({
const iframeUrl = streamInfo?.streamingLink?.iframe; const iframeUrl = streamInfo?.streamingLink?.iframe;
const headers = {}; const headers = {};
headers.referer=new URL(iframeUrl).origin+"/"; headers.referer=new URL(iframeUrl).origin+"/";
console.log(m3u8proxy[Math.floor(Math.random() * m3u8proxy?.length)] +
encodeURIComponent(streamUrl) +
"&headers=" +
encodeURIComponent(JSON.stringify(headers)));
const art = new Artplayer({ const art = new Artplayer({
url: url:
m3u8proxy[Math.floor(Math.random() * m3u8proxy?.length)] + m3u8proxy[Math.floor(Math.random() * m3u8proxy?.length)] +
@@ -235,6 +239,11 @@ export default function Player({
autoOrientation: true, autoOrientation: true,
fastForward: true, fastForward: true,
aspectRatio: true, aspectRatio: true,
moreVideoAttr: {
crossOrigin: 'anonymous',
preload: 'none',
playsInline: true,
},
plugins: [ plugins: [
artplayerPluginHlsControl({ artplayerPluginHlsControl({
quality: { quality: {

View File

@@ -144,26 +144,12 @@ export const useWatch = (animeId, initialEpisodeId) => {
} }
const savedServerName = localStorage.getItem("server_name"); const savedServerName = localStorage.getItem("server_name");
const savedServerType = localStorage.getItem("server_type"); const savedServerType = localStorage.getItem("server_type");
let initialServer = const initialServer =
data.find( filteredServers.find(s => s.serverName === savedServerName && s.type === savedServerType) ||
(s) => filteredServers.find(s => s.serverName === savedServerName) ||
s.serverName === savedServerName && s.type === savedServerType filteredServers.find(s => s.type === savedServerType && ["HD-1", "HD-2", "HD-3", "HD-4"].includes(s.serverName)) ||
) ||
data.find((s) => s.serverName === savedServerName) ||
data.find((s) => s.type === savedServerType) ||
data.find(
(s) => s.serverName === "HD-1" && s.type === savedServerType
) ||
data.find(
(s) => s.serverName === "HD-2" && s.type === savedServerType
) ||
data.find(
(s) => s.serverName === "HD-3" && s.type === savedServerType
) ||
data.find(
(s) => s.serverName === "HD-4" && s.type === savedServerType
) ||
filteredServers[0]; filteredServers[0];
setServers(filteredServers); setServers(filteredServers);
setActiveServerType(initialServer?.type); setActiveServerType(initialServer?.type);
setActiveServerName(initialServer?.serverName); setActiveServerName(initialServer?.serverName);
@@ -189,8 +175,7 @@ export const useWatch = (animeId, initialEpisodeId) => {
) )
return; return;
if ( if (
(activeServerName?.toLowerCase() === "hd-1" (activeServerName?.toLowerCase() === "hd-1" || activeServerName?.toLowerCase() === "hd-4")
|| activeServerName?.toLowerCase() === "hd-2"|| activeServerName?.toLowerCase() === "hd-3"|| activeServerName?.toLowerCase() === "hd-4")
&& &&
!serverLoading !serverLoading
) { ) {
@@ -206,7 +191,7 @@ export const useWatch = (animeId, initialEpisodeId) => {
const data = await getStreamInfo( const data = await getStreamInfo(
animeId, animeId,
episodeId, episodeId,
server.serverName.toLowerCase(), server.serverName.toLowerCase()==="hd-3"?"hd-1":server.serverName.toLowerCase(),
server.type.toLowerCase() server.type.toLowerCase()
); );
setStreamInfo(data); setStreamInfo(data);

View File

@@ -317,24 +317,47 @@ function AnimeInfo({ random = false }) {
{seasons?.length > 0 && ( {seasons?.length > 0 && (
<div className="container mx-auto px-4 py-12"> <div className="container mx-auto px-4 py-12">
<h2 className="text-2xl font-bold mb-8">More Seasons</h2> <h2 className="text-2xl font-bold mb-8">More Seasons</h2>
<div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4"> <div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
{seasons.map((season, index) => ( {seasons.map((season, index) => (
<Link <Link
to={`/${season.id}`} to={`/${season.id}`}
key={index} key={index}
className={`relative aspect-video rounded-xl overflow-hidden group ${ className={`relative w-full aspect-[3/1] rounded-lg overflow-hidden cursor-pointer group ${
currentId === String(season.id) currentId === String(season.id)
? "ring-2 ring-white/20" ? "ring-2 ring-white/40 shadow-lg shadow-white/10"
: "" : ""
}`} }`}
> >
<img <img
src={season.season_poster} src={season.season_poster}
alt={season.season} alt={season.season}
className="w-full h-full object-cover transition-transform duration-300 group-hover:scale-105" className={`w-full h-full object-cover scale-150 ${
currentId === String(season.id)
? "opacity-50"
: "opacity-40"
}`}
/> />
<div className="absolute inset-0 bg-gradient-to-t from-black/80 to-transparent flex items-end p-4"> {/* Dots Pattern Overlay */}
<p className="text-sm font-medium line-clamp-2"> <div
className="absolute inset-0 z-10"
style={{
backgroundImage: `url('data:image/svg+xml,<svg width="3" height="3" viewBox="0 0 3 3" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="1.5" cy="1.5" r="0.5" fill="white" fill-opacity="0.25"/></svg>')`,
backgroundSize: '3px 3px'
}}
/>
{/* Dark Gradient Overlay */}
<div className={`absolute inset-0 z-20 bg-gradient-to-r ${
currentId === String(season.id)
? "from-black/50 to-transparent"
: "from-black/40 to-transparent"
}`} />
{/* Title Container */}
<div className="absolute inset-0 z-30 flex items-center justify-center">
<p className={`text-[18px] font-bold text-center px-4 transition-colors duration-300 ${
currentId === String(season.id)
? "text-white"
: "text-white/90 group-hover:text-white"
}`}>
{season.season} {season.season}
</p> </p>
</div> </div>

View File

@@ -233,9 +233,8 @@ export default function Watch() {
</div> </div>
<div className="player w-full h-fit bg-black flex flex-col"> <div className="player w-full h-fit bg-black flex flex-col">
<div className="w-full relative h-[480px] max-[1400px]:h-[40vw] max-[1200px]:h-[48vw] max-[1024px]:h-[58vw] max-[600px]:h-[65vw]"> <div className="w-full relative h-[480px] max-[1400px]:h-[40vw] max-[1200px]:h-[48vw] max-[1024px]:h-[58vw] max-[600px]:h-[65vw]">
{!buffering ? (( activeServerName.toLowerCase()==="hd-1" || activeServerName.toLowerCase()==="hd-2" || activeServerName.toLowerCase()==="hd-3" || activeServerName.toLowerCase()==="hd-4") ? {!buffering ? (["hd-1", "hd-4"].includes(activeServerName.toLowerCase()) ?
<IframePlayer <IframePlayer
animeId={animeId}
episodeId={episodeId} episodeId={episodeId}
servertype={activeServerType} servertype={activeServerType}
serverName={activeServerName} serverName={activeServerName}