mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 14:40:23 +08:00
feat: 添加 Nintendo Switch 本体更新情报 (#3469)
This commit is contained in:
@@ -100,6 +100,10 @@ pageClass: routes
|
|||||||
|
|
||||||
<Route author="HFO4" example="/nintendo/direct" path="/nintendo/direct"/>
|
<Route author="HFO4" example="/nintendo/direct" path="/nintendo/direct"/>
|
||||||
|
|
||||||
|
### Switch 本体更新情报(日本)
|
||||||
|
|
||||||
|
<Route author="hoilc" example="/nintendo/system-update" path="/nintendo/system-update"/>
|
||||||
|
|
||||||
## PlayStation
|
## PlayStation
|
||||||
|
|
||||||
### PlayStation Store 游戏列表
|
### PlayStation Store 游戏列表
|
||||||
|
|||||||
@@ -1364,6 +1364,7 @@ router.get('/nintendo/eshop/hk', require('./routes/nintendo/eshop_hk'));
|
|||||||
router.get('/nintendo/eshop/us', require('./routes/nintendo/eshop_us'));
|
router.get('/nintendo/eshop/us', require('./routes/nintendo/eshop_us'));
|
||||||
router.get('/nintendo/news', require('./routes/nintendo/news'));
|
router.get('/nintendo/news', require('./routes/nintendo/news'));
|
||||||
router.get('/nintendo/direct', require('./routes/nintendo/direct'));
|
router.get('/nintendo/direct', require('./routes/nintendo/direct'));
|
||||||
|
router.get('/nintendo/system-update', require('./routes/nintendo/system-update'));
|
||||||
|
|
||||||
// 世界卫生组织
|
// 世界卫生组织
|
||||||
router.get('/who/news-room/:type', require('./routes/who/news-room'));
|
router.get('/who/news-room/:type', require('./routes/who/news-room'));
|
||||||
|
|||||||
40
lib/routes/nintendo/system-update.js
Normal file
40
lib/routes/nintendo/system-update.js
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const url = 'https://www.nintendo.co.jp/support/switch/system_update/index.html';
|
||||||
|
|
||||||
|
const response = await got.get(url);
|
||||||
|
const $ = cheerio.load(response.data);
|
||||||
|
|
||||||
|
const list = $('#latest > .c-heading-lv3')
|
||||||
|
.toArray()
|
||||||
|
.slice(1);
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: 'Nintendo Switch 本体更新情報',
|
||||||
|
link: url,
|
||||||
|
item: list.map((update) => {
|
||||||
|
update = $(update);
|
||||||
|
const heading = update.text();
|
||||||
|
const matched_date = /(\d+)年(\d+)月(\d+)日/.exec(heading);
|
||||||
|
const update_info = update.nextUntil('.c-heading-lv3');
|
||||||
|
const update_infos = update_info
|
||||||
|
.map(function() {
|
||||||
|
return $(this).html();
|
||||||
|
})
|
||||||
|
.get()
|
||||||
|
.join('\n');
|
||||||
|
const matched_version = /(\d\.)+\d/.exec(heading);
|
||||||
|
|
||||||
|
return {
|
||||||
|
title: heading,
|
||||||
|
author: 'Nintendo',
|
||||||
|
description: update_infos,
|
||||||
|
link: url,
|
||||||
|
guid: `${url}#${matched_version[0]}`,
|
||||||
|
pubDate: new Date(parseInt(matched_date[1]), parseInt(matched_date[2]) - 1, parseInt(matched_date[3])),
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user