feat: add monsterhunter update

This commit is contained in:
DIYgod
2019-06-05 18:17:19 +08:00
parent ed42dc5965
commit d2b86a1f32
4 changed files with 49 additions and 0 deletions

View File

@@ -109,6 +109,12 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的
<Route author="whtsky" example="/steamgifts/discussions" path="/steamgifts/discussions/:category?" :paramsDesc="['分类名称默认为All']"/>
## 怪物猎人
### 更新
<Route author="DIYgod" example="/monsterhunter/update" path="/monsterhunter/update"/>
## 旅法师营地
### 旅法师营地

View File

@@ -140,6 +140,12 @@ pageClass: routes
<Route author="maple3142" example="/xiaomieu/releases" path="/xiaomieu/releases"/>
## 怪物猎人
### 更新
见 [#怪物猎人](/game.html#怪物猎人)
## 腾讯云移动直播 SDK
### 更新日志

View File

@@ -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;

View File

@@ -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(),
};
};