From ebdae3fc79e4d43b70dff9adef029ba87367cbb5 Mon Sep 17 00:00:00 2001 From: zhullyb Date: Sat, 2 Nov 2024 00:57:35 +0800 Subject: [PATCH] fix(route/zjut): filter out items that should not included --- lib/routes/zjut/www/index.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/routes/zjut/www/index.ts b/lib/routes/zjut/www/index.ts index 943f939e8d10d8..c9e7b1d2e52b1b 100644 --- a/lib/routes/zjut/www/index.ts +++ b/lib/routes/zjut/www/index.ts @@ -38,6 +38,7 @@ export const route: Route = { | 通知公告 | 4528 | | 美誉工大 | 5389 | | 智库工大 | 5390 | +| 工大校历 | 4520 | | 校区班车 | xqbc |`, }; @@ -60,7 +61,16 @@ async function handler(ctx) { } else if (!link.startsWith('http')) { link = rootUrl.slice(0, -1) + link; } - const pubDate = timezone(parseDate(cheerioItem.find('.news_meta').text()), +8); + const date_text = cheerioItem.find('.news_meta').text(); + if (!date_text) { + // This should not be included, return an empty item to filter out + return { + title: '', + link: '', + pubDate: Date.now(), + }; + } + const pubDate = timezone(parseDate(date_text), +8); return { title,