Compare commits
No commits in common. '1ff2d3ae11c3bd938ff2c0c81c7784743188a34c' and '837a432dbe711fef45dc3418b80d9a96d1009aba' have entirely different histories.
1ff2d3ae11
...
837a432dbe
@ -1,3 +1,2 @@
|
|||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
.prettierignore
|
|
@ -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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue