Skip to content

Commit

Permalink
Update news.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
dzx-dzx authored Nov 24, 2024
1 parent 10aefd7 commit ee37353
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/routes/kcna/news.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ async function handler(ctx) {
.map((_, item) => {
item = $(item);
const dateElem = item.find('.publish-time');
const dateString = dateElem.text();
const dateString = dateElem.text().match(/\d+\.\d+\.\d+/);
dateElem.remove();
return {
title: item.text(),
link: rootUrl + item.attr('href'),
pubDate: timezone(parseDate(dateString.match(/\d+\.\d+\.\d+/)[0]), +9),
pubDate: timezone(parseDate(dateString[0]), +9),
};
})
.get();
Expand All @@ -89,9 +89,9 @@ async function handler(ctx) {
item.title = $('article-main-title').text() || item.title;

const dateElem = $('.publish-time');
const dateString = dateElem.text();
const dateString = dateElem.text().match(/\d+\.\d+\.\d+/));
dateElem.remove();
item.pubDate = timezone(parseDate(dateString.match(/\d+\.\d+\.\d+/)[0]), +9) || item.pubDate;
item.pubDate = dateString ? timezone(parseDate(dateString[0], +9)) : item.pubDate;

const description = fixDesc($, $('.article-content-body .content-wrapper'));

Expand Down

0 comments on commit ee37353

Please sign in to comment.