diff --git a/lib/middleware/anti-hotlink.js b/lib/middleware/anti-hotlink.js index 9a216126a..82c56de4f 100644 --- a/lib/middleware/anti-hotlink.js +++ b/lib/middleware/anti-hotlink.js @@ -70,6 +70,7 @@ const process = (html, image_hotlink_template, multimedia_hotlink_template, wrap if (image_hotlink_template) { replaceUrls($, 'img, picture > source', image_hotlink_template); replaceUrls($, 'video[poster]', image_hotlink_template, 'poster'); + replaceUrls($, '*[data-rsshub-image="href"]', image_hotlink_template, 'href'); } if (multimedia_hotlink_template) { replaceUrls($, 'video, video > source, audio, audio > source', multimedia_hotlink_template); diff --git a/lib/v2/weibo/utils.js b/lib/v2/weibo/utils.js index 18d953847..aa9c8fc50 100644 --- a/lib/v2/weibo/utils.js +++ b/lib/v2/weibo/utils.js @@ -82,7 +82,10 @@ const weiboUtils = { htmlNewLineUnreplaced = htmlNewLineUnreplaced.replaceAll(/全文<\/a>/g, ''); // 处理外部链接 - htmlNewLineUnreplaced = htmlNewLineUnreplaced.replaceAll(/https:\/\/weibo\.cn\/sinaurl\/.*?&u=(http.*?")/g, (match, p1) => decodeURIComponent(p1)); + htmlNewLineUnreplaced = htmlNewLineUnreplaced.replaceAll(/"https:\/\/weibo\.cn\/sinaurl.*?[&?]u=(http.*?)"/g, (match, p1) => `"${decodeURIComponent(p1)}"`); + + // 处理图片的链接 + htmlNewLineUnreplaced = htmlNewLineUnreplaced.replaceAll(/ `${match} data-rsshub-image="href"`); let html = htmlNewLineUnreplaced.replaceAll('\n', '
');