fix: govall some link 404 (#2894)
* fix: govall some link 404 * fix: eslint warning
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user