👾 Fixing build error compile

pull/46/head
capitanwesler 4 years ago
parent f2e13f5201
commit d5550bbaeb

@ -752,9 +752,6 @@ export default class AnimeController {
data = await videoServersJK(id); data = await videoServersJK(id);
} }
switch (id) {
}
if (data) { if (data) {
if (redisClient.connected) { if (redisClient.connected) {
/* Set the key in the redis cache. */ /* Set the key in the redis cache. */

@ -367,97 +367,101 @@ export const jkanimeInfo = async (id: string | undefined, mal_id: number) => {
console.log(err); console.log(err);
} }
countEpisodes = $('div.anime__pagination a') if ($!) {
.map((index: number, element: cheerio.Element) => { countEpisodes = $!('div.anime__pagination a')
return $(element).text(); .map((index: number, element: cheerio.Element) => {
}) return $!(element).text();
.get(); })
.get();
const episodesCount: string = countEpisodes[countEpisodes.length - 1].split(
'-', const episodesCount: string = countEpisodes[countEpisodes.length - 1].split(
)[1]; '-',
)[1];
if (extraInfo) {
let broadCastDate = new Date(); if (extraInfo) {
let dd: number, mm: string | number, yyyy: number; let broadCastDate = new Date();
let dd: number, mm: string | number, yyyy: number;
const airDay: any = {
Lunes: 1, const airDay: any = {
Martes: 2, Lunes: 1,
Miércoles: 3, Martes: 2,
Jueves: 4, Miércoles: 3,
Viernes: 5, Jueves: 4,
Sábados: 6, Viernes: 5,
Domingos: 7, Sábados: 6,
'Sin emisión': 'default', Domingos: 7,
}; 'Sin emisión': 'default',
};
if (!extraInfo.aired.to) {
if (airDay.hasOwnProperty(extraInfo.broadcast)) {
if (broadCastDate.getDay() < airDay[extraInfo.broadcast]) {
for (
let i = broadCastDate.getDay();
i < airDay[extraInfo.broadcast];
i++
) {
broadCastDate.setDate(broadCastDate.getDate() + 1);
}
} else {
let counter = broadCastDate.getDay() + 1;
if (!extraInfo.aired.to) { /* Adding one because of the day */
if (airDay.hasOwnProperty(extraInfo.broadcast)) {
if (broadCastDate.getDay() < airDay[extraInfo.broadcast]) {
for (
let i = broadCastDate.getDay();
i < airDay[extraInfo.broadcast];
i++
) {
broadCastDate.setDate(broadCastDate.getDate() + 1); broadCastDate.setDate(broadCastDate.getDate() + 1);
}
} else {
let counter = broadCastDate.getDay() + 1;
/* Adding one because of the day */ while (counter !== airDay[extraInfo.broadcast]) {
broadCastDate.setDate(broadCastDate.getDate() + 1); if (counter === 7) {
counter = 0;
while (counter !== airDay[extraInfo.broadcast]) { }
if (counter === 7) { broadCastDate.setDate(broadCastDate.getDate() + 1);
counter = 0; counter++;
} }
broadCastDate.setDate(broadCastDate.getDate() + 1);
counter++;
} }
}
dd = broadCastDate.getDate(); dd = broadCastDate.getDate();
mm = mm =
broadCastDate.getMonth() + 1 < 10 broadCastDate.getMonth() + 1 < 10
? `0${broadCastDate.getMonth() + 1}` ? `0${broadCastDate.getMonth() + 1}`
: broadCastDate.getMonth() + 1; : broadCastDate.getMonth() + 1;
yyyy = broadCastDate.getFullYear(); yyyy = broadCastDate.getFullYear();
episodesList.push({ episodesList.push({
nextEpisodeDate: `${yyyy}-${mm}-${dd}`, nextEpisodeDate: `${yyyy}-${mm}-${dd}`,
}); });
}
} }
} }
}
for (let i = 1; i <= parseInt(episodesCount); i++) { for (let i = 1; i <= parseInt(episodesCount); i++) {
episodesList.push({ episodesList.push({
episode: i, episode: i,
id: `${id}/${i}`, id: `${id}/${i}`,
}); });
} }
if (episodesList.length > 0) { if (episodesList.length > 0) {
if (redisClient.connected) { if (redisClient.connected) {
/* Set the key in the redis cache. */ /* Set the key in the redis cache. */
redisClient.set( redisClient.set(
`jkanimeInfo_${hashStringMd5(id!)}`, `jkanimeInfo_${hashStringMd5(id!)}`,
JSON.stringify(episodesList), JSON.stringify(episodesList),
); );
/* After 24hrs expire the key. */ /* After 24hrs expire the key. */
redisClient.expireat( redisClient.expireat(
`jkanimeInfo_${hashStringMd5(id!)}`, `jkanimeInfo_${hashStringMd5(id!)}`,
parseInt(`${+new Date() / 1000}`, 10) + 7200, parseInt(`${+new Date() / 1000}`, 10) + 7200,
); );
} }
return episodesList; return episodesList;
} else {
return undefined;
}
} else { } else {
return null; return undefined;
} }
}; };
@ -493,100 +497,104 @@ export const monoschinosInfo = async (
console.log(err); console.log(err);
} }
if (extraInfo) { if ($!) {
let broadCastDate = new Date(); if (extraInfo) {
let dd: number, mm: string | number, yyyy: number; let broadCastDate = new Date();
let dd: number, mm: string | number, yyyy: number;
const airDay: any = {
Lunes: 1, const airDay: any = {
Martes: 2, Lunes: 1,
Miércoles: 3, Martes: 2,
Jueves: 4, Miércoles: 3,
Viernes: 5, Jueves: 4,
Sábados: 6, Viernes: 5,
Domingos: 7, Sábados: 6,
'Sin emisión': 'default', Domingos: 7,
}; 'Sin emisión': 'default',
};
if (!extraInfo.aired.to) {
if (airDay.hasOwnProperty(extraInfo.broadcast)) {
if (broadCastDate.getDay() < airDay[extraInfo.broadcast]) {
for (
let i = broadCastDate.getDay();
i < airDay[extraInfo.broadcast];
i++
) {
broadCastDate.setDate(broadCastDate.getDate() + 1);
}
} else {
let counter = broadCastDate.getDay() + 1;
if (!extraInfo.aired.to) { /* Adding one because of the day */
if (airDay.hasOwnProperty(extraInfo.broadcast)) {
if (broadCastDate.getDay() < airDay[extraInfo.broadcast]) {
for (
let i = broadCastDate.getDay();
i < airDay[extraInfo.broadcast];
i++
) {
broadCastDate.setDate(broadCastDate.getDate() + 1); broadCastDate.setDate(broadCastDate.getDate() + 1);
}
} else {
let counter = broadCastDate.getDay() + 1;
/* Adding one because of the day */
broadCastDate.setDate(broadCastDate.getDate() + 1);
while (counter !== airDay[extraInfo.broadcast]) { while (counter !== airDay[extraInfo.broadcast]) {
if (counter === 7) { if (counter === 7) {
counter = 0; counter = 0;
}
broadCastDate.setDate(broadCastDate.getDate() + 1);
counter++;
} }
broadCastDate.setDate(broadCastDate.getDate() + 1);
counter++;
} }
}
dd = broadCastDate.getDate(); dd = broadCastDate.getDate();
mm = mm =
broadCastDate.getMonth() + 1 < 10 broadCastDate.getMonth() + 1 < 10
? `0${broadCastDate.getMonth() + 1}` ? `0${broadCastDate.getMonth() + 1}`
: broadCastDate.getMonth() + 1; : broadCastDate.getMonth() + 1;
yyyy = broadCastDate.getFullYear(); yyyy = broadCastDate.getFullYear();
episodeList.push({ episodeList.push({
nextEpisodeDate: `${yyyy}-${mm}-${dd}`, nextEpisodeDate: `${yyyy}-${mm}-${dd}`,
}); });
}
} }
} }
}
$('.SerieCaps a').each((index: number, element: cheerio.Element) => { $!('.SerieCaps a').each((index: number, element: cheerio.Element) => {
let episode: number; let episode: number;
$(element) $(element)
.attr('href') .attr('href')
?.split('-') ?.split('-')
.forEach((item: any) => { .forEach((item: any) => {
if (!isNaN(item)) { if (!isNaN(item)) {
episode = parseInt(item); episode = parseInt(item);
} }
}); });
episodeList.push({ episodeList.push({
episode: episode!, episode: episode!,
id: `${$(element).attr('href')?.split('/')[3]}/${ id: `${$(element).attr('href')?.split('/')[3]}/${
$(element).attr('href')?.split('/')[4] $(element).attr('href')?.split('/')[4]
}`, }`,
});
}); });
});
if (episodeList.length > 0) { if (episodeList.length > 0) {
if (redisClient.connected) { if (redisClient.connected) {
/* Set the key in the redis cache. */ /* Set the key in the redis cache. */
redisClient.set( redisClient.set(
`monoschinosInfo_${hashStringMd5(id!)}`, `monoschinosInfo_${hashStringMd5(id!)}`,
JSON.stringify(episodeList), JSON.stringify(episodeList),
); );
/* After 24hrs expire the key. */ /* After 24hrs expire the key. */
redisClient.expireat( redisClient.expireat(
`monoschinosInfo_${hashStringMd5(id!)}`, `monoschinosInfo_${hashStringMd5(id!)}`,
parseInt(`${+new Date() / 1000}`, 10) + 7200, parseInt(`${+new Date() / 1000}`, 10) + 7200,
); );
} }
return episodeList; return episodeList;
} else {
return undefined;
}
} else { } else {
return null; return undefined;
} }
}; };
@ -620,94 +628,98 @@ export const tioanimeInfo = async (id: string | undefined, mal_id: number) => {
console.log(err); console.log(err);
} }
if (extraInfo) { if ($!) {
let broadCastDate = new Date(); if (extraInfo) {
let dd: number, mm: string | number, yyyy: number; let broadCastDate = new Date();
let dd: number, mm: string | number, yyyy: number;
const airDay: any = {
Lunes: 1, const airDay: any = {
Martes: 2, Lunes: 1,
Miércoles: 3, Martes: 2,
Jueves: 4, Miércoles: 3,
Viernes: 5, Jueves: 4,
Sábados: 6, Viernes: 5,
Domingos: 7, Sábados: 6,
'Sin emisión': 'default', Domingos: 7,
}; 'Sin emisión': 'default',
};
if (!extraInfo.aired.to) {
if (airDay.hasOwnProperty(extraInfo.broadcast)) {
if (broadCastDate.getDay() < airDay[extraInfo.broadcast]) {
for (
let i = broadCastDate.getDay();
i < airDay[extraInfo.broadcast];
i++
) {
broadCastDate.setDate(broadCastDate.getDate() + 1);
}
} else {
let counter = broadCastDate.getDay() + 1;
if (!extraInfo.aired.to) { /* Adding one because of the day */
if (airDay.hasOwnProperty(extraInfo.broadcast)) {
if (broadCastDate.getDay() < airDay[extraInfo.broadcast]) {
for (
let i = broadCastDate.getDay();
i < airDay[extraInfo.broadcast];
i++
) {
broadCastDate.setDate(broadCastDate.getDate() + 1); broadCastDate.setDate(broadCastDate.getDate() + 1);
}
} else {
let counter = broadCastDate.getDay() + 1;
/* Adding one because of the day */ while (counter !== airDay[extraInfo.broadcast]) {
broadCastDate.setDate(broadCastDate.getDate() + 1); if (counter === 7) {
counter = 0;
while (counter !== airDay[extraInfo.broadcast]) { }
if (counter === 7) { broadCastDate.setDate(broadCastDate.getDate() + 1);
counter = 0; counter++;
} }
broadCastDate.setDate(broadCastDate.getDate() + 1);
counter++;
} }
}
dd = broadCastDate.getDate(); dd = broadCastDate.getDate();
mm = mm =
broadCastDate.getMonth() + 1 < 10 broadCastDate.getMonth() + 1 < 10
? `0${broadCastDate.getMonth() + 1}` ? `0${broadCastDate.getMonth() + 1}`
: broadCastDate.getMonth() + 1; : broadCastDate.getMonth() + 1;
yyyy = broadCastDate.getFullYear(); yyyy = broadCastDate.getFullYear();
episodesList.push({ episodesList.push({
nextEpisodeDate: `${yyyy}-${mm}-${dd}`, nextEpisodeDate: `${yyyy}-${mm}-${dd}`,
}); });
}
} }
} }
}
const scripts: cheerio.Element[] = $('script').toArray(); const scripts: cheerio.Element[] = $!('script').toArray();
for (const script of scripts) { for (const script of scripts) {
if ($(script).html()!.includes('anime_info')) { if ($!(script).html()!.includes('anime_info')) {
anime_eps = JSON.parse( anime_eps = JSON.parse(
$(script).html()!.split('var episodes = ')[1].split(';')[0], $!(script).html()!.split('var episodes = ')[1].split(';')[0],
); );
}
} }
}
for (const episode of anime_eps) { for (const episode of anime_eps) {
episodesList.push({ episodesList.push({
episode: episode, episode: episode,
id: `ver/${id}-${episode}`, id: `ver/${id}-${episode}`,
}); });
} }
if (redisClient.connected) { if (redisClient.connected) {
/* Set the key in the redis cache. */ /* Set the key in the redis cache. */
redisClient.set( redisClient.set(
`tioanimeInfo_${hashStringMd5(id!)}`, `tioanimeInfo_${hashStringMd5(id!)}`,
JSON.stringify(episodesList), JSON.stringify(episodesList),
); );
/* After 24hrs expire the key. */ /* After 24hrs expire the key. */
redisClient.expireat( redisClient.expireat(
`tioanimeInfo_${hashStringMd5(id!)}`, `tioanimeInfo_${hashStringMd5(id!)}`,
parseInt(`${+new Date() / 1000}`, 10) + 7200, parseInt(`${+new Date() / 1000}`, 10) + 7200,
); );
} }
return episodesList; return episodesList;
} else {
return undefined;
}
}; };
export const videoServersMonosChinos = async (id: string) => { export const videoServersMonosChinos = async (id: string) => {

Loading…
Cancel
Save