diff --git a/docs/game.md b/docs/game.md index d6e50c6ab3..0ae4318bda 100644 --- a/docs/game.md +++ b/docs/game.md @@ -109,6 +109,12 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的 +## 怪物猎人 + +### 更新 + + + ## 旅法师营地 ### 旅法师营地 diff --git a/docs/program-update.md b/docs/program-update.md index f2ad75a254..c255c9db4d 100644 --- a/docs/program-update.md +++ b/docs/program-update.md @@ -140,6 +140,12 @@ pageClass: routes +## 怪物猎人 + +### 更新 + +见 [#怪物猎人](/game.html#怪物猎人) + ## 腾讯云移动直播 SDK ### 更新日志 diff --git a/lib/router.js b/lib/router.js index c034e78ce7..72dd1e5522 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1382,4 +1382,7 @@ router.get('/dilbert/strip', require('./routes/dilbert/strip')); // 游戏打折情报 router.get('/yxdzqb/:type', require('./routes/yxdzqb')); +// 怪物猎人 +router.get('/monsterhunter/update', require('./routes/monsterhunter/update')); + module.exports = router; diff --git a/lib/routes/monsterhunter/update.js b/lib/routes/monsterhunter/update.js new file mode 100644 index 0000000000..54f0dae6ed --- /dev/null +++ b/lib/routes/monsterhunter/update.js @@ -0,0 +1,34 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const url = 'http://game.capcom.com/world/cn/infomation.html'; + + const response = await got({ + method: 'get', + url, + }); + + const data = response.data; + + const $ = cheerio.load(data); + const list = $('.version'); + + ctx.state.data = { + title: '怪物猎人更新情报', + link: url, + item: + list && + list + .map((index, item) => { + item = $(item); + return { + title: item.find('h3').text(), + description: item.children('div').html(), + link: url, + guid: item.find('h3').text(), + }; + }) + .get(), + }; +};