mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-01 14:57:14 +08:00
refactor: replace moyu.im to original sina link (#14874)
This commit is contained in:
@@ -20,6 +20,12 @@ async function handler() {
|
||||
const response = await got(item.link);
|
||||
const $ = load(response.data);
|
||||
$('.wechat-hide').prev().nextAll().remove();
|
||||
$('img').replaceWith((i, e) => {
|
||||
const src = $(e).attr('src');
|
||||
const alt = $(e).attr('alt');
|
||||
const newSrc = src?.replace(/https?:\/\/(\w+)\.moyu\.im/, 'https://$1.sinaimg.cn');
|
||||
return `<img src="${newSrc}" alt="${alt}">`;
|
||||
});
|
||||
const single = {
|
||||
title: item.title,
|
||||
description: $('.entry').html(),
|
||||
|
||||
@@ -33,7 +33,10 @@ async function handler(ctx) {
|
||||
item.find('.commenttext img, .tucao-report').remove();
|
||||
|
||||
item.find('.commenttext .view_img_link').each(function () {
|
||||
$(this).replaceWith(`<img src="${$(this).attr('href')}">`);
|
||||
const url = new URL($(this).attr('href'), rootUrl);
|
||||
url.protocol = 'https:';
|
||||
url.host = url.host.replace('moyu.im', 'sinaimg.cn');
|
||||
$(this).replaceWith(`<img src="${url}">`);
|
||||
});
|
||||
|
||||
const author = item.find('b').first().text();
|
||||
|
||||
Reference in New Issue
Block a user