mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat: add QNAP Release Notes (#5972)
This commit is contained in:
@@ -155,6 +155,18 @@ Refer to [#minecraft](/en/game.html#minecraft)
|
||||
|
||||
见 [#playstation](/game.html#playstation)
|
||||
|
||||
## QNAP
|
||||
|
||||
### Release Notes
|
||||
|
||||
<RouteEn author="nczitzk" example="/qnap/release-notes/qts" path="/qnap/release-notes/:id" :paramsDesc="['OS id, see below']">
|
||||
|
||||
| QTS | QuTS hero | QuTScloud | QuWAN Orchestrator | QES | TAS | AfoBot |
|
||||
| --- | --------- | --------- | ------------------ | --- | --- | ------ |
|
||||
| qts | quts_hero | qutscloud | quwan_orchestrator | qes | tas | afobot |
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## RSSHub
|
||||
|
||||
### New routes
|
||||
|
||||
@@ -202,6 +202,18 @@ pageClass: routes
|
||||
|
||||
见 [#playstation](/game.html#playstation)
|
||||
|
||||
## QNAP
|
||||
|
||||
### Release Notes
|
||||
|
||||
<Route author="nczitzk" example="/qnap/release-notes/qts" path="/qnap/release-notes/:id" :paramsDesc="['OS id,见下表']">
|
||||
|
||||
| QTS | QuTS hero | QuTScloud | QuWAN Orchestrator | QES | TAS | AfoBot |
|
||||
| --- | --------- | --------- | ------------------ | --- | --- | ------ |
|
||||
| qts | quts_hero | qutscloud | quwan_orchestrator | qes | tas | afobot |
|
||||
|
||||
</Route>
|
||||
|
||||
## Quicker
|
||||
|
||||
### 版本更新
|
||||
|
||||
@@ -3380,4 +3380,7 @@ router.get('/dev.to/top/:period', require('./routes/dev.to/top'));
|
||||
router.get('/gameres/hot', require('./routes/gameres/hot'));
|
||||
router.get('/gameres/list/:id', require('./routes/gameres/list'));
|
||||
|
||||
// QNAP
|
||||
router.get('/qnap/release-notes/:id', require('./routes/qnap/release-notes'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://www.qnap.com';
|
||||
const currentUrl = `${rootUrl}/en/release-notes/${ctx.params.id}`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('.tier1-menu li.active .tier2-menu li .tier3-menu li a')
|
||||
.slice(0, 20)
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.text().trim(),
|
||||
link: `${rootUrl}/en/release-notes/${item.attr('data-os')}/${item.attr('data-version')}/${item.attr('data-build-number')}`,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(
|
||||
async (item) =>
|
||||
await ctx.cache.tryGet(item.link, async () => {
|
||||
const links = item.link.split('/');
|
||||
const apiUrl = `${rootUrl}/api/v1/release-notes/${links[4]}?locale=en&version=${links[5]}&build_number=${links[6]}`;
|
||||
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: apiUrl,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data.result);
|
||||
|
||||
item.description = content('.content').html();
|
||||
item.pubDate = new Date(content('.title-container p').text()).toUTCString();
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${$('.tier1-menu li.active span').eq(0).text()} - QNAP`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user