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']), }; });