Fix LastEpisodes Servers - v2.2.2

pull/1/head
Jéluchu 5 years ago
parent e89455d62d
commit 4d946e5b17

@ -1,4 +1,4 @@
# **Aruppi API** (v2.2.1) # **Aruppi API** (v2.2.2)
> This API has everything about Japan, from anime, music, radio, images, videos ... to japanese culture > This API has everything about Japan, from anime, music, radio, images, videos ... to japanese culture
> >

@ -1,6 +1,6 @@
{ {
"name": "aruppi", "name": "aruppi",
"version": "2.2.1", "version": "2.2.2",
"description": "Aruppi is a custom API to obtain data from the Japanese culture for the mobile app", "description": "Aruppi is a custom API to obtain data from the Japanese culture for the mobile app",
"main": "./src/api/api.js", "main": "./src/api/api.js",
"scripts": { "scripts": {

@ -11,7 +11,8 @@ const {
transformUrlServer, transformUrlServer,
obtainPreviewNews, obtainPreviewNews,
structureThemes, structureThemes,
getAnimes getAnimes,
helper
} = require('../utils/index'); } = require('../utils/index');
const { const {
@ -188,16 +189,17 @@ const getLastEpisodes = async () =>{
body.map(doc => { body.map(doc => {
promises.push({ promises.push(helper().then(async () => ({
id: doc.id, id: doc.id,
title: doc.title, title: doc.title,
image: doc.poster, image: doc.poster,
episode: doc.episode, episode: doc.episode,
servers: doc.servers.map(x => x) servers: await transformUrlServer(JSON.parse(JSON.stringify(doc.servers)))
}); })));
}); });
return promises; return Promise.all(promises);
}; };
@ -227,7 +229,6 @@ const getSpecials = async (type, subType, page) =>{
}; };
const getMoreInfo = async (title) =>{ const getMoreInfo = async (title) =>{
const promises = [] const promises = []

@ -7,7 +7,7 @@ router.get('/', (req, res) => {
res.json({ res.json({
message: 'Aruppi API - 🎏', message: 'Aruppi API - 🎏',
author: 'Jéluchu', author: 'Jéluchu',
version: '2.2.0', version: '2.2.2',
credits: 'The bitch loves APIs that offers data to Aruppi App', credits: 'The bitch loves APIs that offers data to Aruppi App',
entries: [ entries: [
{ {

@ -231,7 +231,7 @@ const imageUrlToBase64 = async (url) => {
return await base64.encode(url, {string: true}); return await base64.encode(url, {string: true});
}; };
const search = async () => {} const helper = async () => {}
const searchAnime = async (query) => { const searchAnime = async (query) => {
@ -254,7 +254,7 @@ const searchAnime = async (query) => {
let poster = $element.find('a div.Image figure img').attr('src') || $element.find('a div.Image figure img').attr('data-cfsrc'); let poster = $element.find('a div.Image figure img').attr('src') || $element.find('a div.Image figure img').attr('data-cfsrc');
const type = $element.find('div.Description p span.Type').text(); const type = $element.find('div.Description p span.Type').text();
promises.push(search().then(async () => ({ promises.push(helper().then(async () => ({
id: id || null, id: id || null,
title: title || null, title: title || null,
type: type || null, type: type || null,
@ -272,21 +272,13 @@ const transformUrlServer = async (urlReal) => {
let res let res
const promises = [] const promises = []
for (i = 0; i <= urlReal.length - 1; i++) { for (const index in urlReal) {
switch (urlReal[i].server) { if (urlReal[index].server === 'amus' || urlReal[index].server === 'natsuki') {
case "amus": res = await html(urlReal[index].code.replace("embed", "check")).json();
res = await html(urlReal[i].code.replace("embed", "check")).json(); urlReal[index].code = res.file || null
urlReal[i].code = res.file urlReal[index].direct = true
urlReal[i].direct = true } else {
break; urlReal[index].direct = false
case "natsuki":
res = await html(urlReal[i].code.replace("embed", "check")).json();
urlReal[i].code = res.file
urlReal[i].direct = true
break;
default:
urlReal[i].direct = false
break;
} }
} }
@ -455,5 +447,6 @@ module.exports = {
obtainPreviewNews, obtainPreviewNews,
structureThemes, structureThemes,
getThemes, getThemes,
getAnimes getAnimes,
helper
} }

Loading…
Cancel
Save