fix(route): gamme lazy load img
This commit is contained in:
parent
5ac511199d
commit
ab2765a9fa
|
|
@ -13,6 +13,13 @@ module.exports = async (ctx) => {
|
|||
const { data } = await got(item.link);
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
$('.entry img').each((_, img) => {
|
||||
if (img.attribs['data-original']) {
|
||||
img.attribs.src = img.attribs['data-original'];
|
||||
delete img.attribs['data-original'];
|
||||
}
|
||||
});
|
||||
|
||||
item.author = $('.author_name').text().trim();
|
||||
item.category = $('.tags a')
|
||||
.toArray()
|
||||
|
|
|
|||
|
|
@ -26,6 +26,13 @@ module.exports = async (ctx) => {
|
|||
const { data } = await got(item.link);
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
$('.entry img').each((_, img) => {
|
||||
if (img.attribs['data-original']) {
|
||||
img.attribs.src = img.attribs['data-original'];
|
||||
delete img.attribs['data-original'];
|
||||
}
|
||||
});
|
||||
|
||||
item.author = $('.author_name').text().trim();
|
||||
item.category = $('.tags a')
|
||||
.toArray()
|
||||
|
|
|
|||
Loading…
Reference in New Issue