aboutsummaryrefslogtreecommitdiff
path: root/lib/anify/info.js
blob: 8284e946daed6d1cbade9c4708cb328c425a7885 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import axios from "axios";

export async function fetchInfo(id) {
  try {
    const { data } = await axios.get(`https://api.anify.tv/info/${id}`);
    return data;
  } catch (error) {
    console.error("Error fetching data:", error);
    return null;
  }
}

export default async function getAnifyInfo(id) {
  try {
    const data = await fetchInfo(id);
    if (data) {
      return data;
    } else {
      return { message: "Anify Info Not Found!" };
    }
  } catch (error) {
    return { error };
  }
}