From 5e8b0bfb4a6437d21e05c49c020ce00d3f57eccd Mon Sep 17 00:00:00 2001 From: UesleiDev <63914812+uesleibros@users.noreply.github.com> Date: Mon, 2 Sep 2024 22:17:31 -0300 Subject: [PATCH] formando nova melhor estrutura --- src/app/api/buscar/animes/anroll/episodios/navegar/route.js | 4 +++- src/app/api/recentes/animes/anroll/route.js | 5 +++-- src/app/page.jsx | 6 +----- src/components/Episode.jsx | 2 +- src/components/Header.jsx | 4 ++-- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/app/api/buscar/animes/anroll/episodios/navegar/route.js b/src/app/api/buscar/animes/anroll/episodios/navegar/route.js index 668c131..60533a1 100644 --- a/src/app/api/buscar/animes/anroll/episodios/navegar/route.js +++ b/src/app/api/buscar/animes/anroll/episodios/navegar/route.js @@ -1,10 +1,12 @@ +import config from "@/config"; + export async function GET(request) { const id = request.nextUrl.searchParams.get("id"); if (!id) return Response.json({ error: "missing ep_id." }, { status: 404 }); - const res = await fetch(`https://www.anroll.net/_next/data/nxb43Ok4qvT2cAlD0OLS1/e/${id}.json?episode=${id}`, { + const res = await fetch(`https://www.anroll.net/_next/data/${config.anroll.buildId}/e/${id}.json?episode=${id}`, { headers: { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36", "Referer": "https://www.anroll.net/" diff --git a/src/app/api/recentes/animes/anroll/route.js b/src/app/api/recentes/animes/anroll/route.js index 1bd1dd7..b216767 100644 --- a/src/app/api/recentes/animes/anroll/route.js +++ b/src/app/api/recentes/animes/anroll/route.js @@ -4,7 +4,8 @@ export async function GET() { const res = await fetch(`https://www.anroll.net/_next/data/${config.anroll.buildId}/index.json`, { headers: { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36", - "Referer": "https://www.anroll.net/" + "Referer": "https://www.anroll.net/", + "Cookie": "anroll:activeSVI=0; anroll:theaterMode=1; _a_44B3TM_d_=true" }, next: { revalidate: 300 } }); @@ -14,5 +15,5 @@ export async function GET() { catalog.forEach((i) => i.episode.thumbnail = `https://static.anroll.net/images/animes/screens/${i.episode.anime.slug_serie}/${i.episode.n_episodio}.jpg`); catalog.forEach((i) => i.episode.anime.thumbnail = `https://static.anroll.net/images/animes/capas/${i.episode.anime.slug_serie}.jpg`); - return Response.json(catalog); + return Response.json({data: catalog}); } diff --git a/src/app/page.jsx b/src/app/page.jsx index 8bb9036..15942b3 100644 --- a/src/app/page.jsx +++ b/src/app/page.jsx @@ -116,11 +116,7 @@ export default async function Home() { const res = await fetch(`${protocol}://${host}/api/recentes/animes/anroll`); const {data} = await res.json(); - if (data?.data_releases.length > 0) { - return data.data_releases; - } - - return null + return data; } const trending = await pegarTopicosAnimes(); diff --git a/src/components/Episode.jsx b/src/components/Episode.jsx index 00839b0..564bc64 100644 --- a/src/components/Episode.jsx +++ b/src/components/Episode.jsx @@ -21,7 +21,7 @@ export default function Episode({ slug, episode_id, thumbnail, title, episode_nu />
-

Plau

+

Plau

diff --git a/src/components/Header.jsx b/src/components/Header.jsx index e788b51..0191b47 100644 --- a/src/components/Header.jsx +++ b/src/components/Header.jsx @@ -112,7 +112,7 @@ export default function Header() {
-

Randomizar

+

Randomizar

@@ -121,7 +121,7 @@ export default function Header() {
-

Randomizar

+

Randomizar