add indienova (#1509)
This commit is contained in:
parent
ab2028ffa2
commit
d0d3b69d27
|
|
@ -2337,6 +2337,10 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的
|
|||
|
||||
<route name="用户动态" author="LogicJake" example="/xiaoheihe/user/7775687" path="xiaoheihe/user/:id" :paramsDesc="['用户 id']"/>
|
||||
|
||||
### Indienova
|
||||
|
||||
<route name="indienova 文章" author="GensouSakuya" example="/indienova/article" path="indienova/article"/>
|
||||
|
||||
## 小说·文学·阅读
|
||||
|
||||
### 观止(每日一文)
|
||||
|
|
|
|||
|
|
@ -1037,4 +1037,7 @@ router.get('/d2/daily', require('./routes/d2/daily'));
|
|||
// ebb
|
||||
router.get('/ebb', require('./routes/ebb'));
|
||||
|
||||
// Indienova
|
||||
router.get('/indienova/article', require('./routes/indienova/article'));
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: 'https://www.indienova.com/indie-game-news/',
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.article-panel');
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'INDIENOVA',
|
||||
link: 'https://www.indienova.com/indie-game-news/',
|
||||
description: '独立游戏资讯 | indienova 独立游戏',
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('h4').text(),
|
||||
description: item.find('p').text() + '<img src="' + item.find('img').attr('src') + '">',
|
||||
link:
|
||||
'https://www.indienova.com' +
|
||||
item
|
||||
.find('.article-image')
|
||||
.find('a')
|
||||
.attr('href'),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue