Merge pull request #6592 from laampui/cpu

fix: 中国药科大学
This commit is contained in:
NeverBehave
2021-01-10 01:30:23 -05:00
committed by GitHub
+3 -3
View File
@@ -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);
})