fix: 修复懂球帝部分路由图片加载的bug

This commit is contained in:
Henry
2022-04-30 20:57:13 +01:00
parent c4ca3e4ee9
commit d5e1217498
+19 -25
View File
@@ -84,39 +84,33 @@ const ProcessFeed = async (ctx, link, type) => {
} else if (type === 'player') {
name = data.playerDetail.base_info.person_name;
}
const proList = [];
const out = await Promise.all(
list.map((item) => {
const url = item.share.replace('www', 'm').replace('articles', 'article');
return ctx.cache.tryGet(url, async () => {
const res = await got_ins.get(url);
const title = item.title;
const link = `https://www.dongqiudi.com/news/${item.id}.html`;
const $ = cheerio.load(res.data);
return ctx.cache.tryGet(link, () =>
ctx.cache.tryGet(link, () => {
const single = {
title,
link,
};
const author = $('body > header a').text();
const content = $('article');
ProcessVideo($);
ProcessImg($('.data-gif-src'));
ProcessImg($('img'));
ProcessHref(content.find('a'));
const single = {
title: item.title,
guid: item.id,
link: `https://www.dongqiudi.com/news/${item.id}.html`,
description: content.html(),
pubDate: parseDate(item.show_time * 1000),
author,
};
return single;
});
const es = got(link);
proList.push(es);
return single;
})
);
})
);
const responses = await got.all(proList);
for (let i = 0; i < proList.length; i++) {
ProcessFeedType2(out[i], responses[i].data);
}
ctx.state.data = {
title: `${name} - 相关新闻`,
link,