fix(route): sehuatang append images in .pattl (#14055)

This commit is contained in:
Goren G
2023-12-17 23:24:51 +08:00
committed by GitHub
parent 027c16804f
commit bab09f9c4e
2 changed files with 21 additions and 24 deletions
+10 -12
View File
@@ -88,20 +88,18 @@ module.exports = async (ctx) => {
$(image).replaceWith($(`<img src="${file}">`));
}
}
// if postMessage does not have any images, try to parse image url from `.pattl`
if (images.length === 0) {
const pattl = $('.pattl');
const pattlImages = $(pattl).find('img');
for (const pattlImage of pattlImages) {
const file = $(pattlImage).attr('file');
if (!file || file === 'undefined') {
$(pattlImage).replaceWith('');
} else {
$(pattlImage).replaceWith($(`<img src="${file}" />`));
}
// also parse image url from `.pattl`
const pattl = $('.pattl');
const pattlImages = $(pattl).find('img');
for (const pattlImage of pattlImages) {
const file = $(pattlImage).attr('file');
if (!file || file === 'undefined') {
$(pattlImage).replaceWith('');
} else {
$(pattlImage).replaceWith($(`<img src="${file}" />`));
}
postMessage.append($(pattl));
}
postMessage.append($(pattl));
$('em[onclick]').remove();
info.description = (postMessage.html() || '抓取原帖失败').replace(/ignore_js_op/g, 'div');
+11 -12
View File
@@ -62,20 +62,19 @@ module.exports = async (ctx) => {
$(image).replaceWith($(`<img src="${file}">`));
}
}
// if postMessage does not have any images, try to parse image url from `.pattl`
if (images.length === 0) {
const pattl = $('.pattl');
const pattlImages = $(pattl).find('img');
for (const pattlImage of pattlImages) {
const file = $(pattlImage).attr('file');
if (!file || file === 'undefined') {
$(pattlImage).replaceWith('');
} else {
$(pattlImage).replaceWith($(`<img src="${file}" />`));
}
// also parse image url from `.pattl`
const pattl = $('.pattl');
const pattlImages = $(pattl).find('img');
for (const pattlImage of pattlImages) {
const file = $(pattlImage).attr('file');
if (!file || file === 'undefined') {
$(pattlImage).replaceWith('');
} else {
$(pattlImage).replaceWith($(`<img src="${file}" />`));
}
postMessage.append($(pattl));
}
postMessage.append($(pattl));
$('em[onclick]').remove();
info.description = (postMessage.html() || '抓取原帖失败').replace(/ignore_js_op/g, 'div');