diff --git a/lib/router.js b/lib/router.js index fe2bfa7f9..8bf1ee589 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1,3 +1,4 @@ +// eslint-disable-next-line n/no-extraneous-require const Router = require('@koa/router'); const router = new Router(); @@ -1753,7 +1754,7 @@ router.get('/potplayer/update/:language?', lazyloadRouteHandler('./routes/potpla router.get('/modian/zhongchou/:category?/:sort?/:status?', lazyloadRouteHandler('./routes/modian/zhongchou')); // 世界计划 多彩舞台 feat.初音未来 (ProjectSekai) -router.get('/pjsk/news', lazyloadRouteHandler('./routes/pjsk/news')); +// router.get('/pjsk/news', lazyloadRouteHandler('./routes/pjsk/news')); // 人民论坛网 router.get('/rmlt/idea/:category?', lazyloadRouteHandler('./routes/rmlt/idea')); diff --git a/lib/routes/sega/maintainer.ts b/lib/routes/sega/maintainer.ts new file mode 100644 index 000000000..ae0f7d36c --- /dev/null +++ b/lib/routes/sega/maintainer.ts @@ -0,0 +1,3 @@ +export default { + '/pjsekai/news': ['15x15G'], +}; diff --git a/lib/routes-deprecated/pjsk/news.js b/lib/routes/sega/pjsekai.ts similarity index 84% rename from lib/routes-deprecated/pjsk/news.js rename to lib/routes/sega/pjsekai.ts index 7d4f8b2a9..4b9cd2066 100644 --- a/lib/routes-deprecated/pjsk/news.js +++ b/lib/routes/sega/pjsekai.ts @@ -1,7 +1,8 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const timezone = require('@/utils/timezone'); -module.exports = async (ctx) => { +import got from '@/utils/got'; +import * as cheerio from 'cheerio'; +import timezone from '@/utils/timezone'; +import cache from '@/utils/cache'; +export default async (ctx) => { // 从仓库 Sekai-World/sekai-master-db-diff 获取最新公告 const response = await got.get(`https://cdn.jsdelivr.net/gh/Sekai-World/sekai-master-db-diff@master/userInformations.json`); const posts = response.data || []; @@ -15,10 +16,10 @@ module.exports = async (ctx) => { const path = post.path.replace(/information\/index.html\?id=/, ''); link = `https://production-web.sekai.colorfulpalette.org/${post.path}`; try { - description = await ctx.cache.tryGet(guid, async () => { + description = await cache.tryGet(guid, async () => { const result = await got.get(`https://production-web.sekai.colorfulpalette.org/html/${path}.html`); const $ = cheerio.load(result.data); - return $('body').html(); + return $.html(); }); } catch { description = link; @@ -40,10 +41,10 @@ module.exports = async (ctx) => { return item; }) ); - ctx.state.data = { + ctx.set('data', { title: 'Project Sekai - News', link: 'https://pjsekai.sega.jp/', description: 'プロジェクトセカイ カラフルステージ! feat.初音ミク', item: list, - }; + }); }; diff --git a/lib/routes/sega/radar.ts b/lib/routes/sega/radar.ts new file mode 100644 index 000000000..54cef5442 --- /dev/null +++ b/lib/routes/sega/radar.ts @@ -0,0 +1,13 @@ +export default { + 'sega.jp': { + _name: 'SEGA', + pjsekai: [ + { + title: 'Project Sekai / プロセカ Game News', + docs: 'https://docs.rsshub.app/routes/game#sega', + source: ['/news/index.html'], + target: '/sega/pjsekai/news', + }, + ], + }, +}; diff --git a/lib/routes/sega/router.ts b/lib/routes/sega/router.ts new file mode 100644 index 000000000..d816418c0 --- /dev/null +++ b/lib/routes/sega/router.ts @@ -0,0 +1,3 @@ +export default (router) => { + router.get('/pjsekai/news', './pjsekai.ts'); +}; diff --git a/website/docs/routes/game.mdx b/website/docs/routes/game.mdx index 37a7df309..0f10463ae 100644 --- a/website/docs/routes/game.mdx +++ b/website/docs/routes/game.mdx @@ -510,6 +510,12 @@ | RDR2 | 荒野大镖客 2 | +## SEGA {#sega} + +### 世界计划 多彩舞台 | ProjectSekai | プロセカ {#sega-shi-jie-ji-hua-duo-cai-wu-tai-projectsekai-%E3%83%97%E3%83%AD%E3%82%BB%E3%82%AB} + + + ## Steam {#steam} ### Steam search {#steam-steam-search} @@ -867,12 +873,6 @@ Example:`https://www.iyingdi.com/tz/people/55547` ,id 是 `55547` | 1 | 3 | -## 世界计划 多彩舞台 | ProjectSekai | プロセカ {#shi-jie-ji-hua-duo-cai-wu-tai-projectsekai-%E3%83%97%E3%83%AD%E3%82%BB%E3%82%AB} - -### News {#shi-jie-ji-hua-duo-cai-wu-tai-projectsekai-%E3%83%97%E3%83%AD%E3%82%BB%E3%82%AB-news} - - - ## 完美世界电竞 {#wan-mei-shi-jie-dian-jing} ### 资讯列表 {#wan-mei-shi-jie-dian-jing-zi-xun-lie-biao}