|
|
@ -259,75 +259,6 @@ const getPosterAndType = async (
|
|
|
|
return '';
|
|
|
|
return '';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export const getRelatedAnimesFLV = async (id: string) => {
|
|
|
|
|
|
|
|
let $: cheerio.Root;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
|
|
|
|
`relatedFLV_${hashStringMd5(id)}`,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (resultQueryRedis) {
|
|
|
|
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(`${urls.BASE_ANIMEFLV}/anime/${id}`, {
|
|
|
|
|
|
|
|
parse: false,
|
|
|
|
|
|
|
|
scrapy: true,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
|
|
return err;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let listRelated: any = {};
|
|
|
|
|
|
|
|
let relatedAnimes: RelatedAnime[] = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('ul.ListAnmRel li a').each((index: number, element: any) => {
|
|
|
|
|
|
|
|
listRelated[$(element).text()] = $(element).attr('href');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const related in listRelated) {
|
|
|
|
|
|
|
|
let posterUrl: any = await getPosterAndType(
|
|
|
|
|
|
|
|
listRelated[related].split('/')[2],
|
|
|
|
|
|
|
|
undefined,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (posterUrl !== '') {
|
|
|
|
|
|
|
|
relatedAnimes.push({
|
|
|
|
|
|
|
|
title: related,
|
|
|
|
|
|
|
|
type: posterUrl[1],
|
|
|
|
|
|
|
|
poster: posterUrl[0],
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (relatedAnimes.length > 0) {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
|
|
|
|
`relatedFLV_${hashStringMd5(id)}`,
|
|
|
|
|
|
|
|
JSON.stringify(relatedAnimes),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* After 24hrs expire the key. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
redisClient.expireat(
|
|
|
|
|
|
|
|
`relatedFLV_${hashStringMd5(id)}`,
|
|
|
|
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return relatedAnimes;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const getRelatedAnimesMAL = async (mal_id: number) => {
|
|
|
|
export const getRelatedAnimesMAL = async (mal_id: number) => {
|
|
|
|
let $: cheerio.Root;
|
|
|
|
let $: cheerio.Root;
|
|
|
|
|
|
|
|
|
|
|
@ -406,12 +337,11 @@ export const getRelatedAnimesMAL = async (mal_id: number) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export const animeFlvInfo = async (id: string | undefined, mal_id: number) => {
|
|
|
|
export const jkanimeInfo = async (id: string | undefined, mal_id: number) => {
|
|
|
|
let $: cheerio.Root;
|
|
|
|
let $: cheerio.Root;
|
|
|
|
let anime_info: string[] = [];
|
|
|
|
|
|
|
|
let anime_eps: string[] = [];
|
|
|
|
|
|
|
|
let episodesList: any[] = [];
|
|
|
|
|
|
|
|
let extraInfo: any;
|
|
|
|
let extraInfo: any;
|
|
|
|
|
|
|
|
let episodesList: any[] = [];
|
|
|
|
|
|
|
|
let countEpisodes: string[] = [];
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
/* Extra info of the anime */
|
|
|
|
/* Extra info of the anime */
|
|
|
@ -419,7 +349,7 @@ export const animeFlvInfo = async (id: string | undefined, mal_id: number) => {
|
|
|
|
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
if (redisClient.connected) {
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
`animeflvInfo_${hashStringMd5(id!)}`,
|
|
|
|
`jkanimeInfo_${hashStringMd5(id!)}`,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if (resultQueryRedis) {
|
|
|
|
if (resultQueryRedis) {
|
|
|
@ -429,16 +359,24 @@ export const animeFlvInfo = async (id: string | undefined, mal_id: number) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(`${urls.BASE_ANIMEFLV}/anime/${id}`, {
|
|
|
|
$ = await requestGot(`${urls.BASE_JKANIME}${id}`, {
|
|
|
|
scrapy: true,
|
|
|
|
scrapy: true,
|
|
|
|
parse: false,
|
|
|
|
parse: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
console.log($.html());
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
return err;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
countEpisodes = $('div.anime__pagination a')
|
|
|
|
|
|
|
|
.map((index: number, element: cheerio.Element) => {
|
|
|
|
|
|
|
|
return $(element).text();
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.get();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const episodesCount: string = countEpisodes[countEpisodes.length - 1].split(
|
|
|
|
|
|
|
|
'-',
|
|
|
|
|
|
|
|
)[1];
|
|
|
|
|
|
|
|
|
|
|
|
let broadCastDate = new Date();
|
|
|
|
let broadCastDate = new Date();
|
|
|
|
let dd: number, mm: string | number, yyyy: number;
|
|
|
|
let dd: number, mm: string | number, yyyy: number;
|
|
|
|
|
|
|
|
|
|
|
@ -491,24 +429,10 @@ export const animeFlvInfo = async (id: string | undefined, mal_id: number) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const scripts: cheerio.Element[] = $('script').toArray();
|
|
|
|
for (let i = 1; i <= parseInt(episodesCount); i++) {
|
|
|
|
|
|
|
|
|
|
|
|
for (const script of scripts) {
|
|
|
|
|
|
|
|
if ($(script).html()!.includes('anime_info')) {
|
|
|
|
|
|
|
|
anime_info = JSON.parse(
|
|
|
|
|
|
|
|
$(script).html()!.split('var anime_info = ')[1].split(';\n')[0],
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
anime_eps = JSON.parse(
|
|
|
|
|
|
|
|
$(script).html()!.split('var episodes = ')[1].split(';')[0],
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const episode of anime_eps) {
|
|
|
|
|
|
|
|
episodesList.push({
|
|
|
|
episodesList.push({
|
|
|
|
episode: episode[0],
|
|
|
|
episode: i,
|
|
|
|
id: `${episode[1]}/${id}-${episode[0]}`,
|
|
|
|
id: `${id}/${i}`,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -517,14 +441,14 @@ export const animeFlvInfo = async (id: string | undefined, mal_id: number) => {
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
redisClient.set(
|
|
|
|
`animeflvInfo_${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(
|
|
|
|
`animeflvInfo_${hashStringMd5(id!)}`,
|
|
|
|
`jkanimeInfo_${hashStringMd5(id!)}`,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -535,11 +459,13 @@ export const animeFlvInfo = async (id: string | undefined, mal_id: number) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export const jkanimeInfo = async (id: string | undefined, mal_id: number) => {
|
|
|
|
export const monoschinosInfo = async (
|
|
|
|
|
|
|
|
id: string | undefined,
|
|
|
|
|
|
|
|
mal_id: number,
|
|
|
|
|
|
|
|
) => {
|
|
|
|
let $: cheerio.Root;
|
|
|
|
let $: cheerio.Root;
|
|
|
|
|
|
|
|
let episodeList: any[] = [];
|
|
|
|
let extraInfo: any;
|
|
|
|
let extraInfo: any;
|
|
|
|
let episodesList: any[] = [];
|
|
|
|
|
|
|
|
let countEpisodes: string[] = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
/* Extra info of the anime */
|
|
|
|
/* Extra info of the anime */
|
|
|
@ -547,7 +473,7 @@ export const jkanimeInfo = async (id: string | undefined, mal_id: number) => {
|
|
|
|
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
if (redisClient.connected) {
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
`jkanimeInfo_${hashStringMd5(id!)}`,
|
|
|
|
`monoschinosInfo_${hashStringMd5(id!)}`,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if (resultQueryRedis) {
|
|
|
|
if (resultQueryRedis) {
|
|
|
@ -557,7 +483,7 @@ export const jkanimeInfo = async (id: string | undefined, mal_id: number) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(`${urls.BASE_JKANIME}${id}`, {
|
|
|
|
$ = await requestGot(`${urls.BASE_MONOSCHINOS}anime/${id}`, {
|
|
|
|
scrapy: true,
|
|
|
|
scrapy: true,
|
|
|
|
parse: false,
|
|
|
|
parse: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -565,16 +491,6 @@ export const jkanimeInfo = async (id: string | undefined, mal_id: number) => {
|
|
|
|
return err;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
countEpisodes = $('div.anime__pagination a')
|
|
|
|
|
|
|
|
.map((index: number, element: cheerio.Element) => {
|
|
|
|
|
|
|
|
return $(element).text();
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.get();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const episodesCount: string = countEpisodes[countEpisodes.length - 1].split(
|
|
|
|
|
|
|
|
'-',
|
|
|
|
|
|
|
|
)[1];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let broadCastDate = new Date();
|
|
|
|
let broadCastDate = new Date();
|
|
|
|
let dd: number, mm: string | number, yyyy: number;
|
|
|
|
let dd: number, mm: string | number, yyyy: number;
|
|
|
|
|
|
|
|
|
|
|
@ -621,48 +537,59 @@ export const jkanimeInfo = async (id: string | undefined, mal_id: number) => {
|
|
|
|
: broadCastDate.getMonth() + 1;
|
|
|
|
: broadCastDate.getMonth() + 1;
|
|
|
|
yyyy = broadCastDate.getFullYear();
|
|
|
|
yyyy = broadCastDate.getFullYear();
|
|
|
|
|
|
|
|
|
|
|
|
episodesList.push({
|
|
|
|
episodeList.push({
|
|
|
|
nextEpisodeDate: `${yyyy}-${mm}-${dd}`,
|
|
|
|
nextEpisodeDate: `${yyyy}-${mm}-${dd}`,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 1; i <= parseInt(episodesCount); i++) {
|
|
|
|
$('.SerieCaps a').each((index: number, element: cheerio.Element) => {
|
|
|
|
episodesList.push({
|
|
|
|
let episode: number;
|
|
|
|
episode: i,
|
|
|
|
|
|
|
|
id: `${id}/${i}`,
|
|
|
|
$(element)
|
|
|
|
|
|
|
|
.attr('href')
|
|
|
|
|
|
|
|
?.split('-')
|
|
|
|
|
|
|
|
.forEach((item: any) => {
|
|
|
|
|
|
|
|
if (!isNaN(item)) {
|
|
|
|
|
|
|
|
episode = parseInt(item);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
episodeList.push({
|
|
|
|
|
|
|
|
episode: episode!,
|
|
|
|
|
|
|
|
id: `${$(element).attr('href')?.split('/')[3]}/${
|
|
|
|
|
|
|
|
$(element).attr('href')?.split('/')[4]
|
|
|
|
|
|
|
|
}`,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (episodesList.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(
|
|
|
|
`jkanimeInfo_${hashStringMd5(id!)}`,
|
|
|
|
`monoschinosInfo_${hashStringMd5(id!)}`,
|
|
|
|
JSON.stringify(episodesList),
|
|
|
|
JSON.stringify(episodeList),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/* After 24hrs expire the key. */
|
|
|
|
/* After 24hrs expire the key. */
|
|
|
|
|
|
|
|
|
|
|
|
redisClient.expireat(
|
|
|
|
redisClient.expireat(
|
|
|
|
`jkanimeInfo_${hashStringMd5(id!)}`,
|
|
|
|
`monoschinosInfo_${hashStringMd5(id!)}`,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return episodesList;
|
|
|
|
return episodeList;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export const monoschinosInfo = async (
|
|
|
|
export const tioanimeInfo = async (id: string | undefined, mal_id: number) => {
|
|
|
|
id: string | undefined,
|
|
|
|
|
|
|
|
mal_id: number,
|
|
|
|
|
|
|
|
) => {
|
|
|
|
|
|
|
|
let $: cheerio.Root;
|
|
|
|
let $: cheerio.Root;
|
|
|
|
let episodeList: any[] = [];
|
|
|
|
let episodesList: any[] = [];
|
|
|
|
|
|
|
|
let anime_eps: string[] = [];
|
|
|
|
let extraInfo: any;
|
|
|
|
let extraInfo: any;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -671,7 +598,7 @@ export const monoschinosInfo = async (
|
|
|
|
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
if (redisClient.connected) {
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
`monoschinosInfo_${hashStringMd5(id!)}`,
|
|
|
|
`tioanimeInfo_${hashStringMd5(id!)}`,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if (resultQueryRedis) {
|
|
|
|
if (resultQueryRedis) {
|
|
|
@ -681,7 +608,7 @@ export const monoschinosInfo = async (
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(`${urls.BASE_MONOSCHINOS}anime/${id}`, {
|
|
|
|
$ = await requestGot(`${urls.BASE_TIOANIME}anime/${id}`, {
|
|
|
|
scrapy: true,
|
|
|
|
scrapy: true,
|
|
|
|
parse: false,
|
|
|
|
parse: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -735,53 +662,46 @@ export const monoschinosInfo = async (
|
|
|
|
: broadCastDate.getMonth() + 1;
|
|
|
|
: broadCastDate.getMonth() + 1;
|
|
|
|
yyyy = broadCastDate.getFullYear();
|
|
|
|
yyyy = broadCastDate.getFullYear();
|
|
|
|
|
|
|
|
|
|
|
|
episodeList.push({
|
|
|
|
episodesList.push({
|
|
|
|
nextEpisodeDate: `${yyyy}-${mm}-${dd}`,
|
|
|
|
nextEpisodeDate: `${yyyy}-${mm}-${dd}`,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$('.SerieCaps a').each((index: number, element: cheerio.Element) => {
|
|
|
|
const scripts: cheerio.Element[] = $('script').toArray();
|
|
|
|
let episode: number;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(element)
|
|
|
|
for (const script of scripts) {
|
|
|
|
.attr('href')
|
|
|
|
if ($(script).html()!.includes('anime_info')) {
|
|
|
|
?.split('-')
|
|
|
|
anime_eps = JSON.parse(
|
|
|
|
.forEach((item: any) => {
|
|
|
|
$(script).html()!.split('var episodes = ')[1].split(';')[0],
|
|
|
|
if (!isNaN(item)) {
|
|
|
|
);
|
|
|
|
episode = parseInt(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
episodeList.push({
|
|
|
|
for (const episode of anime_eps) {
|
|
|
|
episode: episode!,
|
|
|
|
episodesList.push({
|
|
|
|
id: `${$(element).attr('href')?.split('/')[3]}/${
|
|
|
|
episode: episode[0],
|
|
|
|
$(element).attr('href')?.split('/')[4]
|
|
|
|
id: `ver/${id}-${episode}`,
|
|
|
|
}`,
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (episodeList.length > 0) {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
if (redisClient.connected) {
|
|
|
|
`monoschinosInfo_${hashStringMd5(id!)}`,
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
JSON.stringify(episodeList),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* After 24hrs expire the key. */
|
|
|
|
redisClient.set(
|
|
|
|
|
|
|
|
`tioanimeInfo_${hashStringMd5(id!)}`,
|
|
|
|
|
|
|
|
JSON.stringify(episodesList),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
redisClient.expireat(
|
|
|
|
/* After 24hrs expire the key. */
|
|
|
|
`monoschinosInfo_${hashStringMd5(id!)}`,
|
|
|
|
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return episodeList;
|
|
|
|
redisClient.expireat(
|
|
|
|
} else {
|
|
|
|
`tioanimeInfo_${hashStringMd5(id!)}`,
|
|
|
|
return null;
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return episodesList;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export const videoServersMonosChinos = async (id: string) => {
|
|
|
|
export const videoServersMonosChinos = async (id: string) => {
|
|
|
@ -870,6 +790,73 @@ export const videoServersMonosChinos = async (id: string) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const videoServersTioAnime = async (id: string) => {
|
|
|
|
|
|
|
|
let $: cheerio.Root;
|
|
|
|
|
|
|
|
let servers: any;
|
|
|
|
|
|
|
|
let videoServers: any[] = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
|
|
|
const resultQueryRedis: any = await redisClient.get(
|
|
|
|
|
|
|
|
`videoServersTioAnime_${hashStringMd5(id)}`,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (resultQueryRedis) {
|
|
|
|
|
|
|
|
const resultRedis: any = JSON.parse(resultQueryRedis);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return resultRedis;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$ = await requestGot(`${urls.BASE_TIOANIME}${id}`, {
|
|
|
|
|
|
|
|
scrapy: true,
|
|
|
|
|
|
|
|
parse: false,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
|
|
return err;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const scripts: cheerio.Element[] = $('script').toArray();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const script of scripts) {
|
|
|
|
|
|
|
|
if ($(script).html()!.includes('var videos =')) {
|
|
|
|
|
|
|
|
servers = JSON.parse(
|
|
|
|
|
|
|
|
$(script).html()!.split('var videos = ')[1].split(';')[0],
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const server of servers) {
|
|
|
|
|
|
|
|
videoServers.push({
|
|
|
|
|
|
|
|
id: server[0].toLowerCase(),
|
|
|
|
|
|
|
|
url: server[1],
|
|
|
|
|
|
|
|
direct: false,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (videoServers.length > 0) {
|
|
|
|
|
|
|
|
if (redisClient.connected) {
|
|
|
|
|
|
|
|
/* Set the key in the redis cache. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
redisClient.set(
|
|
|
|
|
|
|
|
`videoServersTioAnime_${hashStringMd5(id)}`,
|
|
|
|
|
|
|
|
JSON.stringify(videoServers),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* After 24hrs expire the key. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
redisClient.expireat(
|
|
|
|
|
|
|
|
`videoServersTioAnime_${hashStringMd5(id)}`,
|
|
|
|
|
|
|
|
parseInt(`${+new Date() / 1000}`, 10) + 7200,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return videoServers;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export const videoServersJK = async (id: string) => {
|
|
|
|
export const videoServersJK = async (id: string) => {
|
|
|
|
let $: cheerio.Root;
|
|
|
|
let $: cheerio.Root;
|
|
|
|
let servers: any = {};
|
|
|
|
let servers: any = {};
|
|
|
@ -902,8 +889,6 @@ export const videoServersJK = async (id: string) => {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.get();
|
|
|
|
.get();
|
|
|
|
|
|
|
|
|
|
|
|
console.log(serverNames);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('script').each((index: number, element: cheerio.Element) => {
|
|
|
|
$('script').each((index: number, element: cheerio.Element) => {
|
|
|
|
if ($(element).html()!.includes('var video = [];')) {
|
|
|
|
if ($(element).html()!.includes('var video = [];')) {
|
|
|
|
script = $(element).html();
|
|
|
|
script = $(element).html();
|
|
|
|