Files
RSSHub/lib/routes/tencent/wechat/wasi.js
2019-06-03 18:03:05 +08:00

38 lines
1.0 KiB
JavaScript

const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const id = ctx.params.id;
const response = await got({
method: 'get',
url: `https://wx.qnmlgb.tech/authors/${id}`,
});
const $ = cheerio.load(response.data);
const list = $('.ae');
ctx.state.data = {
title: `${$('#spider > div:nth-child(1) > div:nth-child(1)')
.text()
.trim()}微信公众号`,
link: `https://w.qnmlgb.tech/authors/${id}/`,
description: $('#spider > div:nth-child(2)')
.text()
.trim(),
item:
list &&
list
.map((i, ele) => {
const $ = cheerio.load(ele);
return {
title: $('.pretty')
.text()
.trim(),
link: $('a').attr('href'),
};
})
.get(),
};
};