diff --git a/docs/game.md b/docs/game.md index d02cf6a6ff..d5fc3f5f1d 100644 --- a/docs/game.md +++ b/docs/game.md @@ -362,3 +362,9 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的 ### 公告 + +## 公主链接 + +### 日服公告 + + diff --git a/lib/router.js b/lib/router.js index b9f8bf7031..4498ff182e 100644 --- a/lib/router.js +++ b/lib/router.js @@ -2098,6 +2098,9 @@ router.get('/mlog-club/projects', require('./routes/mlog-club/projects')); // Chrome 网上应用店 router.get('/chrome/webstore/extensions/:id', require('./routes/chrome/extensions')); +// 公主链接日服公告 +router.get('/pcr/news', require('./routes/pcr/news')); + // project-zero issues router.get('/project-zero-issues', require('./routes/project-zero-issues/index')); diff --git a/lib/routes/pcr/news.js b/lib/routes/pcr/news.js new file mode 100644 index 0000000000..691db8d913 --- /dev/null +++ b/lib/routes/pcr/news.js @@ -0,0 +1,34 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const response = await got({ + method: 'get', + url: 'https://priconne-redive.jp/news/', + }); + const data = response.data; + const $ = cheerio.load(data); + const list = $('.article_box'); + let itemPicUrl; + ctx.state.data = { + title: '公主链接日服-新闻', + link: 'https://priconne-redive.jp/news/', + item: + list && + list + .map((index, item) => { + item = $(item); + itemPicUrl = item.find('img.attachment-news-thumbnail').attr('src'); + return { + title: item.find('h4').text(), + description: `${item.find('.description p').text()}
`, + link: item + .find('a') + .first() + .attr('href'), + pubDate: item.find('.time').text(), + }; + }) + .get(), + }; +};