fix: 喷嚏 DOM 更新 (#5022)
This commit is contained in:
parent
4028de9a86
commit
0cf12554b0
|
|
@ -35,14 +35,24 @@ module.exports = {
|
|||
responseType: 'buffer',
|
||||
});
|
||||
const convert_data = iconv.decode(original_data.data, 'gbk');
|
||||
const detail_data = cheerio
|
||||
.load(convert_data, {
|
||||
decodeEntities: false,
|
||||
})('div[class="oblog_text"]')
|
||||
.html();
|
||||
const description = cheerio.load(convert_data, {
|
||||
decodeEntities: false,
|
||||
})('body > table > tbody > tr > td.oblog_t_2 > div > table > tbody > tr:nth-child(2) > td');
|
||||
description.find('table, .adsbygoogle').remove();
|
||||
|
||||
// remove header
|
||||
const count = subjectid.toString() === '70' ? 8 : 3;
|
||||
for (let index = 0; index < count; index++) {
|
||||
description.children().first().remove();
|
||||
}
|
||||
|
||||
// remove footer
|
||||
for (let index = 0; index < 8; index++) {
|
||||
description.children().last().remove();
|
||||
}
|
||||
const single = {
|
||||
title: el.text(),
|
||||
description: detail_data,
|
||||
description: description.html(),
|
||||
link: url,
|
||||
};
|
||||
return Promise.resolve(single);
|
||||
|
|
|
|||
Loading…
Reference in New Issue