feat(route): add Brave Release Notes (#10301)
* feat(route): add Brave Release Notes * fix guid
This commit is contained in:
@@ -112,6 +112,12 @@ Language
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## Brave
|
||||
|
||||
### Release Notes
|
||||
|
||||
<Route author="nczitzk" example="/brave/latest" path="/brave/latest"/>
|
||||
|
||||
## Chocolatey
|
||||
|
||||
### Software Update
|
||||
|
||||
@@ -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
|
||||
|
||||
### 更新日志
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/latest': ['nczitzk'],
|
||||
};
|
||||
@@ -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',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/latest', require('./latest'));
|
||||
};
|
||||
Reference in New Issue
Block a user