diff --git a/docs/README.md b/docs/README.md index 32d95632e1..b756eb971c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2337,6 +2337,10 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的 +### Indienova + + + ## 小说·文学·阅读 ### 观止(每日一文) diff --git a/lib/router.js b/lib/router.js index 6e142b8c4a..90a918a4cc 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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; diff --git a/lib/routes/indienova/article.js b/lib/routes/indienova/article.js new file mode 100644 index 0000000000..393fe9b6b7 --- /dev/null +++ b/lib/routes/indienova/article.js @@ -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() + '', + link: + 'https://www.indienova.com' + + item + .find('.article-image') + .find('a') + .attr('href'), + }; + }) + .get(), + }; +};