Merge pull request #39 from aruppi/develop

Feature/upgrading monoschinos
pull/49/head
Jesús María 4 years ago committed by GitHub
commit d64e2df268
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,6 +2,7 @@ import { NextFunction, Request, Response } from 'express';
import { requestGot } from '../utils/requestCall'; import { requestGot } from '../utils/requestCall';
import { import {
animeFlvInfo, animeFlvInfo,
imageUrlToBase64,
jkanimeInfo, jkanimeInfo,
monoschinosInfo, monoschinosInfo,
videoServersJK, videoServersJK,
@ -241,8 +242,10 @@ export default class AnimeController {
} }
async getLastEpisodes(req: Request, res: Response, next: NextFunction) { async getLastEpisodes(req: Request, res: Response, next: NextFunction) {
let data: any; // let data: any;
let $: cheerio.Root;
let episodes: Episode[] = []; let episodes: Episode[] = [];
let animeList: any[] = [];
try { try {
const resultQueryRedis: any = await redisClient.get( const resultQueryRedis: any = await redisClient.get(
@ -254,28 +257,75 @@ export default class AnimeController {
return res.status(200).json(resultRedis); return res.status(200).json(resultRedis);
} else { } else {
data = await requestGot( // @ANIMEFLV
`${urls.BASE_ANIMEFLV_JELU}LatestEpisodesAdded`, // data = await requestGot(
{ // `${urls.BASE_ANIMEFLV_JELU}LatestEpisodesAdded`,
parse: true, // {
scrapy: false, // parse: true,
}, // scrapy: false,
); // },
// );
$ = await requestGot(`${urls.BASE_MONOSCHINOS}`, {
scrapy: true,
parse: false,
});
} }
} catch (err) { } catch (err) {
return next(err); return next(err);
} }
// @ANIMEFLV
// for (const episode of data.episodes) {
// const formattedEpisode: Episode = {
// id: '12345/' + episode.id,
// title: episode.title,
// image: episode.poster,
// episode: episode.episode,
// servers: await transformUrlServer(episode.servers),
// };
// episodes.push(formattedEpisode);
// }
let getLastest: any = $('.container .caps .container')[0];
$(getLastest)
.find('.row article')
.each((index: number, element: cheerio.Element) => {
let el: cheerio.Cheerio = $(element);
let title: string | undefined = el
.find('.Title')
.html()
?.split('\t')[0];
let img: any = el.find('.Image img').attr('src');
let type: any = el.find('.Image figure span').text();
type = type.substring(1, type.length);
let nEpisode: any = el.find('.dataEpi .episode').text();
nEpisode = parseInt(nEpisode.split('\n')[1]);
let id: any = el.find('a').attr('href');
id = id.split('/')[4];
id = id.split('-');
id.splice(id.length - 2, 2);
id = `${id.join('-')}-episodio-${nEpisode}`;
let anime = {
id: `ver/${id}`,
title,
image: img,
episode: nEpisode,
};
for (const episode of data.episodes) { animeList.push(anime);
const formattedEpisode: Episode = { });
id: '12345/' + episode.id,
title: episode.title,
image: episode.poster,
episode: episode.episode,
servers: await transformUrlServer(episode.servers),
};
episodes.push(formattedEpisode); for (const anime of animeList) {
episodes.push({
id: anime.id,
title: anime.title,
image: await imageUrlToBase64(anime.image),
episode: anime.episode,
servers: await videoServersMonosChinos(anime.id),
});
} }
if (episodes.length > 0) { if (episodes.length > 0) {

@ -140,11 +140,6 @@ export default class UtilsController {
const news: News[] = []; const news: News[] = [];
const pagesRss: rssPage[] = [ const pagesRss: rssPage[] = [
{ url: urls.BASE_KUDASAI, author: 'Kudasai', content: 'content_encoded' }, { url: urls.BASE_KUDASAI, author: 'Kudasai', content: 'content_encoded' },
{
url: urls.BASE_PALOMITRON,
author: 'Palomitron',
content: 'description',
},
{ {
url: urls.BASE_RAMENPARADOS, url: urls.BASE_RAMENPARADOS,
author: 'Ramen para dos', author: 'Ramen para dos',

@ -11,7 +11,7 @@ interface Options {
export const requestGot = async ( export const requestGot = async (
url: string, url: string,
options: Options, options?: Options,
): Promise<any> => { ): Promise<any> => {
if (options !== undefined) { if (options !== undefined) {
if (options.scrapy) { if (options.scrapy) {

@ -9,7 +9,6 @@ export default {
BASE_IVOOX: BASE_IVOOX:
'https://www.ivoox.com/podcast-anitakume_fg_f1660716_filtro_1.xml', 'https://www.ivoox.com/podcast-anitakume_fg_f1660716_filtro_1.xml',
BASE_KUDASAI: 'https://somoskudasai.com/feed/', BASE_KUDASAI: 'https://somoskudasai.com/feed/',
BASE_PALOMITRON: 'https://elpalomitron.com/category/animemanga/feed/',
BASE_RAMENPARADOS: 'https://ramenparados.com/category/noticias/anime/feed/', BASE_RAMENPARADOS: 'https://ramenparados.com/category/noticias/anime/feed/',
BASE_CRUNCHYROLL: 'https://www.crunchyroll.com/newsrss?lang=esES', BASE_CRUNCHYROLL: 'https://www.crunchyroll.com/newsrss?lang=esES',
JKANIME_SEARCH: 'https://jkanime.net/buscar/', JKANIME_SEARCH: 'https://jkanime.net/buscar/',

@ -597,7 +597,6 @@ export const monoschinosInfo = async (id: string | undefined) => {
export const videoServersMonosChinos = async (id: string) => { export const videoServersMonosChinos = async (id: string) => {
let $: cheerio.Root; let $: cheerio.Root;
let videoServers: any[] = []; let videoServers: any[] = [];
let nameServers: any[] = [];
try { try {
const resultQueryRedis: any = await redisClient.get( const resultQueryRedis: any = await redisClient.get(
@ -872,6 +871,11 @@ export function getThemes(themes: any[]) {
})); }));
} }
export const imageUrlToBase64 = async (url: string) => {
let img: any = await requestGot(url);
return img.rawBody.toString('base64');
};
export function hashStringMd5(string: string) { export function hashStringMd5(string: string) {
return crypto.createHash('md5').update(string).digest('hex'); return crypto.createHash('md5').update(string).digest('hex');
} }

Loading…
Cancel
Save