@@ -15,13 +15,13 @@ module.exports = async (ctx) => {
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
const $list = $('div#wp_news_w3 a').slice(0, 10).get();
|
||||
const $list = $('div#wp_news_w3 a').get();
|
||||
|
||||
const resultItem = await Promise.all(
|
||||
$list.map(async (item) => {
|
||||
const title = $(item).attr('title');
|
||||
const href = $(item).attr('href');
|
||||
const detail_url = 'http://www.cpu.edu.cn' + href;
|
||||
const detail_url = href.startsWith('/') ? `http://www.cpu.edu.cn${href}` : href;
|
||||
const single = {
|
||||
title: title,
|
||||
link: detail_url,
|
||||
@@ -37,7 +37,7 @@ module.exports = async (ctx) => {
|
||||
{
|
||||
const detail_data = detail.data;
|
||||
const $ = cheerio.load(detail_data);
|
||||
single.description = $('table[bgcolor="#FFFFFF"]').html();
|
||||
single.description = $('table[bgcolor="#FFFFFF"]').html() || $('table.nyxx').html() || $('div.inner div.article').html();
|
||||
}
|
||||
return Promise.resolve(single);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user