|
|
@ -1,20 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
import { parse } from 'node-html-parser';
|
|
|
|
import { parse } from 'node-html-parser';
|
|
|
|
import { attr, api } from '../config.js';
|
|
|
|
import { attr, api, get } from '../config.js';
|
|
|
|
import axios from 'axios';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export async function getCalendar(req, res) {
|
|
|
|
export async function getCalendar(req, res) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const { data } = await axios.get(api.calendar);
|
|
|
|
const { data } = await 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
|
|
|
|
animes: i.querySelectorAll('.col-md-6.col-lg-4.col-sm-12.for768').map((i) => {
|
|
|
|
.querySelectorAll('.col-md-6.col-lg-4.col-sm-12.for768')
|
|
|
|
|
|
|
|
.map((i) => {
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
id: attr(i, 'a', 'href').split('/').pop() || null,
|
|
|
|
id: attr(i, 'a', 'href').split('/').pop() || null,
|
|
|
|
title: i.querySelector('.serisdtls a h3').text.trim() || null,
|
|
|
|
title: i.querySelector('.serisdtls a h3').text.trim() || null,
|
|
|
@ -23,7 +19,7 @@ export async function getCalendar(req, res) {
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
})
|
|
|
|
)
|
|
|
|
);
|
|
|
|
} catch (error) {
|
|
|
|
} catch (error) {
|
|
|
|
res.status(500).json({ message: error.message });
|
|
|
|
res.status(500).json({ message: error.message });
|
|
|
|
}
|
|
|
|
}
|
|
|
|