|
|
|
@ -1,12 +1,13 @@
|
|
|
|
|
const rss = require('rss-to-json');
|
|
|
|
|
const cloudscraper = require('cloudscraper');
|
|
|
|
|
const {
|
|
|
|
|
BASE_ANIMEFLV, BASE_JIKAN, BASE_IVOOX, BASE_KUDASAI, BASE_PALOMITRON
|
|
|
|
|
BASE_ANIMEFLV, BASE_ANIMEFLV_JELU, BASE_JIKAN, BASE_IVOOX, BASE_KUDASAI, BASE_PALOMITRON
|
|
|
|
|
} = require('./urls');
|
|
|
|
|
|
|
|
|
|
const schedule = async (day) =>{
|
|
|
|
|
|
|
|
|
|
const data = await cloudscraper.get(`${BASE_JIKAN}schedule/${day}`);
|
|
|
|
|
const promises = []
|
|
|
|
|
let body;
|
|
|
|
|
|
|
|
|
|
switch (day) {
|
|
|
|
@ -35,7 +36,16 @@ const schedule = async (day) =>{
|
|
|
|
|
body = JSON.parse(data).monday;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Promise.all(body);
|
|
|
|
|
body.map(doc =>{
|
|
|
|
|
|
|
|
|
|
promises.push({
|
|
|
|
|
title: doc.title,
|
|
|
|
|
malid: doc.mal_id,
|
|
|
|
|
image: doc.image_url
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return Promise.all(promises);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -132,10 +142,52 @@ const getNews = async () =>{
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const season = async (year, type) =>{
|
|
|
|
|
|
|
|
|
|
const data = await cloudscraper.get(`${BASE_JIKAN}season/${year}/${type}`);
|
|
|
|
|
let body = JSON.parse(data).anime;
|
|
|
|
|
const promises = []
|
|
|
|
|
|
|
|
|
|
body.map(doc =>{
|
|
|
|
|
|
|
|
|
|
promises.push({
|
|
|
|
|
title: doc.title,
|
|
|
|
|
malid: doc.mal_id,
|
|
|
|
|
image: doc.image_url
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return Promise.all(promises);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const getLastEpisodes = async () =>{
|
|
|
|
|
|
|
|
|
|
const data = await cloudscraper.get(`${BASE_ANIMEFLV_JELU}LatestEpisodesAdded`);
|
|
|
|
|
let body = JSON.parse(data).episodes;
|
|
|
|
|
const promises = []
|
|
|
|
|
|
|
|
|
|
body.map(doc =>{
|
|
|
|
|
|
|
|
|
|
promises.push({
|
|
|
|
|
id: doc.id,
|
|
|
|
|
title: doc.title,
|
|
|
|
|
image: doc.poster,
|
|
|
|
|
episode: doc.episode,
|
|
|
|
|
servers: doc.servers.map(x => x)
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return Promise.all(promises);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
schedule,
|
|
|
|
|
top,
|
|
|
|
|
getAllAnimes,
|
|
|
|
|
getAnitakume,
|
|
|
|
|
getNews
|
|
|
|
|
getNews,
|
|
|
|
|
season,
|
|
|
|
|
getLastEpisodes
|
|
|
|
|
};
|
|
|
|
|