mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-21 12:49:53 +08:00
feat(route): add WizTree What's New (#10300)
This commit is contained in:
@@ -448,6 +448,12 @@ Refer to [#minecraft](/en/game.html#minecraft)
|
||||
|
||||
<RouteEn author="cnzgray" example="/typora/changelog" path="/typora/changelog"/>
|
||||
|
||||
## WizTree
|
||||
|
||||
### What's New
|
||||
|
||||
<RouteEn author="nczitzk" example="/diskanalyzer/whats-new" path="/diskanalyzer/whats-new"/>
|
||||
|
||||
## X410
|
||||
|
||||
### News
|
||||
|
||||
@@ -535,6 +535,12 @@ pageClass: routes
|
||||
|
||||
<Route author="nczitzk" example="/typora/changelog-dev/macOS" path="/typora/changelog-dev/:os" :paramsDesc="['操作系统类型, 可选 `macOS` 或 `Windows` 与 `Linux`,默认为 `macOS`']"/>
|
||||
|
||||
## WizTree
|
||||
|
||||
### What's New
|
||||
|
||||
<Route author="nczitzk" example="/diskanalyzer/whats-new" path="/diskanalyzer/whats-new"/>
|
||||
|
||||
## X410
|
||||
|
||||
### News
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/whats-new': ['nczitzk'],
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
'diskanalyzer.com': {
|
||||
_name: "What's New",
|
||||
'.': [
|
||||
{
|
||||
title: 'Change Log',
|
||||
docs: 'https://docs.rsshub.app/program-update.html#wiztree-whats-new',
|
||||
source: ['/whats-new', '/'],
|
||||
target: '/diskanalyzer/whats-new',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/whats-new', require('./whats-new'));
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://diskanalyzer.com';
|
||||
const currentUrl = `${rootUrl}/whats-new`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const items = $('.blog-content h4')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
|
||||
const title = item.text();
|
||||
|
||||
let description = '';
|
||||
item.nextUntil('h4').each(function () {
|
||||
description += $(this).html();
|
||||
});
|
||||
if (description === '') {
|
||||
item.parent()
|
||||
.nextUntil('h4')
|
||||
.each(function () {
|
||||
description += $(this).html();
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
title,
|
||||
link: currentUrl,
|
||||
description,
|
||||
pubDate: parseDate(title.match(/\((.*)\)/)[1], ['D MMMM YYYY', 'D MMM YYYY']),
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user