fix(route): migrate pjsk (#14673)

* fix(route): migrate pjsk

* fix(routes): Use esm export

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* feat(route): add radar.ts for pjsk

* refactor: move to proper namespace

---------
This commit is contained in:
randompasser
2024-03-08 23:25:48 +08:00
committed by GitHub
parent 4ebfcf7d4a
commit 21d6841a30
6 changed files with 36 additions and 15 deletions
+2 -1
View File
@@ -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'));
+3
View File
@@ -0,0 +1,3 @@
export default {
'/pjsekai/news': ['15x15G'],
};
@@ -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,
};
});
};
+13
View File
@@ -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',
},
],
},
};
+3
View File
@@ -0,0 +1,3 @@
export default (router) => {
router.get('/pjsekai/news', './pjsekai.ts');
};
+6 -6
View File
@@ -510,6 +510,12 @@
| RDR2 | 荒野大镖客 2 |
</Route>
## 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}
<Route author="15x15G" example="/sega/pjsekai/news" path="/sega/pjsekai/news" />
## Steam {#steam}
### Steam search {#steam-steam-search}
@@ -867,12 +873,6 @@ Example`https://www.iyingdi.com/tz/people/55547` id 是 `55547`
| 1 | 3 |
</Route>
## 世界计划 多彩舞台 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}
<Route author="15x15G" example="/pjsk/news" path="/pjsk/news" />
## 完美世界电竞 {#wan-mei-shi-jie-dian-jing}
### 资讯列表 {#wan-mei-shi-jie-dian-jing-zi-xun-lie-biao}