From 082bb3d847480c481a839cbe7aa433b337273231 Mon Sep 17 00:00:00 2001 From: Fatpandac Date: Sat, 2 Dec 2023 23:18:29 +0800 Subject: [PATCH] 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 --------- --- lib/v2/brave/latest.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/v2/brave/latest.js b/lib/v2/brave/latest.js index 4072a2ea9..8e33c6e56 100644 --- a/lib/v2/brave/latest.js +++ b/lib/v2/brave/latest.js @@ -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']), }; });