Skip to content

Commit

Permalink
fix(route/zjut): filter out items that should not included
Browse files Browse the repository at this point in the history
  • Loading branch information
zhullyb committed Nov 1, 2024
1 parent 0a42f88 commit ebdae3f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/routes/zjut/www/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const route: Route = {
| 通知公告 | 4528 |
| 美誉工大 | 5389 |
| 智库工大 | 5390 |
| 工大校历 | 4520 |
| 校区班车 | xqbc |`,
};

Expand All @@ -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,
Expand Down

0 comments on commit ebdae3f

Please sign in to comment.