|
|
|
@ -56,6 +56,7 @@ export const animeExtraInfo = async (mal_id: number) => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
|
`extraInfo_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
|
);
|
|
|
|
@ -64,14 +65,15 @@ export const animeExtraInfo = async (mal_id: number) => {
|
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data = await requestGot(`${urls.BASE_JIKAN}anime/${mal_id}`, {
|
|
|
|
|
parse: true,
|
|
|
|
|
scrapy: false,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
broadcast = data.broadcast.split('at')[0].trim().toLowerCase() || null;
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
@ -101,6 +103,7 @@ export const animeExtraInfo = async (mal_id: number) => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (formattedObject) {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
@ -114,6 +117,7 @@ export const animeExtraInfo = async (mal_id: number) => {
|
|
|
|
|
`extraInfo_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return formattedObject;
|
|
|
|
|
} else {
|
|
|
|
@ -125,6 +129,7 @@ export const getAnimeVideoPromo = async (mal_id: number) => {
|
|
|
|
|
let data: any;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
|
`promoInfo_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
|
);
|
|
|
|
@ -133,12 +138,13 @@ export const getAnimeVideoPromo = async (mal_id: number) => {
|
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data = await requestGot(`${urls.BASE_JIKAN}anime/${mal_id}/videos`, {
|
|
|
|
|
parse: true,
|
|
|
|
|
scrapy: false,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
@ -152,6 +158,7 @@ export const getAnimeVideoPromo = async (mal_id: number) => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (promo.length > 0) {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
@ -165,6 +172,7 @@ export const getAnimeVideoPromo = async (mal_id: number) => {
|
|
|
|
|
`promoInfo_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return promo;
|
|
|
|
|
} else {
|
|
|
|
@ -176,6 +184,7 @@ export const getAnimeCharacters = async (mal_id: number) => {
|
|
|
|
|
let data: any;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
|
`charactersInfo_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
|
);
|
|
|
|
@ -184,12 +193,13 @@ export const getAnimeCharacters = async (mal_id: number) => {
|
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data = await requestGot(
|
|
|
|
|
`${urls.BASE_JIKAN}anime/${mal_id}/characters_staff`,
|
|
|
|
|
{ parse: true, scrapy: false },
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
@ -204,6 +214,7 @@ export const getAnimeCharacters = async (mal_id: number) => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (characters.length > 0) {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
@ -217,6 +228,7 @@ export const getAnimeCharacters = async (mal_id: number) => {
|
|
|
|
|
`charactersInfo_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return characters;
|
|
|
|
|
} else {
|
|
|
|
@ -251,6 +263,7 @@ export const getRelatedAnimesFLV = async (id: string) => {
|
|
|
|
|
let $: cheerio.Root;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
|
`relatedFLV_${hashStringMd5(id)}`,
|
|
|
|
|
);
|
|
|
|
@ -259,12 +272,13 @@ export const getRelatedAnimesFLV = async (id: string) => {
|
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(`${urls.BASE_ANIMEFLV}/anime/${id}`, {
|
|
|
|
|
parse: false,
|
|
|
|
|
scrapy: true,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
@ -292,6 +306,7 @@ export const getRelatedAnimesFLV = async (id: string) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (relatedAnimes.length > 0) {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
@ -305,6 +320,7 @@ export const getRelatedAnimesFLV = async (id: string) => {
|
|
|
|
|
`relatedFLV_${hashStringMd5(id)}`,
|
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return relatedAnimes;
|
|
|
|
|
} else {
|
|
|
|
@ -316,6 +332,7 @@ export const getRelatedAnimesMAL = async (mal_id: number) => {
|
|
|
|
|
let $: cheerio.Root;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
|
`getRelatedMAL_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
|
);
|
|
|
|
@ -324,12 +341,13 @@ export const getRelatedAnimesMAL = async (mal_id: number) => {
|
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(`https://myanimelist.net/anime/${mal_id}`, {
|
|
|
|
|
parse: false,
|
|
|
|
|
scrapy: true,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
@ -365,6 +383,7 @@ export const getRelatedAnimesMAL = async (mal_id: number) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (relatedAnimes.length > 0) {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
@ -378,6 +397,7 @@ export const getRelatedAnimesMAL = async (mal_id: number) => {
|
|
|
|
|
`getRelatedMAL_${hashStringMd5(`${mal_id}`)}`,
|
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return relatedAnimes;
|
|
|
|
|
}
|
|
|
|
@ -394,6 +414,7 @@ export const animeFlvInfo = async (id: string | undefined) => {
|
|
|
|
|
let episodes: any[] = [];
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
|
`animeflvInfo_${hashStringMd5(id!)}`,
|
|
|
|
|
);
|
|
|
|
@ -402,12 +423,13 @@ export const animeFlvInfo = async (id: string | undefined) => {
|
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(`${urls.BASE_ANIMEFLV}/anime/${id}`, {
|
|
|
|
|
scrapy: true,
|
|
|
|
|
parse: false,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
@ -442,6 +464,7 @@ export const animeFlvInfo = async (id: string | undefined) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (episodes.length > 0) {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
@ -455,6 +478,7 @@ export const animeFlvInfo = async (id: string | undefined) => {
|
|
|
|
|
`animeflvInfo_${hashStringMd5(id!)}`,
|
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return episodes;
|
|
|
|
|
} else {
|
|
|
|
@ -470,6 +494,7 @@ export const jkanimeInfo = async (id: string | undefined) => {
|
|
|
|
|
let countEpisodes: string[] = [];
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
|
`jkanimeInfo_${hashStringMd5(id!)}`,
|
|
|
|
|
);
|
|
|
|
@ -478,12 +503,13 @@ export const jkanimeInfo = async (id: string | undefined) => {
|
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(`${urls.BASE_JKANIME}${id}`, {
|
|
|
|
|
scrapy: true,
|
|
|
|
|
parse: false,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
@ -510,6 +536,7 @@ export const jkanimeInfo = async (id: string | undefined) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (episodesList.length > 0) {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
@ -523,6 +550,7 @@ export const jkanimeInfo = async (id: string | undefined) => {
|
|
|
|
|
`jkanimeInfo_${hashStringMd5(id!)}`,
|
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return episodesList;
|
|
|
|
|
} else {
|
|
|
|
@ -542,20 +570,22 @@ export const monoschinosInfo = async (
|
|
|
|
|
/* Extra info of the anime */
|
|
|
|
|
extraInfo = await animeExtraInfo(mal_id);
|
|
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
|
`monoschinosInfo_${hashStringMd5(id!)}`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (resultQueryRedis) {
|
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
console.log(extraInfo);
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(`${urls.BASE_MONOSCHINOS}anime/${id}`, {
|
|
|
|
|
scrapy: true,
|
|
|
|
|
parse: false,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
@ -607,7 +637,7 @@ export const monoschinosInfo = async (
|
|
|
|
|
yyyy = broadCastDate.getFullYear();
|
|
|
|
|
|
|
|
|
|
episodeList.push({
|
|
|
|
|
nextEpisodeDate: `${yyyy}/${mm}/${dd}/`,
|
|
|
|
|
nextEpisodeDate: `${yyyy}/${mm}/${dd}`,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -633,6 +663,7 @@ export const monoschinosInfo = async (
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (episodeList.length > 0) {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
@ -646,6 +677,7 @@ export const monoschinosInfo = async (
|
|
|
|
|
`monoschinosInfo_${hashStringMd5(id!)}`,
|
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return episodeList;
|
|
|
|
|
} else {
|
|
|
|
@ -658,6 +690,7 @@ export const videoServersMonosChinos = async (id: string) => {
|
|
|
|
|
let videoServers: any[] = [];
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
|
`videoServersMonosChinos_${hashStringMd5(id)}`,
|
|
|
|
|
);
|
|
|
|
@ -666,12 +699,13 @@ export const videoServersMonosChinos = async (id: string) => {
|
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(`${urls.BASE_MONOSCHINOS}${id}`, {
|
|
|
|
|
scrapy: true,
|
|
|
|
|
parse: false,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
@ -715,6 +749,7 @@ export const videoServersMonosChinos = async (id: string) => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (videoServers.length > 0) {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
@ -728,6 +763,7 @@ export const videoServersMonosChinos = async (id: string) => {
|
|
|
|
|
`videoServersMonosChinos_${hashStringMd5(id)}`,
|
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return videoServers;
|
|
|
|
|
} else {
|
|
|
|
@ -741,6 +777,7 @@ export const videoServersJK = async (id: string) => {
|
|
|
|
|
let script: string | null = '';
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
|
`videoServersJK_${hashStringMd5(id)}`,
|
|
|
|
|
);
|
|
|
|
@ -749,12 +786,13 @@ export const videoServersJK = async (id: string) => {
|
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(`${urls.BASE_JKANIME}${id}`, {
|
|
|
|
|
scrapy: true,
|
|
|
|
|
parse: false,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
@ -807,6 +845,7 @@ export const videoServersJK = async (id: string) => {
|
|
|
|
|
serverList = serverList.filter(x => x.id !== 'xtreme s' && x.id !== 'desuka');
|
|
|
|
|
|
|
|
|
|
if (serverList.length > 0) {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
@ -820,6 +859,7 @@ export const videoServersJK = async (id: string) => {
|
|
|
|
|
`videoServersJK_${hashStringMd5(id!)}`,
|
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return serverList;
|
|
|
|
|
} else {
|
|
|
|
@ -831,6 +871,7 @@ async function desuServerUrl(url: string) {
|
|
|
|
|
let $: cheerio.Root;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
|
`desuServerUrl_${hashStringMd5(url)}`,
|
|
|
|
|
);
|
|
|
|
@ -839,9 +880,10 @@ async function desuServerUrl(url: string) {
|
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
|
} else {
|
|
|
|
|
$ = await requestGot(url, { scrapy: true, parse: false });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(url, { scrapy: true, parse: false });
|
|
|
|
|
} catch (err) {
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
@ -864,6 +906,7 @@ async function desuServerUrl(url: string) {
|
|
|
|
|
.split("'")[1];
|
|
|
|
|
|
|
|
|
|
if (result.length > 0) {
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
@ -877,6 +920,7 @@ async function desuServerUrl(url: string) {
|
|
|
|
|
`desuServerUrl_${hashStringMd5(url)}`,
|
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
} else {
|
|
|
|
|