fix: 修复重庆大学校团委某些通知正文或附件缺失 (#4834)
This commit is contained in:
parent
7bc34d27de
commit
d56fd7c597
|
|
@ -14,9 +14,8 @@ module.exports = async (ctx) => {
|
|||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
const links = $('div[class=nwes_list]')
|
||||
.find('ul[style]') // nwes_list 原文如此
|
||||
.find('a[target=_blank]')
|
||||
const links = $('div[class=nwes_list]') // nwes_list 原文如此
|
||||
.find('a[target=_blank]', 'ul[style]')
|
||||
.map((index, item) => ({
|
||||
title: item.attribs.title,
|
||||
link: baseUrl + item.attribs.href,
|
||||
|
|
@ -45,7 +44,9 @@ module.exports = async (ctx) => {
|
|||
if (authorText && authorText.slice(0, 4) === '拟稿人:') {
|
||||
item.author = authorText.slice(4);
|
||||
}
|
||||
item.description = newsContent.find('div[class=v_news_content]').find('div').text();
|
||||
const newsText = newsContent.find('div[class=v_news_content]');
|
||||
const attedText = newsText.parent().nextAll().filter('ul[style="list-style-type:none;"]');
|
||||
item.description = newsText.html() + (newsContent.html(attedText).html() || '');
|
||||
|
||||
ctx.cache.set(item.link, JSON.stringify(item));
|
||||
return Promise.resolve(item);
|
||||
|
|
|
|||
Loading…
Reference in New Issue