aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFactiven <[email protected]>2023-10-24 20:27:32 +0700
committerFactiven <[email protected]>2023-10-24 20:27:32 +0700
commit451e4dffd000169e7113aa3275e4acaf7f1fbbbc (patch)
tree035edf0d05e2f6878be745c326935aba3d821636 /lib
parentUpdate v4.2.1 (diff)
downloadmoopa-4.2.2.tar.xz
moopa-4.2.2.zip
Update v4.2.2v4.2.2
Diffstat (limited to 'lib')
-rw-r--r--lib/anify/info.js4
-rw-r--r--lib/anify/page.js4
-rw-r--r--lib/anilist/aniAdvanceSearch.js11
-rw-r--r--lib/consumet/manga/getChapters.js4
-rw-r--r--lib/consumet/manga/getPage.js4
5 files changed, 13 insertions, 14 deletions
diff --git a/lib/anify/info.js b/lib/anify/info.js
index 08d64aa..05159ce 100644
--- a/lib/anify/info.js
+++ b/lib/anify/info.js
@@ -3,9 +3,7 @@ import { redis } from "../redis";
export async function fetchInfo(id, key) {
try {
- const { data } = await axios.get(
- `https://api.anify.tv/info/${id}?apikey=${key}`
- );
+ const { data } = await axios.get(`https://api.anify.tv/info/${id}`);
return data;
} catch (error) {
console.error("Error fetching data:", error);
diff --git a/lib/anify/page.js b/lib/anify/page.js
index 0f0bb93..6362f88 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, chapterNumber, providerId, chapterId, key) {
+async function fetchData(id, chapterNumber, providerId, chapterId) {
try {
const res = await fetch(
- `https://api.anify.tv/pages/${id}/${chapterNumber}/${providerId}/${chapterId}&apikey=${key}`
+ `https://api.anify.tv/pages/${id}/${chapterNumber}/${providerId}/${chapterId}`
);
const data = await res.json();
return data;
diff --git a/lib/anilist/aniAdvanceSearch.js b/lib/anilist/aniAdvanceSearch.js
index cf344b0..7e684af 100644
--- a/lib/anilist/aniAdvanceSearch.js
+++ b/lib/anilist/aniAdvanceSearch.js
@@ -27,14 +27,15 @@ export async function aniAdvanceSearch({
const response = await fetch("https://api.anify.tv/search-advanced", {
method: "POST",
body: JSON.stringify({
- type: "manga",
- genres: categorizedGenres,
+ sort: "averageRating",
+ sortDirection: "DESC",
+ ...(categorizedGenres && { ...categorizedGenres }),
...(search && { query: search }),
...(page && { page: page }),
...(perPage && { perPage: perPage }),
- ...(format && { format: format }),
- ...(seasonYear && { year: seasonYear }),
- ...(type && { type: type }),
+ ...(format && { format: [format] }),
+ ...(seasonYear && { year: Number(seasonYear) }),
+ ...(type && { type: format === "NOVEL" ? "novel" : type }),
}),
});
diff --git a/lib/consumet/manga/getChapters.js b/lib/consumet/manga/getChapters.js
index 7a19bbc..ee6eabe 100644
--- a/lib/consumet/manga/getChapters.js
+++ b/lib/consumet/manga/getChapters.js
@@ -1,7 +1,7 @@
let API_URL;
-API_URL = process.env.API_URI;
+API_URL = process.env.API_URI || null || null;
// remove / from the end of the url if it exists
-if (API_URL.endsWith("/")) {
+if (API_URL && API_URL.endsWith("/")) {
API_URL = API_URL.slice(0, -1);
}
diff --git a/lib/consumet/manga/getPage.js b/lib/consumet/manga/getPage.js
index 832c1d7..40f3fc2 100644
--- a/lib/consumet/manga/getPage.js
+++ b/lib/consumet/manga/getPage.js
@@ -1,7 +1,7 @@
let API_URL;
-API_URL = process.env.API_URI;
+API_URL = process.env.API_URI || null;
// remove / from the end of the url if it exists
-if (API_URL.endsWith("/")) {
+if (API_URL && API_URL.endsWith("/")) {
API_URL = API_URL.slice(0, -1);
}