UNPKG

anigo-anime-api

Version:

Anigo Anime API scrapes data from gogoanime and animixplay

29 lines (26 loc) 811 B
const axios = require('axios'); const animixAll = "https://animixplay.to/assets/s/all.json"; const USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"; const headerOption = { headers: { "User-Agent": USER_AGENT } }; /** * * @returns {Array<object} */ async function getAllAnime() { try { const fetchAnimixAll = await axios.get(animixAll, headerOption); fetchAnimixAll.data.map(anime => { list.push({ animeTitle: anime.title, animeId: anime.id }) }); var list = [] return list; } catch (err) { throw new Error(`${err}`) } } exports.func = function() { return getAllAnime(); }