fix(route): handle error when fetching sjtu/jwc article (#16448)

This commit is contained in:
PangBo 2024-08-14 23:31:13 +08:00 committed by GitHub
parent 9c24b9d20d
commit a42d44f834
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -7,7 +7,10 @@ import { parseDate } from '@/utils/parse-date';
const urlRoot = 'https://jwc.sjtu.edu.cn/xwtg';
async function getFullArticle(link) {
const response = await got(link);
const response = await got(link).catch(() => null);
if (!response) {
return null;
}
const $ = load(response.body);
const content = $('.content-con');
if (content.length === 0) {