Compare commits

..

No commits in common. '1ff2d3ae11c3bd938ff2c0c81c7784743188a34c' and '837a432dbe711fef45dc3418b80d9a96d1009aba' have entirely different histories.

3
.gitignore vendored

@ -1,3 +1,2 @@
node_modules node_modules
dist dist
.prettierignore

@ -1,10 +1,3 @@
import axios from 'axios';
export const maskScrapingHeaders = {
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36',
};
const url = 'https://monoschinos2.com'; const url = 'https://monoschinos2.com';
export const api = { export const api = {
@ -22,7 +15,3 @@ export const api = {
export function attr(html, selector, attribute = 'src') { export function attr(html, selector, attribute = 'src') {
return html.querySelector(selector)?.attributes[attribute]; return html.querySelector(selector)?.attributes[attribute];
} }
export function get(url) {
return axios.get(url, { headers: { ...maskScrapingHeaders } });
}

@ -1,10 +1,12 @@
import { parse } from 'node-html-parser'; import { parse } from 'node-html-parser';
import { attr, api, get } from '../config.js'; import axios from 'axios';
import { attr, api } from '../config.js';
export async function getAnimes(req, res) { export async function getAnimes(req, res) {
try { try {
let { page = '1' } = req.params; let { page = '1' } = req.params;
const { data } = await get(`${api.all(page)}`); const { data } = await axios.get(`${api.all(page)}`);
const html = parse(data); const html = parse(data);
res.status(200).json( res.status(200).json(
html.querySelectorAll('.heromain .row .col-md-4.col-lg-2.col-6').map((i) => { html.querySelectorAll('.heromain .row .col-md-4.col-lg-2.col-6').map((i) => {
@ -21,3 +23,4 @@ export async function getAnimes(req, res) {
}); });
} }
} }

@ -1,11 +1,12 @@
import { attr, api, get } from '../config.js'; import axios from 'axios';
import { attr, api } from '../config.js';
import { parse } from 'node-html-parser'; import { parse } from 'node-html-parser';
export async function getAnime(req, res) { export async function getAnime(req, res) {
try { try {
const url = 'https://monoschinos2.com/'; const url = 'https://monoschinos2.com/';
const { id } = req.params; const { id } = req.params;
const { data } = await get(api.anime(id)); const { data } = await axios.get(api.anime(id));
const html = parse(data); const html = parse(data);
const date = html.querySelectorAll('.breadcrumb')[1].querySelector('.breadcrumb-item').text; const date = html.querySelectorAll('.breadcrumb')[1].querySelector('.breadcrumb-item').text;
res.status(200).json({ res.status(200).json({

@ -1,26 +1,30 @@
import { parse } from 'node-html-parser'; import { parse } from 'node-html-parser';
import { attr, api, get } from '../config.js'; import { attr, api } from '../config.js';
import axios from 'axios';
export async function getCalendar(req, res) { export async function getCalendar(req, res) {
try { try {
const { data } = await get(api.calendar); const { data } = await axios.get(api.calendar);
const html = parse(data); const html = parse(data);
res.status(200).json( res.status(200).json(
html.querySelectorAll('.heromain [data-dia]').map((i) => { html.querySelectorAll('.heromain [data-dia]').map((i) => {
const day = i.getAttribute('data-dia'); const day = i.getAttribute('data-dia');
return { return {
day, day,
animes: i.querySelectorAll('.col-md-6.col-lg-4.col-sm-12.for768').map((i) => { animes: i
return { .querySelectorAll('.col-md-6.col-lg-4.col-sm-12.for768')
id: attr(i, 'a', 'href').split('/').pop() || null, .map((i) => {
title: i.querySelector('.serisdtls a h3').text.trim() || null, return {
image: attr(i, '.seriesimg a img') || null, id: attr(i, 'a', 'href').split('/').pop() || null,
}; title: i.querySelector('.serisdtls a h3').text.trim() || null,
}), image: attr(i, '.seriesimg a img') || null,
};
}),
}; };
}) })
); )
} catch (error) { } catch (error) {
res.status(500).json({ message: error.message }); res.status(500).json({ message: error.message });
} }
} }

@ -1,10 +1,11 @@
import { attr, api, get } from '../config.js'; import axios from 'axios';
import { attr, api } from '../config.js';
import { parse } from 'node-html-parser'; import { parse } from 'node-html-parser';
export async function getEmision(req, res) { export async function getEmision(req, res) {
try { try {
let { page = '1' } = req.query; let { page = '1' } = req.query;
const { data } = await get(api.emision(page)); const { data } = await axios.get(api.emision(page));
const html = parse(data); const html = parse(data);
res.status(200).json( res.status(200).json(
html.querySelectorAll('.heromain .row .col-md-4.col-lg-2.col-6').map((i) => { html.querySelectorAll('.heromain .row .col-md-4.col-lg-2.col-6').map((i) => {
@ -14,7 +15,7 @@ export async function getEmision(req, res) {
image: attr(i, '.animemainimg') || null, image: attr(i, '.animemainimg') || null,
}; };
}) })
); )
} catch (error) { } catch (error) {
res.status(500).json({ message: error.message }); res.status(500).json({ message: error.message });
} }

@ -1,13 +1,13 @@
import { attr, api, get } from '../config.js'; import axios from 'axios';
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 get(api.episode(id)); const { data } = await axios.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(3) .nextplays a').map((i) => { sugestions: html.querySelectorAll('.nextplay:nth-child(2) .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,3 +63,4 @@ export async function getEpisode(req, res) {
}); });
} }
} }

@ -1,5 +1,6 @@
import axios from 'axios';
import { parse } from 'node-html-parser'; import { parse } from 'node-html-parser';
import { api, attr, get } from '../config.js'; import { api, attr } from '../config.js';
export async function filterBy(req, res) { export async function filterBy(req, res) {
try { try {
@ -10,7 +11,7 @@ export async function filterBy(req, res) {
letra = 'false', letra = 'false',
pagina = '1', pagina = '1',
} = req.query; } = req.query;
const { data } = await get(`${api.filter({ categoria, fecha, genero, letra, pagina })}`); const { data } = await axios.get(`${api.filter({ categoria, fecha, genero, letra, pagina })}`);
const html = parse(data); const html = parse(data);
res.status(200).json( res.status(200).json(
html.querySelectorAll('.heromain .row .col-md-4.col-lg-2.col-6').map((i) => { html.querySelectorAll('.heromain .row .col-md-4.col-lg-2.col-6').map((i) => {

@ -1,21 +1,24 @@
import { attr, api, get } from '../config.js'; import axios from 'axios';
import { attr, api } from '../config.js';
import { parse } from 'node-html-parser'; import { parse } from 'node-html-parser';
export async function getLastest(req, res) { export async function getLastest(req, res) {
try { try {
const { data } = await get(api.home); const { data } = await axios.get(api.home);
const html = parse(data); const html = parse(data);
res.json( res.json(
html.querySelectorAll('.row.row-cols-5 .col.col-md-6.col-lg-2.col-6').map((i) => { html
const id = attr(i, 'a', 'href').split('/').pop(); .querySelectorAll('.row.row-cols-5 .col.col-md-6.col-lg-2.col-6')
return { .map((i) => {
id: id || null, const id = attr(i, 'a', 'href').split('/').pop();
title: i.querySelector('.animetitles')?.text || null, return {
image: attr(i, '.animeimgdiv img', 'data-src') || null, id: id || null,
type: i.querySelector('.positioning button').text.trim() || null, title: i.querySelector('.animetitles')?.text || null,
no: parseInt(i.querySelector('.positioning h5').text.trim() || '0') || null, image: attr(i, '.animeimghv', 'data-src') || null,
}; type: i.querySelector('.positioning button').text.trim() || null,
}) no: parseInt(i.querySelector('.positioning h5').text.trim() || '0') || null,
};
})
); );
} catch (error) { } catch (error) {
res.status(500).json({ message: error.message }); res.status(500).json({ message: error.message });

@ -1,11 +1,12 @@
import axios from 'axios';
import { parse } from 'node-html-parser'; import { parse } from 'node-html-parser';
import { api, attr, get } from '../config.js'; import { api, attr } from '../config.js';
export async function searchAnime(req, res) { export async function searchAnime(req, res) {
try { try {
let { id } = req.params; let { id } = req.params;
let { page = '1' } = req.query; let { page = '1' } = req.query;
const { data } = await get(api.search(id, page)); const { data } = await axios.get(api.search(id, page));
const html = parse(data); const html = parse(data);
res.json( res.json(
html.querySelectorAll('.heromain .row .col-md-4.col-lg-2.col-6').map((i) => { html.querySelectorAll('.heromain .row .col-md-4.col-lg-2.col-6').map((i) => {

Loading…
Cancel
Save