feat: add Konami PES mobile (#6160)

This commit is contained in:
Henry Wang
2020-11-12 19:30:24 +00:00
committed by GitHub
parent 179c6086ba
commit a0cbc7b3bb
4 changed files with 46 additions and 0 deletions
+6
View File
@@ -16,6 +16,12 @@ pageClass: routes
<RouteEn author="Zyx-A" example="/epicgames/freegames" path="/epicgames/freegames"/>
## Konami
### PES Mobile Announcement
<RouteEn author="HenryQW" example="/konami/pesmobile/en/ios" path="/konami/pesmobile/:lang?/:os?" :paramsDesc="['language, obtained from the URL, eg. zh-cn, zh-tw, en', 'operating system,iOS or Android']"/>
## Metacritic
### Game Releases
+6
View File
@@ -112,6 +112,12 @@ pageClass: routes
<Route author="GensouSakuya kt286" example="/indienova/article" path="indienova/:type" :paramsDesc="['类型: `article` 文章,`development` 开发']"/>
## Konami
### PES Mobile 公告
<Route author="HenryQW" example="/konami/pesmobile/zh-cn/ios" path="/konami/pesmobile/:lang?/:os?" :paramsDesc="['语言,在URL中获得,如zh-cn, zh-tw, en', '操作系统,iOS 或 Android']"/>
## Liquipedia
### Dota2 战队最近比赛结果
+3
View File
@@ -1533,6 +1533,9 @@ router.get('/gamersky/ent/:category', require('./routes/gamersky/ent'));
// 游研社
router.get('/yystv/category/:category', require('./routes/yystv/category'));
// konami
router.get('/konami/pesmobile/:lang?/:os?', require('./routes/konami/pesmobile'));
// psnine
router.get('/psnine/index', require('./routes/psnine/index'));
router.get('/psnine/shuzhe', require('./routes/psnine/shuzhe'));
+31
View File
@@ -0,0 +1,31 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const os = ctx.params.os || 'ios';
const lang = ctx.params.lang || 'zh-cn';
const link = `https://www.konami.com/wepes/mobile/${lang}/information?os=${os}&page=1&num=20`;
const response = await got.get(link);
const $ = cheerio.load(response.data);
const items = $('ul.topics_list li')
.get()
.slice(1, 11)
.map((m) => {
const title = `[${$(m).find('span.category-information').text()}] ${$(m).find('span.topics_title').text()}`;
return {
title,
link,
description: $(m).find('div.topics_text').html(),
pubDate: new Date($(m).find('span.topics_date').text()),
guid: `PES Mobile ${title} ${$(m).find('span.topics_date').text()}`,
};
});
ctx.state.data = {
title: `PES Mobile ${$('h1').text()}`,
link,
item: items,
};
};