fix(route): 木木博客 (#11361)
This commit is contained in:
@@ -4,12 +4,12 @@ const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
const processList = (res) => {
|
||||
const $ = cheerio.load(res.data);
|
||||
const list = $('div.posts-wrapper > div.col-lg-12')
|
||||
const list = $('div.archive.container > div.row > div > div > div.row.posts-wrapper.scroll > div')
|
||||
.map((_, item) => ({
|
||||
title: $(item).find('h2.entry-title').text(),
|
||||
link: $(item).find('h2.entry-title > a').attr('href'),
|
||||
pubDate: parseDate($(item).find('time').attr('datetime')),
|
||||
author: $(item).find('span.meta-author > a').attr('title'),
|
||||
author: '60秒读懂世界',
|
||||
}))
|
||||
.get();
|
||||
|
||||
@@ -22,8 +22,11 @@ const processItems = async (list, ctx) => {
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got(item.link);
|
||||
const $ = cheerio.load(detailResponse.data);
|
||||
|
||||
item.description = $('div.entry-wrapper').html();
|
||||
const fullContent = $('div > div.entry-wrapper > div.entry-content');
|
||||
fullContent.find('img').remove();
|
||||
fullContent.find('div.pt-0').remove();
|
||||
fullContent.find('div.post-note').remove();
|
||||
item.description = fullContent.html();
|
||||
|
||||
return item;
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user