Skip to content

Commit

Permalink
fix(route): handle error when fetching sjtu/jwc article (#16448)
Browse files Browse the repository at this point in the history
  • Loading branch information
pangbo13 authored Aug 14, 2024
1 parent 9c24b9d commit a42d44f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/routes/sjtu/jwc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a42d44f

Please sign in to comment.