mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-16 02:42:57 +08:00
50 lines
1.3 KiB
JavaScript
50 lines
1.3 KiB
JavaScript
const axios = require('@/utils/axios');
|
|
const cheerio = require('cheerio');
|
|
|
|
module.exports = async (ctx) => {
|
|
const baseUrl = `https://houxu.app/events`;
|
|
const res = await axios.get(baseUrl);
|
|
const $ = cheerio.load(res.data);
|
|
|
|
const list = $('div.list > div');
|
|
const descriptionSelector = '.summary';
|
|
const out = list
|
|
.map((_, el) => {
|
|
const each = $(el);
|
|
return {
|
|
title:
|
|
each
|
|
.find('a')
|
|
.first()
|
|
.text()
|
|
.trim() +
|
|
' | ' +
|
|
each
|
|
.find('h3')
|
|
.text()
|
|
.trim(),
|
|
description: each
|
|
.find(descriptionSelector)
|
|
.text()
|
|
.trim(),
|
|
link:
|
|
'https://houxu.app' +
|
|
each
|
|
.find('a')
|
|
.first()
|
|
.attr('href'),
|
|
};
|
|
})
|
|
.get();
|
|
ctx.state.data = {
|
|
title: $('title')
|
|
.text()
|
|
.trim(),
|
|
description: $('title')
|
|
.text()
|
|
.trim(),
|
|
link: baseUrl,
|
|
item: out,
|
|
};
|
|
};
|