File size: 1,044 Bytes
a2b2aac |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
import axios from "axios"
import cheerio from "cheerio"
function ongoing(){
return new Promise((reject,resolve) => {
axios.get('https://otakudesu.moe/ongoing-anime/').then(({ data}) => {
const $ = cheerio.load(data)
const result = [];
const img = [];
const epz = [];
const ne = [];
const th = [];
const ep = [];
const nm =[];
$('div.detpost').each(function(a,b) {
img.push($(b).find('img').attr('src'))
nm.push($(b).find('h2').text())
th.push($(b).find('a').attr('href'))
})
$('div.epztipe').each(function(d,c) {
epz.push($(c).text())
})
$('div.newnime').each(function(f,g) {
ne.push($(g).text())
})
$('div.epz').each(function(m,n){
ep.push($(n).text())
})
for( let i = 0; i < img.length; i++){
result.push({
nama: nm[i],
image: img[i],
episode: ep[i],
setiap: epz[i],
rilis: ne[i],
link: th[i]
})
}
resolve(result)
})
.catch(reject)
})
}
export { ongoing }
//module.exports = { Getongoing, Getdownload, Getdetail, Getsearch } |