diff --git a/lib/routes/dapenti/utils.js b/lib/routes/dapenti/utils.js index 83d2c2ad4a..b1d5a81fb4 100644 --- a/lib/routes/dapenti/utils.js +++ b/lib/routes/dapenti/utils.js @@ -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);