fix(route): fetch rich HTML content on chinanews (#9798)

* fix(route): fetch rich HTML content on chinanews

* fix: remove ads
This commit is contained in:
WUGqnwvMQPzl 2022-05-21 22:34:25 +08:00 committed by GitHub
parent 2c4eab5e31
commit 662874849b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -28,19 +28,20 @@ module.exports = async (ctx) => {
url: item.link,
});
const content = cheerio.load(detailResponse.data);
content('.adInContent').remove();
if (content('div.content_desc').length > 0) {
item.description = content('div.content_desc').text();
item.description = content('div.content_desc').html();
item.author = content('a.source').text();
const info = content('p', '.left').text().trim().slice(5).split(' ');
item.author = info[2].trim();
item.pubDate = timezone(parseDate(info[0] + info[1], 'YYYY年MM月DD日HH:mm'), +8);
} else if (content('div.t3').length > 0) {
item.description = content('div.t3').text();
item.description = content('div.t3').html();
const info = content('div[style="text-align:right;font-size:12px;"]').text().slice(5).split(' ');
item.author = info[2];
item.pubDate = timezone(parseDate(info[0] + info[1], 'YYYY-MM-DDHH:mm'), +8);
} else {
item.description = content('div.left_zw').text();
item.description = content('div.left_zw').html();
const info = content('div.left-t')
.contents()
.filter(function () {