|
|
@ -56,6 +56,7 @@ export const animeExtraInfo = async (mal_id: number) => {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
`extraInfo_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
`extraInfo_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -64,14 +65,15 @@ export const animeExtraInfo = async (mal_id: number) => {
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
return resultRedis;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
data = await requestGot(`${urls.BASE_JIKAN}anime/${mal_id}`, {
|
|
|
|
data = await requestGot(`${urls.BASE_JIKAN}anime/${mal_id}`, {
|
|
|
|
parse: true,
|
|
|
|
parse: true,
|
|
|
|
scrapy: false,
|
|
|
|
scrapy: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
broadcast = data.broadcast.split('at')[0].trim().toLowerCase() || null;
|
|
|
|
broadcast = data.broadcast.split('at')[0].trim().toLowerCase() || null;
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
return err;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -101,6 +103,7 @@ export const animeExtraInfo = async (mal_id: number) => {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if (formattedObject) {
|
|
|
|
if (formattedObject) {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
redisClient.set(
|
|
|
@ -114,6 +117,7 @@ export const animeExtraInfo = async (mal_id: number) => {
|
|
|
|
`extraInfo_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
`extraInfo_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return formattedObject;
|
|
|
|
return formattedObject;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -125,6 +129,7 @@ export const getAnimeVideoPromo = async (mal_id: number) => {
|
|
|
|
let data: any;
|
|
|
|
let data: any;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
`promoInfo_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
`promoInfo_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -133,12 +138,13 @@ export const getAnimeVideoPromo = async (mal_id: number) => {
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
return resultRedis;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
data = await requestGot(`${urls.BASE_JIKAN}anime/${mal_id}/videos`, {
|
|
|
|
data = await requestGot(`${urls.BASE_JIKAN}anime/${mal_id}/videos`, {
|
|
|
|
parse: true,
|
|
|
|
parse: true,
|
|
|
|
scrapy: false,
|
|
|
|
scrapy: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
return err;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -152,6 +158,7 @@ export const getAnimeVideoPromo = async (mal_id: number) => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (promo.length > 0) {
|
|
|
|
if (promo.length > 0) {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
redisClient.set(
|
|
|
@ -165,6 +172,7 @@ export const getAnimeVideoPromo = async (mal_id: number) => {
|
|
|
|
`promoInfo_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
`promoInfo_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return promo;
|
|
|
|
return promo;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -176,6 +184,7 @@ export const getAnimeCharacters = async (mal_id: number) => {
|
|
|
|
let data: any;
|
|
|
|
let data: any;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
`charactersInfo_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
`charactersInfo_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -184,12 +193,13 @@ export const getAnimeCharacters = async (mal_id: number) => {
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
return resultRedis;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
data = await requestGot(
|
|
|
|
data = await requestGot(
|
|
|
|
`${urls.BASE_JIKAN}anime/${mal_id}/characters_staff`,
|
|
|
|
`${urls.BASE_JIKAN}anime/${mal_id}/characters_staff`,
|
|
|
|
{ parse: true, scrapy: false },
|
|
|
|
{ parse: true, scrapy: false },
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
return err;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -204,6 +214,7 @@ export const getAnimeCharacters = async (mal_id: number) => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (characters.length > 0) {
|
|
|
|
if (characters.length > 0) {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
redisClient.set(
|
|
|
@ -217,6 +228,7 @@ export const getAnimeCharacters = async (mal_id: number) => {
|
|
|
|
`charactersInfo_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
`charactersInfo_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return characters;
|
|
|
|
return characters;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -251,6 +263,7 @@ export const getRelatedAnimesFLV = async (id: string) => {
|
|
|
|
let $: cheerio.Root;
|
|
|
|
let $: cheerio.Root;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
`relatedFLV_${hashStringMd5(id)}`,
|
|
|
|
`relatedFLV_${hashStringMd5(id)}`,
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -259,12 +272,13 @@ export const getRelatedAnimesFLV = async (id: string) => {
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
return resultRedis;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(`${urls.BASE_ANIMEFLV}/anime/${id}`, {
|
|
|
|
$ = await requestGot(`${urls.BASE_ANIMEFLV}/anime/${id}`, {
|
|
|
|
parse: false,
|
|
|
|
parse: false,
|
|
|
|
scrapy: true,
|
|
|
|
scrapy: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
return err;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -292,6 +306,7 @@ export const getRelatedAnimesFLV = async (id: string) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (relatedAnimes.length > 0) {
|
|
|
|
if (relatedAnimes.length > 0) {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
redisClient.set(
|
|
|
@ -305,6 +320,7 @@ export const getRelatedAnimesFLV = async (id: string) => {
|
|
|
|
`relatedFLV_${hashStringMd5(id)}`,
|
|
|
|
`relatedFLV_${hashStringMd5(id)}`,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return relatedAnimes;
|
|
|
|
return relatedAnimes;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -316,6 +332,7 @@ export const getRelatedAnimesMAL = async (mal_id: number) => {
|
|
|
|
let $: cheerio.Root;
|
|
|
|
let $: cheerio.Root;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
`getRelatedMAL_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
`getRelatedMAL_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -324,12 +341,13 @@ export const getRelatedAnimesMAL = async (mal_id: number) => {
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
return resultRedis;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(`https://myanimelist.net/anime/${mal_id}`, {
|
|
|
|
$ = await requestGot(`https://myanimelist.net/anime/${mal_id}`, {
|
|
|
|
parse: false,
|
|
|
|
parse: false,
|
|
|
|
scrapy: true,
|
|
|
|
scrapy: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
return err;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -365,6 +383,7 @@ export const getRelatedAnimesMAL = async (mal_id: number) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (relatedAnimes.length > 0) {
|
|
|
|
if (relatedAnimes.length > 0) {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
redisClient.set(
|
|
|
@ -378,6 +397,7 @@ export const getRelatedAnimesMAL = async (mal_id: number) => {
|
|
|
|
`getRelatedMAL_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
`getRelatedMAL_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return relatedAnimes;
|
|
|
|
return relatedAnimes;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -394,6 +414,7 @@ export const animeFlvInfo = async (id: string | undefined) => {
|
|
|
|
let episodes: any[] = [];
|
|
|
|
let episodes: any[] = [];
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
`animeflvInfo_${hashStringMd5(id!)}`,
|
|
|
|
`animeflvInfo_${hashStringMd5(id!)}`,
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -402,12 +423,13 @@ export const animeFlvInfo = async (id: string | undefined) => {
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
return resultRedis;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(`${urls.BASE_ANIMEFLV}/anime/${id}`, {
|
|
|
|
$ = await requestGot(`${urls.BASE_ANIMEFLV}/anime/${id}`, {
|
|
|
|
scrapy: true,
|
|
|
|
scrapy: true,
|
|
|
|
parse: false,
|
|
|
|
parse: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
return err;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -442,6 +464,7 @@ export const animeFlvInfo = async (id: string | undefined) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (episodes.length > 0) {
|
|
|
|
if (episodes.length > 0) {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
redisClient.set(
|
|
|
@ -455,6 +478,7 @@ export const animeFlvInfo = async (id: string | undefined) => {
|
|
|
|
`animeflvInfo_${hashStringMd5(id!)}`,
|
|
|
|
`animeflvInfo_${hashStringMd5(id!)}`,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return episodes;
|
|
|
|
return episodes;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -470,6 +494,7 @@ export const jkanimeInfo = async (id: string | undefined) => {
|
|
|
|
let countEpisodes: string[] = [];
|
|
|
|
let countEpisodes: string[] = [];
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
`jkanimeInfo_${hashStringMd5(id!)}`,
|
|
|
|
`jkanimeInfo_${hashStringMd5(id!)}`,
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -478,12 +503,13 @@ export const jkanimeInfo = async (id: string | undefined) => {
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
return resultRedis;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(`${urls.BASE_JKANIME}${id}`, {
|
|
|
|
$ = await requestGot(`${urls.BASE_JKANIME}${id}`, {
|
|
|
|
scrapy: true,
|
|
|
|
scrapy: true,
|
|
|
|
parse: false,
|
|
|
|
parse: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
return err;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -510,6 +536,7 @@ export const jkanimeInfo = async (id: string | undefined) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (episodesList.length > 0) {
|
|
|
|
if (episodesList.length > 0) {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
redisClient.set(
|
|
|
@ -523,6 +550,7 @@ export const jkanimeInfo = async (id: string | undefined) => {
|
|
|
|
`jkanimeInfo_${hashStringMd5(id!)}`,
|
|
|
|
`jkanimeInfo_${hashStringMd5(id!)}`,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return episodesList;
|
|
|
|
return episodesList;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -530,11 +558,19 @@ export const jkanimeInfo = async (id: string | undefined) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export const monoschinosInfo = async (id: string | undefined) => {
|
|
|
|
export const monoschinosInfo = async (
|
|
|
|
|
|
|
|
id: string | undefined,
|
|
|
|
|
|
|
|
mal_id: number,
|
|
|
|
|
|
|
|
) => {
|
|
|
|
let $: cheerio.Root;
|
|
|
|
let $: cheerio.Root;
|
|
|
|
let episodeList: any[] = [];
|
|
|
|
let episodeList: any[] = [];
|
|
|
|
|
|
|
|
let extraInfo: any;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
/* Extra info of the anime */
|
|
|
|
|
|
|
|
extraInfo = await animeExtraInfo(mal_id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
`monoschinosInfo_${hashStringMd5(id!)}`,
|
|
|
|
`monoschinosInfo_${hashStringMd5(id!)}`,
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -543,16 +579,69 @@ export const monoschinosInfo = async (id: string | undefined) => {
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
return resultRedis;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(`${urls.BASE_MONOSCHINOS}anime/${id}`, {
|
|
|
|
$ = await requestGot(`${urls.BASE_MONOSCHINOS}anime/${id}`, {
|
|
|
|
scrapy: true,
|
|
|
|
scrapy: true,
|
|
|
|
parse: false,
|
|
|
|
parse: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
return err;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let broadCastDate = new Date();
|
|
|
|
|
|
|
|
let dd: number, mm: string | number, yyyy: number;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const airDay: any = {
|
|
|
|
|
|
|
|
Lunes: 1,
|
|
|
|
|
|
|
|
Martes: 2,
|
|
|
|
|
|
|
|
Miércoles: 3,
|
|
|
|
|
|
|
|
Jueves: 4,
|
|
|
|
|
|
|
|
Viernes: 5,
|
|
|
|
|
|
|
|
Sábados: 6,
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Adding one because of the day */
|
|
|
|
|
|
|
|
broadCastDate.setDate(broadCastDate.getDate() + 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (counter !== airDay[extraInfo.broadcast]) {
|
|
|
|
|
|
|
|
if (counter === 7) {
|
|
|
|
|
|
|
|
counter = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
broadCastDate.setDate(broadCastDate.getDate() + 1);
|
|
|
|
|
|
|
|
counter++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dd = broadCastDate.getDate();
|
|
|
|
|
|
|
|
mm =
|
|
|
|
|
|
|
|
broadCastDate.getMonth() + 1 < 10
|
|
|
|
|
|
|
|
? `0${broadCastDate.getMonth() + 1}`
|
|
|
|
|
|
|
|
: broadCastDate.getMonth() + 1;
|
|
|
|
|
|
|
|
yyyy = broadCastDate.getFullYear();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
episodeList.push({
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
@ -574,6 +663,7 @@ export const monoschinosInfo = async (id: string | undefined) => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (episodeList.length > 0) {
|
|
|
|
if (episodeList.length > 0) {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
redisClient.set(
|
|
|
@ -587,6 +677,7 @@ export const monoschinosInfo = async (id: string | undefined) => {
|
|
|
|
`monoschinosInfo_${hashStringMd5(id!)}`,
|
|
|
|
`monoschinosInfo_${hashStringMd5(id!)}`,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return episodeList;
|
|
|
|
return episodeList;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -599,6 +690,7 @@ export const videoServersMonosChinos = async (id: string) => {
|
|
|
|
let videoServers: any[] = [];
|
|
|
|
let videoServers: any[] = [];
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
`videoServersMonosChinos_${hashStringMd5(id)}`,
|
|
|
|
`videoServersMonosChinos_${hashStringMd5(id)}`,
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -607,12 +699,13 @@ export const videoServersMonosChinos = async (id: string) => {
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
return resultRedis;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(`${urls.BASE_MONOSCHINOS}${id}`, {
|
|
|
|
$ = await requestGot(`${urls.BASE_MONOSCHINOS}${id}`, {
|
|
|
|
scrapy: true,
|
|
|
|
scrapy: true,
|
|
|
|
parse: false,
|
|
|
|
parse: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
return err;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -656,6 +749,7 @@ export const videoServersMonosChinos = async (id: string) => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (videoServers.length > 0) {
|
|
|
|
if (videoServers.length > 0) {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
redisClient.set(
|
|
|
@ -669,6 +763,7 @@ export const videoServersMonosChinos = async (id: string) => {
|
|
|
|
`videoServersMonosChinos_${hashStringMd5(id)}`,
|
|
|
|
`videoServersMonosChinos_${hashStringMd5(id)}`,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return videoServers;
|
|
|
|
return videoServers;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -682,6 +777,7 @@ export const videoServersJK = async (id: string) => {
|
|
|
|
let script: string | null = '';
|
|
|
|
let script: string | null = '';
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
`videoServersJK_${hashStringMd5(id)}`,
|
|
|
|
`videoServersJK_${hashStringMd5(id)}`,
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -690,12 +786,13 @@ export const videoServersJK = async (id: string) => {
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
return resultRedis;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(`${urls.BASE_JKANIME}${id}`, {
|
|
|
|
$ = await requestGot(`${urls.BASE_JKANIME}${id}`, {
|
|
|
|
scrapy: true,
|
|
|
|
scrapy: true,
|
|
|
|
parse: false,
|
|
|
|
parse: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
return err;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -748,6 +845,7 @@ export const videoServersJK = async (id: string) => {
|
|
|
|
serverList = serverList.filter(x => x.id !== 'xtreme s' && x.id !== 'desuka');
|
|
|
|
serverList = serverList.filter(x => x.id !== 'xtreme s' && x.id !== 'desuka');
|
|
|
|
|
|
|
|
|
|
|
|
if (serverList.length > 0) {
|
|
|
|
if (serverList.length > 0) {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
redisClient.set(
|
|
|
@ -761,6 +859,7 @@ export const videoServersJK = async (id: string) => {
|
|
|
|
`videoServersJK_${hashStringMd5(id!)}`,
|
|
|
|
`videoServersJK_${hashStringMd5(id!)}`,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return serverList;
|
|
|
|
return serverList;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -772,6 +871,7 @@ async function desuServerUrl(url: string) {
|
|
|
|
let $: cheerio.Root;
|
|
|
|
let $: cheerio.Root;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
`desuServerUrl_${hashStringMd5(url)}`,
|
|
|
|
`desuServerUrl_${hashStringMd5(url)}`,
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -780,9 +880,10 @@ async function desuServerUrl(url: string) {
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
return resultRedis;
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$ = await requestGot(url, { scrapy: true, parse: false });
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(url, { scrapy: true, parse: false });
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
return err;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -805,6 +906,7 @@ async function desuServerUrl(url: string) {
|
|
|
|
.split("'")[1];
|
|
|
|
.split("'")[1];
|
|
|
|
|
|
|
|
|
|
|
|
if (result.length > 0) {
|
|
|
|
if (result.length > 0) {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
redisClient.set(
|
|
|
@ -818,6 +920,7 @@ async function desuServerUrl(url: string) {
|
|
|
|
`desuServerUrl_${hashStringMd5(url)}`,
|
|
|
|
`desuServerUrl_${hashStringMd5(url)}`,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|