fix 后续app route (#1705)

随着页面元素的更新而更新
This commit is contained in:
ciaran 2019-03-11 10:47:49 +08:00 committed by DIYgod
parent f8990b7cb7
commit 0abd80a9a7
1 changed files with 7 additions and 19 deletions

View File

@ -7,34 +7,22 @@ module.exports = async (ctx) => {
const res = await axios.get(baseUrl);
const $ = cheerio.load(res.data);
const list = $('div.list > div');
const list = $('div.container > div');
const out = list
.map((_, el) => {
const each = $(el);
const p = each.find('p');
return {
title:
each
.find('cite')
.text()
.trim() +
' | ' +
each
.find('a')
.first()
.text()
.trim(),
description: each
.find('p > a')
.contents()
.filter(function() {
return this.nodeType === 3;
})
title: each
.find('h3')
.text()
.trim(),
description: p.html() + p.next().html(),
link:
'https://houxu.app' +
each
.find('a')
.find('h3 > a')
.first()
.attr('href'),
};