fix: govall some link 404 (#2894)

* fix: govall some link 404

* fix: eslint warning
This commit is contained in:
Cloud
2019-08-21 11:44:45 +08:00
committed by DIYgod
parent 6a0a49213d
commit 6084a20401
+8 -3
View File
@@ -36,9 +36,14 @@ module.exports = async (ctx) => {
if (value) {
description = value;
} else {
const contentData = await got.get(href);
const $content = cheerio.load(contentData.data);
description = $content('#UCAP-CONTENT').html();
try {
const contentData = await got.get(href);
const $content = cheerio.load(contentData.data);
description = $content('#UCAP-CONTENT').html();
} catch (error) {
description = '文章已被删除';
}
ctx.cache.set(key, description);
}