feat(route): add Brave Release Notes (#10301)

* feat(route): add Brave Release Notes

* fix guid
This commit is contained in:
Ethan Shen
2022-07-22 18:32:19 -08:00
committed by GitHub
parent e1ee46b806
commit 9ca4c0b762
6 changed files with 69 additions and 0 deletions
+6
View File
@@ -112,6 +112,12 @@ Language
</RouteEn>
## Brave
### Release Notes
<Route author="nczitzk" example="/brave/latest" path="/brave/latest"/>
## Chocolatey
### Software Update
+6
View File
@@ -110,6 +110,12 @@ pageClass: routes
| ------- | -------- | --------- | ----- | -------------- |
| android | iphone | ipad | win | android_tv_yst |
## Brave
### Release Notes
<Route author="nczitzk" example="/brave/latest" path="/brave/latest"/>
## Bugly SDK
### 更新日志
+38
View File
@@ -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,
};
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
'/latest': ['nczitzk'],
};
+13
View File
@@ -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',
},
],
},
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/latest', require('./latest'));
};