fix: ithome failure (#5727)

This commit is contained in:
Luyu Huang
2020-09-26 17:19:00 +01:00
committed by GitHub
parent 48a95c138f
commit 3d527390ae
+5 -6
View File
@@ -43,7 +43,7 @@ module.exports = async (ctx) => {
});
const $ = cheerio.load(response.data);
const list = $('div.wrap_left_top div.mf div.new-list-1 li[class!="top"] span.title a')
const list = $('#list > div.fl > ul > li > div > h2 > a')
.slice(0, 10)
.map((_, item) => {
item = $(item);
@@ -60,16 +60,15 @@ module.exports = async (ctx) => {
await ctx.cache.tryGet(item.link, async () => {
const res = await got({ method: 'get', url: item.link });
const content = cheerio.load(res.data);
const post = content('div#con div.content');
const paragraph = post.find('div#paragraph');
paragraph.find('img[data-original]').each((_, ele) => {
const post = content('#paragraph');
post.find('img[data-original]').each((_, ele) => {
ele = $(ele);
ele.attr('src', ele.attr('data-original'));
ele.removeAttr('class');
ele.removeAttr('data-original');
});
item.description = paragraph.html();
item.pubDate = new Date(post.find('span#pubtime_baidu').text() + ' GMT+8').toUTCString();
item.description = post.html();
item.pubDate = new Date(content('#pubtime_baidu').text() + ' GMT+8').toUTCString();
return item;
})
)