Fixed getEpisodes

pull/57/head v4.1.7
Jesús María 4 years ago
parent 08fb60749b
commit 361d0553e9

@ -1,4 +1,4 @@
# **Aruppi API** (v4.1.6) # **Aruppi API** (v4.1.7)
> 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
> >

7464
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
{ {
"name": "aruppi", "name": "aruppi",
"version": "4.1.6", "version": "4.1.7",
"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.ts", "main": "./src/api/api.ts",
"scripts": { "scripts": {

@ -26,7 +26,7 @@ routes.get('/api/v4/', (req: Request, res: Response) => {
res.json({ res.json({
message: 'Aruppi /api - 🎏', message: 'Aruppi /api - 🎏',
author: 'Jéluchu', author: 'Jéluchu',
version: '4.1.6', version: '4.1.7',
credits: 'The bitch loves /apis that offers data to Aruppi App', credits: 'The bitch loves /apis that offers data to Aruppi App',
entries: [ entries: [
{ {

@ -471,7 +471,7 @@ export const monoschinosInfo = async (
id: string | undefined, id: string | undefined,
mal_id: number, mal_id: number,
) => { ) => {
let $: cheerio.Root; let info;
let episodeList: any[] = []; let episodeList: any[] = [];
let extraInfo: any; let extraInfo: any;
@ -488,9 +488,9 @@ export const monoschinosInfo = async (
} }
} }
$ = await requestGot(`${urls.BASE_MONOSCHINOS}anime/${id}`, { info = await requestGot(`${urls.BASE_ARUPPI_MONOSCHINOS}anime/${id}`, {
scrapy: true, scrapy: false,
parse: false, parse: true,
}); });
/* Extra info of the anime */ /* Extra info of the anime */
@ -499,7 +499,6 @@ export const monoschinosInfo = async (
console.log(err); console.log(err);
} }
if ($!) {
if (extraInfo) { if (extraInfo) {
let broadCastDate = new Date(); let broadCastDate = new Date();
let dd: number, mm: string | number, yyyy: number; let dd: number, mm: string | number, yyyy: number;
@ -554,25 +553,12 @@ export const monoschinosInfo = async (
} }
} }
$!('.SerieCaps a').each((index: number, element: cheerio.Element) => { for (const anime of info.episodes) {
let episode: number;
$(element)
.attr('href')
?.split('-')
.forEach((item: any) => {
if (!isNaN(item)) {
episode = parseInt(item);
}
});
episodeList.push({ episodeList.push({
episode: episode!, episode: anime.no,
id: `${$(element).attr('href')?.split('/')[3]}/${ id: `ver/${anime.id}`,
$(element).attr('href')?.split('/')[4]
}`,
});
}); });
}
if (episodeList.length > 0) { if (episodeList.length > 0) {
if (redisClient.connected) { if (redisClient.connected) {
@ -595,9 +581,7 @@ export const monoschinosInfo = async (
} else { } else {
return undefined; return undefined;
} }
} else {
return undefined;
}
}; };
export const tioanimeInfo = async (id: string | undefined, mal_id: number) => { export const tioanimeInfo = async (id: string | undefined, mal_id: number) => {

Loading…
Cancel
Save