mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-07 05:36:08 +08:00
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
const got = require('@/utils/got');
|
|
const cheerio = require('cheerio');
|
|
|
|
module.exports = async (ctx) => {
|
|
const { id } = ctx.params;
|
|
const url = `https://qnmlgb.tech/authors/${id}`;
|
|
|
|
const response = await got({
|
|
method: 'get',
|
|
url,
|
|
});
|
|
|
|
const $ = cheerio.load(response.data);
|
|
const list = $('.ae');
|
|
|
|
ctx.state.data = {
|
|
title: `${$('#spider > div:nth-child(1) > div:nth-child(1)')
|
|
.text()
|
|
.trim()}微信公众号`,
|
|
link: url,
|
|
description: $('#spider > div:nth-child(2)')
|
|
.text()
|
|
.trim(),
|
|
item:
|
|
list &&
|
|
list
|
|
.map((i, ele) => {
|
|
const $ = cheerio.load(ele);
|
|
const link = $('a').attr('href');
|
|
|
|
return {
|
|
title: $('.pretty')
|
|
.text()
|
|
.trim(),
|
|
link: `https://q.qnmlgb.tech/w/api${link}`,
|
|
guid: `https://q.qnmlgb.tech/w/api${link}`,
|
|
};
|
|
})
|
|
.get(),
|
|
};
|
|
};
|