diff options
Diffstat (limited to 'lib/anify/page.js')
| -rw-r--r-- | lib/anify/page.js | 13 |
1 files changed, 10 insertions, 3 deletions
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); |