v2.6.4 - Fixes some series

pull/1/head v2.6.4
Jéluchu 5 years ago
parent 61c14e9ccd
commit 36e1665ea6

876
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
{ {
"name": "aruppi", "name": "aruppi",
"version": "2.6.3", "version": "2.6.4",
"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": {

@ -262,7 +262,14 @@ const getMoreInfo = async (title) =>{
const jkAnimeTitles = [ const jkAnimeTitles = [
{ title: 'The God of High School', id: 'the-god-of-high-school' }, { title: 'The God of High School', id: 'the-god-of-high-school' },
{ title: 'Kami no Tou', id: 'kami-no-tou' }, { title: 'Kami no Tou', id: 'kami-no-tou' },
{ title: 'BNA', id: 'bna' } { title: 'BNA', id: 'bna' },
{ title: 'Ansatsu Kyoushitsu (TV)', id: 'ansatsu-kyoushitsu-tv' },
{ title: 'Ansatsu Kyoushitsu (TV) 2nd Season', id: 'ansatsu-kyoushitsu-tv-2nd-season' }
];
const jkMyAnimetitles = [
{ jkanime: 'Ansatsu Kyoushitsu (TV)', myanimelist: 'Ansatsu Kyoushitsu'},
{ jkanime: 'Ansatsu Kyoushitsu (TV) 2nd Season', myanimelist: 'Ansatsu Kyoushitsu 2nd Season' }
]; ];
let jkanime = false let jkanime = false
@ -272,8 +279,19 @@ const getMoreInfo = async (title) =>{
if (title === jkAnimeTitles[name].title) { if (title === jkAnimeTitles[name].title) {
jkanime = true jkanime = true
jkanimeID = jkAnimeTitles[name].id jkanimeID = jkAnimeTitles[name].id
for (let name in jkMyAnimetitles) {
if (title === jkMyAnimetitles[name].jkanime || title === jkMyAnimetitles[name].myanimelist) {
jkanimeName = jkMyAnimetitles[name].myanimelist
position = name
}
}
if (jkanimeName === undefined) {
jkanimeName = jkAnimeTitles[name].title jkanimeName = jkAnimeTitles[name].title
} }
}
} }
if (jkanime === false) { if (jkanime === false) {
@ -281,7 +299,9 @@ const getMoreInfo = async (title) =>{
{ animeflv: 'Kaguya-sama wa Kokurasetai: Tensai-tachi no Renai Zunousen 2nd Season', myanimelist: 'Kaguya-sama wa Kokurasetai?: Tensai-tachi no Renai Zunousen', alternative: 'Kaguya-sama wa Kokurasetai'}, { animeflv: 'Kaguya-sama wa Kokurasetai: Tensai-tachi no Renai Zunousen 2nd Season', myanimelist: 'Kaguya-sama wa Kokurasetai?: Tensai-tachi no Renai Zunousen', alternative: 'Kaguya-sama wa Kokurasetai'},
{ animeflv: 'Naruto Shippuden', myanimelist: 'Naruto: Shippuuden' }, { animeflv: 'Naruto Shippuden', myanimelist: 'Naruto: Shippuuden' },
{ animeflv: 'Rock Lee no Seishun Full-Power Ninden', myanimelist: 'Naruto SD: Rock Lee no Seishun Full-Power Ninden' }, { animeflv: 'Rock Lee no Seishun Full-Power Ninden', myanimelist: 'Naruto SD: Rock Lee no Seishun Full-Power Ninden' },
{ animeflv: 'BAKI: dai reitaisai-hen', myanimelist: 'Baki 2nd Season' } { animeflv: 'BAKI: dai reitaisai-hen', myanimelist: 'Baki 2nd Season' },
{ animeflv: 'Hitoribocchi no ○○ Seikatsu', myanimelist: 'Hitoribocchi no Marumaru Seikatsu' },
{ animeflv: 'Nekopara (TV)', myanimelist: 'Nekopara' }
]; ];
for (let name in titles) { for (let name in titles) {
@ -291,6 +311,7 @@ const getMoreInfo = async (title) =>{
} }
} }
if (seriesTitle === undefined) { if (seriesTitle === undefined) {
seriesTitle = title seriesTitle = title
} }
@ -298,7 +319,10 @@ const getMoreInfo = async (title) =>{
await getAllAnimes().then(animes => { await getAllAnimes().then(animes => {
for (const i in animes) { for (const i in animes) {
if (animes[i].title.split('\t')[0] === seriesTitle.split('\t')[0] || animes[i].title === `${seriesTitle} (TV)`) { if (animes[i].title.split('\t')[0] === seriesTitle.split('\t')[0] ||
animes[i].title === `${seriesTitle} (TV)` ||
animes[i].title.includes(seriesTitle.split('○')[0])
) {
if (animes[i].title.includes('(TV)', 0)) { animeTitle = animes[i].title.split('\t')[0].replace(' (TV)', '') } if (animes[i].title.includes('(TV)', 0)) { animeTitle = animes[i].title.split('\t')[0].replace(' (TV)', '') }
else { animeTitle = animes[i].title.split('\t')[0] } else { animeTitle = animes[i].title.split('\t')[0] }
animeId = animes[i].id animeId = animes[i].id
@ -384,7 +408,9 @@ const getAnimeServers = async (id) => {
const jkAnimeIDs = [ const jkAnimeIDs = [
{ id: 'the-god-of-high-school' }, { id: 'the-god-of-high-school' },
{ id: 'kami-no-tou' }, { id: 'kami-no-tou' },
{ id: 'bna' } { id: 'bna' },
{ id: 'ansatsu-kyoushitsu-tv' },
{ id: 'ansatsu-kyoushitsu-tv-2nd-season' }
]; ];
let jkanime = false let jkanime = false

@ -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.6.3', version: '2.6.4',
credits: 'The bitch loves APIs that offers data to Aruppi App', credits: 'The bitch loves APIs that offers data to Aruppi App',
entries: [ entries: [
{ {

@ -6,7 +6,6 @@ const {
homgot homgot
} = require('../api/apiCall'); } = require('../api/apiCall');
function btoa(str) { function btoa(str) {
let buffer; let buffer;
if (str instanceof Buffer) { if (str instanceof Buffer) {
@ -26,11 +25,11 @@ async function videoServersJK(id) {
const $ = await homgot(`${BASE_JKANIME}${id}`, options); const $ = await homgot(`${BASE_JKANIME}${id}`, options);
const scripts = $('script'); const scripts = $('script');
const totalEps = $('div#container div#reproductor-box div ul li').length; const episodes = $('div#reproductor-box li');
const serverNames = []; const serverNames = [];
let servers = []; let servers = [];
$('div#container div#reproductor-box div ul li').each((index , element) =>{ episodes.each((index , element) =>{
const $element = $(element); const $element = $(element);
const serverName = $element.find('a').text(); const serverName = $element.find('a').text();
serverNames.push(serverName); serverNames.push(serverName);
@ -40,9 +39,8 @@ async function videoServersJK(id) {
const $script = $(scripts[i]); const $script = $(scripts[i]);
const contents = $script.html(); const contents = $script.html();
try{ try{
if ((contents || '').includes('var video = [];')) { if ((contents || '').includes('var video = [];')) {
Array.from({length: totalEps} , (v , k) =>{ Array.from({length: episodes.length} , (v , k) =>{
let index = Number(k + 1); let index = Number(k + 1);
let videoPageURL = contents.split(`video[${index}] = \'<iframe class="player_conte" src="`)[1].split('"')[0]; let videoPageURL = contents.split(`video[${index}] = \'<iframe class="player_conte" src="`)[1].split('"')[0];
servers.push({iframe: videoPageURL}); servers.push({iframe: videoPageURL});
@ -52,24 +50,17 @@ async function videoServersJK(id) {
return null; return null;
} }
} }
let serverList = []; let serverList = [];
let serverTempList = []; for(let server in servers) {
for(const [key , value] of Object.entries(servers)) {
let video = await getVideoURL(value.iframe)
serverTempList.push(video);
}
Array.from({length: serverTempList.length} , (v , k) =>{
let name = serverNames[k];
let video = serverTempList[k];
serverList.push({ serverList.push({
id: name.toLowerCase(), id: serverNames[server].toLowerCase(),
url: video, url: await getVideoURL(servers[server].iframe),
direct: true direct: true
}); });
}); }
serverList = serverList.filter(function( obj ) {
return obj.id !== 'xtreme s'; serverList = serverList.filter(x => x.id !== 'xtreme s' && x.id !== 'desuka' );
});
return await Promise.all(serverList); return await Promise.all(serverList);
} }
@ -304,6 +295,7 @@ const animeflvInfo = async (id, index) => {
const getAnimeCharacters = async (title) => { const getAnimeCharacters = async (title) => {
try {
let options = { parse: true } let options = { parse: true }
const res = await homgot(`${BASE_JIKAN}search/anime?q=${title}`, options); const res = await homgot(`${BASE_JIKAN}search/anime?q=${title}`, options);
@ -340,10 +332,15 @@ const getAnimeCharacters = async (title) => {
}); });
return Promise.all(characters); return Promise.all(characters);
} catch (e) {
console.log(e.message)
}
}; };
const getAnimeVideoPromo = async (title) => { const getAnimeVideoPromo = async (title) => {
try {
let options = { parse: true } let options = { parse: true }
const res = await homgot(`${BASE_JIKAN}search/anime?q=${title}`, options); const res = await homgot(`${BASE_JIKAN}search/anime?q=${title}`, options);
const matchAnime = res.results.filter(x => x.title === title); const matchAnime = res.results.filter(x => x.title === title);
@ -364,10 +361,16 @@ const getAnimeVideoPromo = async (title) => {
}); });
return Promise.all(promises); return Promise.all(promises);
} catch (e) {
console.log(e.message)
}
}; };
const animeExtraInfo = async (title) => { const animeExtraInfo = async (title) => {
try {
let options = { parse: true } let options = { parse: true }
const res = await homgot(`${BASE_JIKAN}search/anime?q=${title}`, options); const res = await homgot(`${BASE_JIKAN}search/anime?q=${title}`, options);
const matchAnime = res.results.filter(x => x.title === title); const matchAnime = res.results.filter(x => x.title === title);
@ -425,6 +428,12 @@ const animeExtraInfo = async (title) => {
}); });
}); });
return Promise.all(promises); return Promise.all(promises);
} catch (e) {
console.log(e.message)
}
}; };
const imageUrlToBase64 = async (url) => { const imageUrlToBase64 = async (url) => {
@ -441,7 +450,8 @@ const searchAnime = async (query) => {
const jkAnimeTitles = [ const jkAnimeTitles = [
{ title: 'BNA', search: 'BNA'}, { title: 'BNA', search: 'BNA'},
{ title: 'The God of High School', search: 'The god' } { title: 'The God of High School', search: 'The god' },
{ title: 'Ansatsu Kyoshitsu', search: 'Assassination Classroom' },
]; ];
let jkanime = false let jkanime = false

Loading…
Cancel
Save