aboutsummaryrefslogtreecommitdiff
path: root/lib/anify/info.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/anify/info.js')
-rw-r--r--lib/anify/info.js24
1 files changed, 6 insertions, 18 deletions
diff --git a/lib/anify/info.js b/lib/anify/info.js
index 05159ce..8284e94 100644
--- a/lib/anify/info.js
+++ b/lib/anify/info.js
@@ -1,7 +1,6 @@
import axios from "axios";
-import { redis } from "../redis";
-export async function fetchInfo(id, key) {
+export async function fetchInfo(id) {
try {
const { data } = await axios.get(`https://api.anify.tv/info/${id}`);
return data;
@@ -11,24 +10,13 @@ export async function fetchInfo(id, key) {
}
}
-export default async function getAnifyInfo(id, key) {
+export default async function getAnifyInfo(id) {
try {
- let cached;
- if (redis) {
- cached = await redis.get(id);
- }
- if (cached) {
- return JSON.parse(cached);
+ const data = await fetchInfo(id);
+ if (data) {
+ return data;
} else {
- const data = await fetchInfo(id, key);
- if (data) {
- if (redis) {
- await redis.set(id, JSON.stringify(data), "EX", 60 * 10);
- }
- return data;
- } else {
- return { message: "Schedule not found" };
- }
+ return { message: "Anify Info Not Found!" };
}
} catch (error) {
return { error };