|
|
@ -1,13 +1,13 @@
|
|
|
|
import axios from 'axios';
|
|
|
|
import { attr, api, get } from '../config.js';
|
|
|
|
import { attr, api } from '../config.js';
|
|
|
|
|
|
|
|
import { parse } from 'node-html-parser';
|
|
|
|
import { parse } from 'node-html-parser';
|
|
|
|
|
|
|
|
|
|
|
|
export async function getEpisode(req, res) {
|
|
|
|
export async function getEpisode(req, res) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const { id } = req.params;
|
|
|
|
const { id } = req.params;
|
|
|
|
const { data } = await axios.get(api.episode(id));
|
|
|
|
const { data } = await get(api.episode(id));
|
|
|
|
const html = parse(data);
|
|
|
|
const html = parse(data);
|
|
|
|
const ctrls = html.querySelectorAll('.controldiv2 a');
|
|
|
|
const ctrls = html.querySelectorAll('.controldiv2 a');
|
|
|
|
|
|
|
|
|
|
|
|
let nav = {};
|
|
|
|
let nav = {};
|
|
|
|
let mapc = ctrls.map((e, i) => {
|
|
|
|
let mapc = ctrls.map((e, i) => {
|
|
|
|
let elem = e.querySelector('img').classList;
|
|
|
|
let elem = e.querySelector('img').classList;
|
|
|
@ -33,7 +33,7 @@ export async function getEpisode(req, res) {
|
|
|
|
title: html.querySelector('.heromain_h1').text.replace(/Sub\sEspañol/gi, ''),
|
|
|
|
title: html.querySelector('.heromain_h1').text.replace(/Sub\sEspañol/gi, ''),
|
|
|
|
nextEpisodes: nextEpisodes.length == 0 ? null : nextEpisodes,
|
|
|
|
nextEpisodes: nextEpisodes.length == 0 ? null : nextEpisodes,
|
|
|
|
ctrs: nav,
|
|
|
|
ctrs: nav,
|
|
|
|
sugestions: html.querySelectorAll('.nextplay:nth-child(2) .nextplays a').map((i) => {
|
|
|
|
sugestions: html.querySelectorAll('.nextplay:nth-child(3) .nextplays a').map((i) => {
|
|
|
|
const image = attr(i, '.nxtmainimg', 'src');
|
|
|
|
const image = attr(i, '.nxtmainimg', 'src');
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
image: image.length == 0 || !image ? imgNotFound : image,
|
|
|
|
image: image.length == 0 || !image ? imgNotFound : image,
|
|
|
@ -63,4 +63,3 @@ export async function getEpisode(req, res) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|