diff --git a/docs/en/program-update.md b/docs/en/program-update.md index 78a4b06a33..004f7dbfec 100644 --- a/docs/en/program-update.md +++ b/docs/en/program-update.md @@ -112,6 +112,12 @@ Language +## Brave + +### Release Notes + + + ## Chocolatey ### Software Update diff --git a/docs/program-update.md b/docs/program-update.md index f527f2aa5c..28078fe60c 100644 --- a/docs/program-update.md +++ b/docs/program-update.md @@ -110,6 +110,12 @@ pageClass: routes | ------- | -------- | --------- | ----- | -------------- | | android | iphone | ipad | win | android_tv_yst | +## Brave + +### Release Notes + + + ## Bugly SDK ### 更新日志 diff --git a/lib/v2/brave/latest.js b/lib/v2/brave/latest.js new file mode 100644 index 0000000000..4072a2ea99 --- /dev/null +++ b/lib/v2/brave/latest.js @@ -0,0 +1,38 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const { parseDate } = require('@/utils/parse-date'); + +module.exports = async (ctx) => { + const rootUrl = 'https://brave.com'; + const currentUrl = `${rootUrl}/latest`; + + const response = await got({ + method: 'get', + url: currentUrl, + }); + + const $ = cheerio.load(response.data); + + const items = $('.box h3') + .toArray() + .map((item) => { + item = $(item); + + const title = item.text(); + const device = item.parent().find('h2').text(); + + return { + title: `[${device}] ${title}`, + link: currentUrl, + guid: `${currentUrl}#${device}-${title.match(/(v[\d.]+)/)[1]}`, + description: item.next().html(), + pubDate: parseDate(title.match(/\((.*?)\)/)[1].replace(/(st|nd|rd|th)?,/, ''), ['MMMM D YYYY', 'MMM D YYYY']), + }; + }); + + ctx.state.data = { + title: $('title').text(), + link: currentUrl, + item: items, + }; +}; diff --git a/lib/v2/brave/maintainer.js b/lib/v2/brave/maintainer.js new file mode 100644 index 0000000000..14469c8eee --- /dev/null +++ b/lib/v2/brave/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/latest': ['nczitzk'], +}; diff --git a/lib/v2/brave/radar.js b/lib/v2/brave/radar.js new file mode 100644 index 0000000000..5a8ac592a6 --- /dev/null +++ b/lib/v2/brave/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'brave.com': { + _name: 'Brave', + '.': [ + { + title: 'Release Notes', + docs: 'https://docs.rsshub.app/program-update.html#brave-release-notes', + source: ['/latest', '/'], + target: '/brave/latest', + }, + ], + }, +}; diff --git a/lib/v2/brave/router.js b/lib/v2/brave/router.js new file mode 100644 index 0000000000..c7599855e1 --- /dev/null +++ b/lib/v2/brave/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/latest', require('./latest')); +};