fix: lazy-load images cannot be displayed in 三界异次元 (#3535)
This commit is contained in:
parent
dda1b6b5e7
commit
7b96a4579c
|
|
@ -233,7 +233,7 @@ pageClass: routes
|
|||
|
||||
### 三界异次元
|
||||
|
||||
<Route author="luyuhuang" example="/3ycy/home" path="/3ycy/home"/>
|
||||
<Route author="luyuhuang" example="/3ycy/home" path="/3ycy/home" radar="1"/>
|
||||
|
||||
## 鼠绘漫画
|
||||
|
||||
|
|
|
|||
|
|
@ -33,12 +33,21 @@ module.exports = async (ctx) => {
|
|||
|
||||
const res = await got({ method: 'get', url: url.resolve(root_url, link) });
|
||||
const content = cheerio.load(res.data);
|
||||
const post = content('div.postBody');
|
||||
post.find('img[data-src]').each((_, ele) => {
|
||||
ele = content(ele);
|
||||
ele.attr('src', ele.attr('data-src'));
|
||||
ele.attr('alt', title.text());
|
||||
ele.attr('title', title.text());
|
||||
ele.removeAttr('class');
|
||||
ele.removeAttr('data-src');
|
||||
});
|
||||
|
||||
return {
|
||||
title: title.text(),
|
||||
link: link,
|
||||
pubDate: pubDate,
|
||||
description: content('div.postBody').html(),
|
||||
description: post.html(),
|
||||
};
|
||||
});
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue