Skip to content

Commit

Permalink
fix(route): did no match the version and date
Browse files Browse the repository at this point in the history
  • Loading branch information
Fatpandac committed Dec 2, 2023
1 parent 2a24c91 commit 768b379
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/v2/brave/latest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 && 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 && matchDate[1].replace(/(st|nd|rd|th)?,/, ''), ['MMMM D YYYY', 'MMM D YYYY']),
};
});

Expand Down

0 comments on commit 768b379

Please sign in to comment.