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
+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,
};
};