feat(route): add Neat Download Manager Download (#10320)

This commit is contained in:
Ethan Shen 2022-07-25 01:25:19 +08:00 committed by GitHub
parent 3bb35e3755
commit 18dadf577b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 81 additions and 0 deletions

View File

@ -311,6 +311,12 @@ Refer to [#minecraft](/en/game.html#minecraft)
见 [#Monster Hunter World](/en/game.html#monster-hunter-world)
## Neat Download Manager
### Download
<RouteEn author="nczitzk" example="/neatdownloadmanager/download" path="/neatdownloadmanager/download/:os?" :paramsDesc="['Operating system, windows or macos, all by default']"/>
## Nintendo Switch
### Switch System UpdateJapan

View File

@ -348,6 +348,12 @@ pageClass: routes
</Route>
## Neat Download Manager
### Download
<Route author="nczitzk" example="/neatdownloadmanager/download" path="/neatdownloadmanager/download/:os?" :paramsDesc="['操作系统,可选 windows 或 macos默认为全部']"/>
## Nintendo Switch
### Switch 本体更新情报(日本)

View File

@ -0,0 +1,50 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const os = (ctx.params.os ?? '').toLowerCase();
const rootUrl = 'https://www.neatdownloadmanager.com';
const currentUrl = `${rootUrl}/index.php`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const items = $('.p1')
.toArray()
.filter((item) => {
item = $(item);
const isMacOS = /^dmg/.test(item.text());
if (os !== '') {
if (os === 'macos') {
return isMacOS;
} else {
return !isMacOS;
}
}
return true;
})
.map((item) => {
item = $(item);
const text = item.text();
const version = text.match(/\(ver (.*?)\)/)[1];
return {
title: `[${/^dmg/.test(text) ? 'macOS' : 'Windows'}] ${text}`,
link: `${rootUrl}${item.prev().find('a').attr('href')}#${version}`,
};
});
ctx.state.data = {
title: 'Neat Download Manager',
link: currentUrl,
item: items,
};
};

View File

@ -0,0 +1,3 @@
module.exports = {
'/download/:os?': ['nczitzk'],
};

View File

@ -0,0 +1,13 @@
module.exports = {
'neatdownloadmanager.com': {
_name: 'Neat Download Manager',
'.': [
{
title: 'Download',
docs: 'https://docs.rsshub.app/program-update.html#neat-download-manager-download',
source: ['/index.php', '/'],
target: '/neatdownloadmanager/download/:os?',
},
],
},
};

View File

@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/download/:os?', require('./download'));
};