fix(route): tidy sis001 articles (#16619)

This commit is contained in:
Keo
2024-09-04 22:08:13 +08:00
committed by GitHub
parent 93f954f6ae
commit 7ea65c2509
2 changed files with 10 additions and 3 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ async function handler(ctx) {
const response = await got(url);
const $ = load(response.data);
const username = $('div.username').text();
const username = $('div.bg div.title').text().replace('的个人空间', '');
let items = $('div.center_subject ul li a[href^=thread]')
.toArray()
+9 -2
View File
@@ -22,8 +22,15 @@ async function getThread(item) {
),
8
);
$('div[id^=postmessage_] table, fieldset, .posttags, strong').remove();
item.description = $('div[id^=postmessage_]').eq(0).remove('strong').html() + ($('.defaultpost .postattachlist').html() ?? '');
$('div[id^=postmessage_] table, fieldset, .posttags, strong font').remove();
item.description =
$('div[id^=postmessage_]')
.eq(0)
.html()
?.replaceAll('\n', '')
.replaceAll(/\u3000{2}.+?(((?:<br>){2})|(&nbsp;))/g, (str) => `<p>${str.replaceAll('<br>', '')}</p>`)
.replaceAll('&nbsp;', '')
.replace(/^.+?((?:作者)|(?:<p>))/, '$1') + ($('.defaultpost .postattachlist').html() ?? '');
return item;
}