aboutsummaryrefslogtreecommitdiff
path: root/lib/anify/page.js
diff options
context:
space:
mode:
authorFactiven <[email protected]>2023-10-22 19:43:17 +0700
committerGitHub <[email protected]>2023-10-22 19:43:17 +0700
commitf801f8f422954b884a6541321dba0669ee9d6173 (patch)
treee0d5e106b99e9b4e0a4c4bf7bb0464617db85b8d /lib/anify/page.js
parentBump @babel/traverse from 7.22.8 to 7.23.2 (#90) (diff)
downloadmoopa-4.2.0.tar.xz
moopa-4.2.0.zip
Update v4.2.0 (#93)v4.2.0
Diffstat (limited to 'lib/anify/page.js')
-rw-r--r--lib/anify/page.js13
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);