fix(route): did no match the version and date (#13942)

* fix(route): did no match the version and date

* Update latest.js

* Update latest.js
---------
This commit is contained in:
Fatpandac 2023-12-02 23:18:29 +08:00 committed by GitHub
parent ea24778c47
commit 082bb3d847
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -20,13 +20,15 @@ module.exports = async (ctx) => {
const title = item.text();
const device = item.parent().find('h2').text();
const matchVersion = title.match(/(v[\d.]+)/);
const matchDate = title.match(/\((.*?)\)/);
return {
title: `[${device}] ${title}`,
link: currentUrl,
guid: `${currentUrl}#${device}-${title.match(/(v[\d.]+)/)[1]}`,
guid: `${currentUrl}#${device}-${matchVersion?.[1] ?? title}`,
description: item.next().html(),
pubDate: parseDate(title.match(/\((.*?)\)/)[1].replace(/(st|nd|rd|th)?,/, ''), ['MMMM D YYYY', 'MMM D YYYY']),
pubDate: parseDate(matchDate?.[1].replace(/(st|nd|rd|th)?,/, ''), ['MMMM D YYYY', 'MMM D YYYY']),
};
});