import axios from "axios" | |
import cheerio from "cheerio" | |
const Base_url = "https://220.158.234.46/" | |
function anime (query) { | |
return new Promise((resolve, reject) => { | |
axios.get(`https://www.anime-planet.com/anime/all?name=${query}`) | |
.then(({ | |
data | |
}) => { | |
const hasil = [] | |
const $ = cheerio.load(data) | |
$('#siteContainer > ul.cardDeck.cardGrid > li ').each(function (a, b) { | |
result = { | |
status: 200, | |
author: author, | |
judul: $(b).find('> a > h3').text(), | |
link: 'https://www.anime-planet.com' + $(b).find('> a').attr('href'), | |
thumbnail: 'https://www.anime-planet.com' + $(b).find('> a > div.crop > img').attr('src') | |
}; | |
hasil.push(result); | |
}); | |
resolve(hasil) | |
}) | |
.catch(reject) | |
}) | |
} | |
export { anime } | |
//module.exports = { Getongoing, Getdownload, Getdetail, Getsearch } |