mirror of https://github.com/aruppi/aruppi-api
Added Season and GetLastEpisodes
This commit is contained in:
parent
6b055bd2a5
commit
435ccbbb02
|
@ -582,6 +582,11 @@
|
||||||
"har-schema": "^2.0.0"
|
"har-schema": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"he": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz",
|
||||||
|
"integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0="
|
||||||
|
},
|
||||||
"helmet": {
|
"helmet": {
|
||||||
"version": "3.22.0",
|
"version": "3.22.0",
|
||||||
"resolved": "https://registry.npmjs.org/helmet/-/helmet-3.22.0.tgz",
|
"resolved": "https://registry.npmjs.org/helmet/-/helmet-3.22.0.tgz",
|
||||||
|
@ -904,6 +909,14 @@
|
||||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
|
||||||
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
|
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
|
||||||
},
|
},
|
||||||
|
"node-html-parser": {
|
||||||
|
"version": "1.2.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-html-parser/-/node-html-parser-1.2.18.tgz",
|
||||||
|
"integrity": "sha512-DypklUSTuY9JDfYWz/NZYZA8mvgKmjRmHZe7at0H6O4KoXcs8QSpnH5mFk888gLsqXXRMVNmJGk/FdqaO9T1UQ==",
|
||||||
|
"requires": {
|
||||||
|
"he": "1.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"npm": {
|
"npm": {
|
||||||
"version": "6.14.5",
|
"version": "6.14.5",
|
||||||
"resolved": "https://registry.npmjs.org/npm/-/npm-6.14.5.tgz",
|
"resolved": "https://registry.npmjs.org/npm/-/npm-6.14.5.tgz",
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
const rss = require('rss-to-json');
|
const rss = require('rss-to-json');
|
||||||
const cloudscraper = require('cloudscraper');
|
const cloudscraper = require('cloudscraper');
|
||||||
const {
|
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');
|
} = require('./urls');
|
||||||
|
|
||||||
const schedule = async (day) =>{
|
const schedule = async (day) =>{
|
||||||
|
|
||||||
const data = await cloudscraper.get(`${BASE_JIKAN}schedule/${day}`);
|
const data = await cloudscraper.get(`${BASE_JIKAN}schedule/${day}`);
|
||||||
|
const promises = []
|
||||||
let body;
|
let body;
|
||||||
|
|
||||||
switch (day) {
|
switch (day) {
|
||||||
|
@ -35,7 +36,16 @@ const schedule = async (day) =>{
|
||||||
body = JSON.parse(data).monday;
|
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 = {
|
module.exports = {
|
||||||
schedule,
|
schedule,
|
||||||
top,
|
top,
|
||||||
getAllAnimes,
|
getAllAnimes,
|
||||||
getAnitakume,
|
getAnitakume,
|
||||||
getNews
|
getNews,
|
||||||
|
season,
|
||||||
|
getLastEpisodes
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,15 +7,17 @@ router.get('/', (req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
message: 'Aruppi API - 🎏',
|
message: 'Aruppi API - 🎏',
|
||||||
author: 'Jéluchu',
|
author: 'Jéluchu',
|
||||||
version: '1.0.0',
|
version: '2.0.0',
|
||||||
credits: 'The bitch loves APIs that offers data to Aruppi App',
|
credits: 'The bitch loves APIs that offers data to Aruppi App',
|
||||||
entries: [
|
entries: [
|
||||||
{
|
{
|
||||||
'Schedule': '/api/v1/schedule/:id',
|
'Schedule': '/api/v2/schedule/:day',
|
||||||
'Top': '/api/v1/top/:type/:subtype/:page',
|
'Top': '/api/v2/top/:type/:subtype/:page',
|
||||||
'GetAllAnimes': '/api/v1/getAllAnimes',
|
'GetAllAnimes': '/api/v2/getAllAnimes',
|
||||||
'GetAnitakume': '/api/v1/getAnitakume',
|
'GetAnitakume': '/api/v2/getAnitakume',
|
||||||
'GetNews': '/api/v1/getNews'
|
'GetNews': '/api/v2/getNews',
|
||||||
|
'Season': '/api/v2/season/:year/:type',
|
||||||
|
'GetLastEpisodes': '/api/v2/getLastEpisodes'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
|
@ -73,4 +73,33 @@ router.get('/getNews' , (req, res) =>{
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.get('/season/:year/:type' , (req, res) =>{
|
||||||
|
|
||||||
|
let year = req.params.year;
|
||||||
|
let type = req.params.type;
|
||||||
|
|
||||||
|
api.season(year, type)
|
||||||
|
.then(season =>{
|
||||||
|
res.status(200).json({
|
||||||
|
season
|
||||||
|
});
|
||||||
|
}).catch((err) =>{
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
router.get('/getLastEpisodes' , (req, res) =>{
|
||||||
|
|
||||||
|
api.getLastEpisodes()
|
||||||
|
.then(episodes =>{
|
||||||
|
res.status(200).json({
|
||||||
|
episodes
|
||||||
|
});
|
||||||
|
}).catch((err) =>{
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
BASE_ANIMEFLV: 'https://animeflv.net/',
|
BASE_ANIMEFLV: 'https://animeflv.net/',
|
||||||
|
BASE_ANIMEFLV_JELU: 'https://dev.aruppi.jeluchu.xyz/apis/animeflv/v1/',
|
||||||
BASE_JIKAN: 'https://dev.aruppi.jeluchu.xyz/apis/jikan/v3/',
|
BASE_JIKAN: 'https://dev.aruppi.jeluchu.xyz/apis/jikan/v3/',
|
||||||
BASE_IVOOX: 'https://www.ivoox.com/podcast-anitakume_fg_f1660716_filtro_1.xml',
|
BASE_IVOOX: 'https://www.ivoox.com/podcast-anitakume_fg_f1660716_filtro_1.xml',
|
||||||
BASE_KUDASAI: 'https://somoskudasai.com/feed/',
|
BASE_KUDASAI: 'https://somoskudasai.com/feed/',
|
||||||
|
|
Loading…
Reference in New Issue