diff --git a/docs/game.md b/docs/game.md
index b5088b575..442aec1f9 100644
--- a/docs/game.md
+++ b/docs/game.md
@@ -605,6 +605,24 @@ Example:`https://www.iyingdi.com/tz/people/55547` ,id 是 `55547`
+### 游戏内公告
+
+
+
+平台
+
+| 安卓服 | iOS 服 | B 服 |
+| :-----: | :---: | :------: |
+| Android | IOS | Bilibili |
+
+分组
+
+| 全部 | 系统公告 | 活动公告 |
+| :-: | :----: | :------: |
+| ALL | SYSTEM | ACTIVITY |
+
+
+
### アークナイツ (日服新闻)
diff --git a/lib/router.js b/lib/router.js
index 76957d5be..9de7f4b15 100644
--- a/lib/router.js
+++ b/lib/router.js
@@ -1856,10 +1856,10 @@ router.get('/simonsfoundation/recommend', lazyloadRouteHandler('./routes/simonsf
// 王者荣耀
router.get('/tencent/pvp/newsindex/:type', lazyloadRouteHandler('./routes/tencent/pvp/newsindex'));
-// 《明日方舟》游戏
-router.get('/arknights/news', lazyloadRouteHandler('./routes/arknights/news'));
-// アークナイツ(明日方舟日服)
-router.get('/arknights/japan', lazyloadRouteHandler('./routes/arknights/japan'));
+// 《明日方舟》游戏 (migrated to v2)
+// router.get('/arknights/news', lazyloadRouteHandler('./routes/arknights/news'));
+// アークナイツ(明日方舟日服) (migrated to v2)
+// router.get('/arknights/japan', lazyloadRouteHandler('./routes/arknights/japan'));
// 塞壬唱片
router.get('/siren/news', lazyloadRouteHandler('./routes/siren/index'));
diff --git a/lib/v2/arknights/announce.js b/lib/v2/arknights/announce.js
new file mode 100644
index 000000000..b43c87608
--- /dev/null
+++ b/lib/v2/arknights/announce.js
@@ -0,0 +1,55 @@
+const got = require('@/utils/got');
+const cheerio = require('cheerio');
+const { parseDate } = require('@/utils/parse-date');
+
+module.exports = async (ctx) => {
+ const { platform = 'Android', group = 'ALL' } = ctx.params;
+
+ let {
+ data: { announceList },
+ } = await got({
+ method: 'get',
+ url: `https://ak-conf.hypergryph.com/config/prod/announce_meta/${platform}/announcement.meta.json`,
+ });
+
+ if (group !== 'ALL') {
+ announceList = announceList.filter((item) => item.group === group);
+ }
+
+ announceList = await Promise.all(
+ announceList.map((item) =>
+ ctx.cache.tryGet(item.webUrl, async () => {
+ const { data } = await got({
+ method: 'get',
+ url: item.webUrl,
+ });
+
+ const $ = cheerio.load(data);
+ let description =
+ // 一般来讲是有字的
+ $('.content').html() ??
+ // 有些情况只有一张图
+ $('.banner-image-container.cover').html() ??
+ // 有些情况啥都没有(暂时没有遇到)
+ 'No Description';
+
+ // 游戏内部跳转链接
+ description = description.replace(/href="uniwebview:\/\/.+?"/, 'href="#"');
+
+ return {
+ title: item.title,
+ description,
+ // 不知道是哪一年的,所以不管了
+ pubDate: parseDate(`${item.month}-${item.day}`, 'M-D'),
+ link: item.webUrl,
+ };
+ })
+ )
+ );
+
+ ctx.state.data = {
+ title: `《明日方舟》${group === 'SYSTEM' ? '系统' : group === 'ACTIVITY' ? '活动' : '全部'}公告`,
+ link: 'https://ak.hypergryph.com/',
+ item: announceList,
+ };
+};
diff --git a/lib/routes/arknights/japan.js b/lib/v2/arknights/japan.js
similarity index 86%
rename from lib/routes/arknights/japan.js
rename to lib/v2/arknights/japan.js
index cabb348e7..d906dab61 100644
--- a/lib/routes/arknights/japan.js
+++ b/lib/v2/arknights/japan.js
@@ -1,4 +1,5 @@
const got = require('@/utils/got');
+const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const response = await got({
@@ -10,7 +11,7 @@ module.exports = async (ctx) => {
const newsList = items.map((item) => ({
title: item.title,
description: item.content[0].value,
- pubDate: item.publishedAt,
+ pubDate: parseDate(item.publishedAt),
link: `https://www.arknights.jp/news/${item.id}`,
}));
diff --git a/lib/v2/arknights/maintainer.js b/lib/v2/arknights/maintainer.js
new file mode 100644
index 000000000..55e6d9618
--- /dev/null
+++ b/lib/v2/arknights/maintainer.js
@@ -0,0 +1,5 @@
+module.exports = {
+ '/announce/:platform?/:group?': ['swwind'],
+ '/japan': ['ofyark'],
+ '/news': ['Astrian'],
+};
diff --git a/lib/routes/arknights/news.js b/lib/v2/arknights/news.js
similarity index 70%
rename from lib/routes/arknights/news.js
rename to lib/v2/arknights/news.js
index ea3c299ba..0dc3635de 100644
--- a/lib/routes/arknights/news.js
+++ b/lib/v2/arknights/news.js
@@ -1,5 +1,6 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
+const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const response = await got({
@@ -16,18 +17,18 @@ module.exports = async (ctx) => {
newslist
.slice(0, 9) // limit article count to a single page
.map(async (index, item) => {
- const sth = $(item);
- const link = `https://ak.hypergryph.com${sth.attr('href')}`;
+ item = $(item);
+ const link = `https://ak.hypergryph.com${item.attr('href')}`;
const description = await ctx.cache.tryGet(link, async () => {
- const result = await got.get(link);
+ const result = await got(link);
const $ = cheerio.load(result.data);
return $('.article-content').html();
});
return {
- title: `[${sth.find('.articleItemCate').first().text()}] ${sth.find('.articleItemTitle').first().text()}`,
+ title: `[${item.find('.articleItemCate').first().text()}] ${item.find('.articleItemTitle').first().text()}`,
description,
link,
- pubDate: new Date(sth.find('.articleItemDate').first().text()),
+ pubDate: parseDate(item.find('.articleItemDate').first().text()),
};
})
.get()
diff --git a/lib/v2/arknights/radar.js b/lib/v2/arknights/radar.js
new file mode 100644
index 000000000..f6c7e160e
--- /dev/null
+++ b/lib/v2/arknights/radar.js
@@ -0,0 +1,40 @@
+module.exports = {
+ 'arknights.jp': {
+ _name: '明日方舟',
+ ak: [
+ {
+ title: 'アークナイツ(日服新闻)',
+ docs: 'https://docs.rsshub.app/game.html#ming-ri-fang-zhou',
+ source: ['/news?lang=ja&limit=9&page=1', '/'],
+ target: '/arknights/japan',
+ },
+ ],
+ },
+ 'hypergryph.com': {
+ _name: '明日方舟',
+ ak: [
+ {
+ title: '游戏公告与新闻',
+ docs: 'https://docs.rsshub.app/game.html#ming-ri-fang-zhou',
+ source: ['/news.html', '/'],
+ target: '/arknights/news',
+ },
+ ],
+ 'ak-conf': [
+ {
+ title: '游戏内公告',
+ docs: 'https://docs.rsshub.app/game.html#ming-ri-fang-zhou',
+ source: ['/*'],
+ target: '/arknights/news',
+ },
+ ],
+ 'monster-siren': [
+ {
+ title: '塞壬唱片',
+ docs: 'https://docs.rsshub.app/game.html#ming-ri-fang-zhou',
+ source: ['/info', '/'],
+ target: '/siren/news',
+ },
+ ],
+ },
+};
diff --git a/lib/v2/arknights/router.js b/lib/v2/arknights/router.js
new file mode 100644
index 000000000..a87b3753f
--- /dev/null
+++ b/lib/v2/arknights/router.js
@@ -0,0 +1,8 @@
+module.exports = function (router) {
+ // 《明日方舟》游戏内公告
+ router.get('/announce/:platform?/:group?', require('./announce'));
+ // アークナイツ(明日方舟日服)
+ router.get('/japan', require('./japan'));
+ // 《明日方舟》游戏公告与新闻
+ router.get('/news', require('./news'));
+};