parent
f8990b7cb7
commit
0abd80a9a7
|
|
@ -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'),
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue