This repository has been archived by the owner on Feb 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserchAnime.js
58 lines (55 loc) · 1.79 KB
/
serchAnime.js
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
47
48
49
50
51
52
53
54
55
56
57
58
const cheerio = require("cheerio");
const fetch = require("node-fetch");
const surl = "https://animesonline.cc/search/";
function getInfo(anime){
return fetch(`${surl}${anime}`).then(
r=>r.text()
).then(r=>{
const animes=[];
const $=cheerio.load(r);
$('.item.se').each((i,e)=>{
const anime = $(e);
const animeInfo ={
url: anime.find('.poster a').attr('href'),
poster: anime.find('.poster a img').attr('src'),
title: anime.find('.data h3').text().trim(),
nota: anime.find('.poster .rating').text().trim() || "N/A"
}
animes.push(animeInfo);
})
return animes;
})
}
function getVideo(epUrl){
return fetch(`${epUrl}`).then(
r=>r.text()
).then(body=>{
const $=cheerio.load(body);
const player =$('.player_sist iframe').attr('src')
return player;
})
}
function getAnime(animeurl){
return fetch(`${animeurl}`).then(
r=>r.text()
).then(body=>{
const $ = cheerio.load(body);
const eps=[];
$('.se-a .episodios li').each((i,e)=>{
const ep=$(e);
const link=ep.find('.episodiotitle a').attr('href')
const epInfo={
num: ep.find('.episodiotitle a').text(),
img:ep.find('.imagen a img').attr('src'),
link: link
}
eps.push(epInfo)
})
return eps;
})
}
module.exports = {
getInfo,
getAnime,
getVideo
}