From f801f8f422954b884a6541321dba0669ee9d6173 Mon Sep 17 00:00:00 2001 From: Factiven Date: Sun, 22 Oct 2023 19:43:17 +0700 Subject: Update v4.2.0 (#93) --- lib/anify/page.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib/anify/page.js') diff --git a/lib/anify/page.js b/lib/anify/page.js index 65ed309..0f0bb93 100644 --- a/lib/anify/page.js +++ b/lib/anify/page.js @@ -1,10 +1,10 @@ import { redis } from "../redis"; // Function to fetch new data -async function fetchData(id, providerId, chapterId, key) { +async function fetchData(id, chapterNumber, providerId, chapterId, key) { try { const res = await fetch( - `https://api.anify.tv/pages?id=${id}&providerId=${providerId}&readId=${chapterId}&apikey=${key}` + `https://api.anify.tv/pages/${id}/${chapterNumber}/${providerId}/${chapterId}&apikey=${key}` ); const data = await res.json(); return data; @@ -16,6 +16,7 @@ async function fetchData(id, providerId, chapterId, key) { export default async function getAnifyPage( mediaId, + chapterNumber, providerId, chapterId, key @@ -28,7 +29,13 @@ export default async function getAnifyPage( if (cached) { return JSON.parse(cached); } else { - const data = await fetchData(mediaId, providerId, chapterId, key); + const data = await fetchData( + mediaId, + chapterNumber, + providerId, + chapterId, + key + ); if (!data.error) { if (redis) { await redis.set(chapterId, JSON.stringify(data), "EX", 60 * 10); -- cgit v1.2.3