diff --git a/lib/routes/jandan/index.ts b/lib/routes/jandan/index.ts index b3da07a82..892df4379 100644 --- a/lib/routes/jandan/index.ts +++ b/lib/routes/jandan/index.ts @@ -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 `${alt}`; + }); const single = { title: item.title, description: $('.entry').html(), diff --git a/lib/routes/jandan/section.ts b/lib/routes/jandan/section.ts index 3fa2ef623..6e9d82e10 100644 --- a/lib/routes/jandan/section.ts +++ b/lib/routes/jandan/section.ts @@ -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(``); + const url = new URL($(this).attr('href'), rootUrl); + url.protocol = 'https:'; + url.host = url.host.replace('moyu.im', 'sinaimg.cn'); + $(this).replaceWith(``); }); const author = item.find('b').first().text();