fix: replace weibo a href img (#14354)
This commit is contained in:
parent
57f439b799
commit
670f6f3ca7
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -82,7 +82,10 @@ const weiboUtils = {
|
|||
htmlNewLineUnreplaced = htmlNewLineUnreplaced.replaceAll(/<a href="(.*?)">全文<\/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(/<a\s+href="https?:\/\/.+\.(jpg|png|gif)"/g, (match) => `${match} data-rsshub-image="href"`);
|
||||
|
||||
let html = htmlNewLineUnreplaced.replaceAll('\n', '<br>');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue