👾 Updating the monoschinos and redirecting

pull/33/head
capitanwesler 4 years ago
parent c4d83df972
commit f855479650

@ -117,7 +117,7 @@ routes.get('/api/v4/generateWaifu/', utilsController.getWaifuRandom);
/* Routes to handling the v3 deprecated */ /* Routes to handling the v3 deprecated */
routes.get('/api/v3/*', (req: Request, res: Response, next: NextFunction) => { routes.get('/api/v3/*', (req: Request, res: Response, next: NextFunction) => {
res.status(302).redirect('/api/v2'); res.status(302).redirect('/api/v3');
}); });
routes.get('/api/v3', (req: Request, res: Response, next: NextFunction) => { routes.get('/api/v3', (req: Request, res: Response, next: NextFunction) => {

@ -601,11 +601,24 @@ export const videoServersMonosChinos = async (id: string) => {
return err; return err;
} }
let videosContainer = $('.TPlayerTb').text(); let videoNames: string[] = $('.TPlayerNv li')
let counter: number = 1; .map((index: number, element: cheerio.Element) => {
return $(element).attr('title');
})
.get();
videoServers.push({
id: videoNames[0],
url: decodeURIComponent(
$('.TPlayer div iframe').attr('src')?.split('url=')[1]!,
).split('&id')[0],
direct: false,
});
const videoContainer: any = $('.TPlayer div').text();
$(videosContainer).each((index: number, element: cheerio.Element) => { $(videoContainer).each((index: number, element: cheerio.Element) => {
let video = $(element).attr('src'); let video: any = $(element).attr('src');
if (video) { if (video) {
video = video.split('url=')[1]; video = video.split('url=')[1];
@ -614,13 +627,17 @@ export const videoServersMonosChinos = async (id: string) => {
} }
if (video) { if (video) {
videoNames.forEach((value: string) => {
if (video.includes(value.toLowerCase())) {
videoServers.push({ videoServers.push({
id: `Op${counter++}`, id: value.toLowerCase(),
url: video, url: video,
direct: false, direct: false,
}); });
} }
}); });
}
});
if (videoServers.length > 0) { if (videoServers.length > 0) {
/* Set the key in the redis cache. */ /* Set the key in the redis cache. */

Loading…
Cancel
Save