mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 15:21:59 +08:00
feat: 添加公主连接国服公告 (#4542)
This commit is contained in:
@@ -250,6 +250,10 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的
|
|||||||
|
|
||||||
<Route author="hoilc" example="/pcr/news-tw" path="/pcr/news-tw"/>
|
<Route author="hoilc" example="/pcr/news-tw" path="/pcr/news-tw"/>
|
||||||
|
|
||||||
|
### 国服公告
|
||||||
|
|
||||||
|
<Route author="KotoriK" example="/pcr/news-cn" path="/pcr/news-cn"/>
|
||||||
|
|
||||||
## 篝火营地
|
## 篝火营地
|
||||||
|
|
||||||
### 游戏资讯
|
### 游戏资讯
|
||||||
|
|||||||
@@ -2236,6 +2236,7 @@ router.get('/ddrk/index', require('./routes/ddrk/list'));
|
|||||||
// 公主链接公告
|
// 公主链接公告
|
||||||
router.get('/pcr/news', require('./routes/pcr/news'));
|
router.get('/pcr/news', require('./routes/pcr/news'));
|
||||||
router.get('/pcr/news-tw', require('./routes/pcr/news-tw'));
|
router.get('/pcr/news-tw', require('./routes/pcr/news-tw'));
|
||||||
|
router.get('/pcr/news-cn', require('./routes/pcr/news-cn'));
|
||||||
|
|
||||||
// project-zero issues
|
// project-zero issues
|
||||||
router.get('/project-zero-issues', require('./routes/project-zero-issues/index'));
|
router.get('/project-zero-issues', require('./routes/project-zero-issues/index'));
|
||||||
|
|||||||
28
lib/routes/pcr/news-cn.js
Normal file
28
lib/routes/pcr/news-cn.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: 'https://api.biligame.com/news/list?gameExtensionId=267&positionId=2&typeId=1&pageNum=1&pageSize=5',
|
||||||
|
});
|
||||||
|
const data = response.data;
|
||||||
|
ctx.state.data = {
|
||||||
|
title: '公主链接国服-最新公告',
|
||||||
|
link: 'https://game.bilibili.com/pcr/news.html',
|
||||||
|
item: data
|
||||||
|
? await Promise.all(
|
||||||
|
data.data.map(async (item) => ({
|
||||||
|
title: item.title,
|
||||||
|
description: `${await ctx.cache.tryGet(`pcrcn_${item.id}`, async () => {
|
||||||
|
const resp = await got({ method: 'get', url: `https://api.biligame.com/news/${item.id}` });
|
||||||
|
return resp.data.data.content;
|
||||||
|
})}`,
|
||||||
|
link: `https://game.bilibili.com/pcr/news.html#detail=${item.id}`,
|
||||||
|
pubDate: item.ctime ? item.ctime : item.createTime,
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
: {
|
||||||
|
title: '获取失败!',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user