Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(route): 新增 米游社 - 同人榜 路由 #13153

Merged
merged 40 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
2b00143
feat(route): 添加 百度股市通
CaoMeiYouRen Sep 16, 2022
b241d55
fix: 修改 百度股市通 路径
CaoMeiYouRen Sep 17, 2022
045d96b
docs: 添加 百度股市通 文档
CaoMeiYouRen Sep 17, 2022
2b40d07
Merge branch 'master' of https://github.com/DIYgod/RSSHub
CaoMeiYouRen Sep 17, 2022
4f7cb14
feat: 添加 radar 支持
CaoMeiYouRen Sep 17, 2022
ae6b2d5
fix: 按字母顺序插入新路由
CaoMeiYouRen Sep 17, 2022
9d12df1
Merge branch 'master' of https://github.com/DIYgod/RSSHub
CaoMeiYouRen Dec 18, 2022
f94d8ea
feat(route): 新增 腾讯新闻 - 新型冠状病毒肺炎疫情实时追踪
CaoMeiYouRen Dec 18, 2022
d627e13
fix: 优化 腾讯新闻 - 新型冠状病毒肺炎疫情实时追踪 的标题
CaoMeiYouRen Dec 18, 2022
5fe715e
fix: 修复 腾讯新闻 - 新型冠状病毒肺炎疫情实时追踪 部分情况下的非空判断
CaoMeiYouRen Dec 18, 2022
31e2492
fix: 修复 地区名称标题的问题
CaoMeiYouRen Dec 18, 2022
709e76e
fix: 腾讯新闻 - 新型冠状病毒肺炎疫情实时追踪 的 guid 增加 pubDate
CaoMeiYouRen Dec 18, 2022
cf7fbc8
fix: 修复 腾讯新闻 - 新型冠状病毒肺炎疫情实时追踪 guid 中添加 pubDate
CaoMeiYouRen Dec 19, 2022
9d1170d
fix: 修改 腾讯新闻 - 新型冠状病毒肺炎疫情实时追踪 的 title
CaoMeiYouRen Dec 19, 2022
9532396
Merge branch 'master' of https://github.com/DIYgod/RSSHub
CaoMeiYouRen Dec 20, 2022
e530f19
Merge branch 'master' of https://github.com/DIYgod/RSSHub
CaoMeiYouRen Jan 23, 2023
0f6fc19
feat(route): 修复 HelloGitHub 的 月刊 路由
CaoMeiYouRen Jan 23, 2023
4231951
fix: remove guid
CaoMeiYouRen Jan 23, 2023
405c1a7
Merge branch 'master' of https://github.com/DIYgod/RSSHub
CaoMeiYouRen Feb 26, 2023
7457d80
feat(route): 新增 bilibili 热搜
CaoMeiYouRen Feb 26, 2023
a132624
feat(route): 完善 bilibili热搜 的 radar
CaoMeiYouRen Feb 26, 2023
9d32ef9
fix: 优化 bilibili热搜 list 的非空判断
CaoMeiYouRen Feb 26, 2023
c924001
Merge branch 'DIYgod:master' into master
CaoMeiYouRen Jun 8, 2023
9349554
fix: 修复 bilibili热搜路由失效
CaoMeiYouRen Jun 8, 2023
3319b31
fix(route): 修复 bilibili热搜路由 的校验逻辑计算
CaoMeiYouRen Jun 8, 2023
2bbb707
Merge branch 'DIYgod:master' into master
CaoMeiYouRen Aug 25, 2023
1a9e73b
fix: 优化 bilibili/utils 的 addVerifyInfo 逻辑
CaoMeiYouRen Aug 25, 2023
d33942f
feat(route): bilibili 动态中的视频链接默认改为 BV 号并增加配置参数;修改 专栏显示全文 的参数来源
CaoMeiYouRen Aug 25, 2023
6cac87d
fix(route): 修复 fulltext 来源错误;修复 addVerifyInfo 逻辑错误
CaoMeiYouRen Aug 25, 2023
8ca27ce
fix(route): 移除不必要的参数
CaoMeiYouRen Aug 25, 2023
b15a37e
Merge branch 'DIYgod:master' into master
CaoMeiYouRen Aug 29, 2023
4a3c2fa
feat(route): 新增 米游社 - 同人榜 路由
CaoMeiYouRen Aug 29, 2023
dce014e
fix: 修复 崩坏二 默认排行榜类型错误;修复 art 模板路径错误
CaoMeiYouRen Aug 29, 2023
9cd3230
fix: 提取 静态数据;优化入参形式
CaoMeiYouRen Aug 29, 2023
8efb594
fix(docs): 更新 bilibili 文档
CaoMeiYouRen Aug 30, 2023
f57f162
docs(docs): 修复 掘金文档错误
CaoMeiYouRen Aug 30, 2023
d02c9a8
fix(route): 修复 参数风格问题;修改 query 的处理
CaoMeiYouRen Aug 30, 2023
ae82bc5
docs(docs): 回退 last_id
CaoMeiYouRen Aug 30, 2023
603327f
Merge pull request #293 from DIYgod/master
pull[bot] Aug 30, 2023
6ecf333
Merge pull request #295 from DIYgod/master
pull[bot] Aug 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/v2/bilibili/maintainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = {
'/user/channel/:uid/:sid/:disableEmbed?': ['weirongxu'],
'/user/coin/:uid/:disableEmbed?': ['DIYgod'],
'/user/collection/:uid/:sid/:disableEmbed?': ['shininome'],
'/user/dynamic/:uid/:routeParams?': ['DIYgod', 'zytomorrow', 'JimenezLi'],
'/user/dynamic/:uid/:routeParams?': ['DIYgod', 'zytomorrow', 'CaoMeiYouRen', 'JimenezLi'],
'/user/fav/:uid/:disableEmbed?': ['DIYgod'],
'/user/followers/:uid/:loginUid': ['Qixingchen'],
'/user/followings/:uid/:loginUid': ['Qixingchen'],
Expand Down
106 changes: 106 additions & 0 deletions lib/v2/mihoyo/bbs/img-ranking.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
const got = require('@/utils/got');
const { art } = require('@/utils/render');
const path = require('path');
const { parseDate } = require('@/utils/parse-date');
const { DATA_MAP, RANKING_TYPE_MAP } = require('./static-data');

const renderDescription = (description, images) => art(path.join(__dirname, '../templates/description.art'), { description, images });

const getGameInfo = (game) => ({
gids: DATA_MAP[game]?.gids,
title: DATA_MAP[game]?.title,
});
const getForumInfo = (game, forum_type) => {
forum_type = forum_type || DATA_MAP[game]?.default_forum || 'tongren';
const forum = DATA_MAP[game]?.forums?.[forum_type];
return {
forum_id: forum?.forum_id,
title: `${forum?.title}榜`,
};
};
const getCateInfo = (game, forum_type, cate_type) => {
forum_type = forum_type || DATA_MAP[game]?.default_forum || 'tongren';
const forum = DATA_MAP[game]?.forums?.[forum_type];
const default_cate = forum?.default_cate;
if (!default_cate) {
return {
title: '',
cate_id: '0',
};
}
cate_type = cate_type || default_cate;
return {
title: `${forum?.cates?.[cate_type]?.title}榜`,
cate_id: forum?.cates?.[cate_type]?.cate_id,
};
};
const getRankingTypeInfo = (game, ranking_type) => {
ranking_type = ranking_type || DATA_MAP[game]?.default_ranking_type || 'daily';
return {
id: RANKING_TYPE_MAP[ranking_type]?.id,
title: RANKING_TYPE_MAP[ranking_type]?.title,
};
};

module.exports = async (ctx) => {
const { game } = ctx.params;
const routeParams = Object.fromEntries(new URLSearchParams(ctx.params.routeParams));
const { forumType: forum_type = 'tongren', cateType: cate_type, rankingType: ranking_type, lastId: last_id = '' } = routeParams;
const page_size = ctx.query.limit || '20';
const { gids, title: game_title } = getGameInfo(game);
if (!gids) {
throw new Error('未知的游戏!');
}
const { forum_id, title: forum_title } = getForumInfo(game, forum_type);
if (!forum_id) {
throw new Error(`${game_title} 的排行榜不存在!`);
}
const { cate_id, title: cate_title } = getCateInfo(game, forum_type, cate_type);
const { id: type, title: type_title } = getRankingTypeInfo(game, ranking_type);
const query = new URLSearchParams({
gids,
forum_id,
cate_id,
type,
page_size,
last_id,
}).toString();
const url = `https://bbs-api.miyoushe.com/post/wapi/getImagePostList?${query}`;
const response = await got({
method: 'get',
url,
});
const list = response?.data?.data?.list;
if (!list) {
throw new Error('未获取到数据!');
}
const title = `米游社-${game_title}-${forum_title}${cate_title ? `-${cate_title}` : ''}-${type_title}`;
const items = list.map((e) => {
const author = e.user.nickname;
const title = e.post.subject;
const link = `https://bbs.mihoyo.com/ys/article/${e.post.post_id}`;
let describe = e.post.content || '';
try {
describe = JSON.parse(e.post.content).describe;
} catch (error) {
if (!(error instanceof SyntaxError)) {
throw error;
}
}
const description = renderDescription(describe || '', [e.post.cover, ...e.post.images]);
const pubDate = parseDate(e.post.created_at * 1000);
return {
author,
title,
link,
description,
pubDate,
};
});
const data = {
title,
link: url,
item: items,
};
ctx.state.data = data;
};
File renamed without changes.
137 changes: 137 additions & 0 deletions lib/v2/mihoyo/bbs/static-data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
// 排行榜基本数据
const DATA_MAP = {
bh2: {
title: '崩坏学园2',
gids: 3,
default_forum: 'tongren',
default_ranking_type: 'weekly',
forums: {
tongren: {
title: '同人',
forum_id: 40,
},
},
},
bh3: {
title: '崩坏3',
gids: 1,
default_forum: 'tongren',
forums: {
tongren: {
title: '同人',
forum_id: 4,
default_cate: 'illustration',
cates: {
comic: {
title: '漫画',
cate_id: 3,
},
illustration: {
title: '插画',
cate_id: 4,
},
cos: {
title: 'COS',
cate_id: 17,
},
},
},
},
},
ys: {
title: '原神',
gids: 2,
default_forum: 'tongren',
forums: {
tongren: {
title: '同人',
forum_id: 29,
default_cate: 'illustration',
cates: {
manual: {
title: '手工',
cate_id: 1,
},
qute: {
title: 'Q版',
cate_id: 2,
},
comic: {
title: '漫画',
cate_id: 3,
},
illustration: {
title: '插画',
cate_id: 4,
},
},
},
cos: {
title: 'COS',
forum_id: 49,
},
},
},
wd: {
title: '未定事件簿',
gids: 4,
default_forum: 'tongren',
forums: {
tongren: {
title: '同人',
forum_id: 38,
},
},
},
sr: {
title: '崩坏:星穹铁道',
gids: 6,
default_forum: 'tongren',
forums: {
tongren: {
title: '同人',
forum_id: 56,
},
},
},
zzz: {
title: '绝区零',
gids: 8,
},
dby: {
title: '大别野',
gids: 5,
default_forum: 'tongren',
forums: {
tongren: {
title: '同人',
forum_id: 39,
},
cos: {
title: 'COS',
forum_id: 47,
},
},
},
};

// 排行榜分类
const RANKING_TYPE_MAP = {
daily: {
id: 1,
title: '日榜',
},
weekly: {
id: 2,
title: '周榜',
},
monthly: {
id: 3,
title: '月榜',
},
};

module.exports = {
DATA_MAP,
RANKING_TYPE_MAP,
};
1 change: 1 addition & 0 deletions lib/v2/mihoyo/maintainer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
'/bbs/img-ranking/:game/:routeParams?': ['CaoMeiYouRen'],
'/bbs/official/:gids/:type?/:page_size?/:last_id?': ['CaoMeiYouRen'],
'/sr/:location?/:category?': ['shinanory'],
'/ys/:location?/:category?': ['nczitzk'],
Expand Down
8 changes: 7 additions & 1 deletion lib/v2/mihoyo/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ module.exports = {
'mihoyo.com': {
_name: '米哈游',
bbs: [
{
title: '米游社 - 同人榜',
docs: 'https://docs.rsshub.app/routes/game#mi-ha-you',
source: '/:game/imgRanking/:forum_id/:ranking_id/:cate_id',
target: `/mihoyo/bbs/img-ranking/:game`,
},
{
title: '米游社 - 官方公告',
docs: 'https://docs.rsshub.app/routes/game#mi-ha-you-mi-you-she-guan-fang-gong-gao',
docs: 'https://docs.rsshub.app/routes/game#mi-ha-you',
source: ['/:game/home/28', '/:game/home/6', '/:game/home/31', '/:game/home/33', '/:game/home/53', '/:game/home/58'],
target: (params, url) => {
const GITS_MAP = {
Expand Down
3 changes: 2 additions & 1 deletion lib/v2/mihoyo/router.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = function (router) {
router.get('/bbs/official/:gids/:type?/:page_size?/:last_id?', require('./bbs'));
router.get('/bbs/img-ranking/:game/:routeParams?', require('./bbs/img-ranking'));
router.get('/bbs/official/:gids/:type?/:page_size?/:last_id?', require('./bbs/official'));
router.get('/sr/:location?/:category?', require('./sr/news'));
router.get('/ys/:location?/:category?', require('./ys/news'));
};
46 changes: 46 additions & 0 deletions website/docs/routes/game.md
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,52 @@ Example:`https://www.iyingdi.com/tz/people/55547` ,id 是 `55547`

</Route>

### 米游社 - 同人榜 {#mi-ha-you-mi-you-she---tong-ren-bang}

<Route author="CaoMeiYouRen" example="/mihoyo/bbs/img-ranking/ys/forumType=tongren&cateType=illustration&rankingType=daily" path="/bbs/img-ranking/:game/:routeParams?" paramsDesc={['游戏缩写','额外参数;请参阅以下说明和表格']} radar="1">

| 键 | 含义 | 接受的值 | 默认值 |
| ----------- | ----------------------------------- | ------------------------------------------------------------ | ------------ |
| forumType | 主榜类型(仅原神、大别野有cos主榜) | tongren/cos | tongren |
| cateType | 子榜类型(仅崩坏三、原神有子榜) | 崩坏三:illustration/comic/cos;原神:illustration/comic/qute/manual | illustration |
| rankingType | 排行榜类型(崩坏二没有日榜) | daily/weekly/monthly | daily |
| lastId | 当前页id(用于分页) | 数字 | 1 |

游戏缩写(目前绝区零还没有同人榜

| 崩坏三 | 原神 | 崩坏二 | 未定事件簿 | 星穹铁道 | 大别野 |
| ------ | ---- | ------ | ---------- | -------- | ------ |
| bh3 | ys | bh2 | wd | sr | dby |

主榜类型

| 同人榜 | COS榜 |
| ------- | ----- |
| tongren | cos |

子榜类型

崩坏三 子榜

| 插画 | 漫画 | COS |
| ------------ | ----- | ---- |
| illustration | comic | cos |


原神 子榜

| 插画 | 漫画 | Q版 | 手工 |
| ------------ | ----- | ---- | ------ |
| illustration | comic | qute | manual |

排行榜类型

| 日榜 | 周榜 | 月榜 |
| ----- | ------ | ------- |
| daily | weekly | monthly |

</Route>

### 米游社 - 官方公告 {#mi-ha-you-mi-you-she---guan-fang-gong-gao}

<Route author="CaoMeiYouRen" example="/mihoyo/bbs/official/2/3/20/" path="/bbs/official/:gids/:type?/:page_size?/:last_id?" paramsDesc={['游戏id','公告类型,默认为 2(即 活动)','分页大小,默认为 20 ','跳过的公告数,例如指定为 40 就是从第 40 条公告开始,可用于分页']} radar="1">
Expand Down
2 changes: 1 addition & 1 deletion website/docs/routes/programming.md
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ Stay up to date on the latest React news, tutorials, resources, and more. Delive

</Route>

### 用户专栏 {#jue-jin-yong-hu-zhuan-lan}
### 用户文章 {#jue-jin-yong-hu-wen-zhang}

<Route author="Maecenas" example="/juejin/posts/3051900006845944" path="/juejin/posts/:id" paramsDesc={['用户 id, 可在用户页 URL 中找到']} radar="1" rssbud="1"/>

Expand Down
2 changes: 1 addition & 1 deletion website/docs/routes/social-media.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性

### UP 主动态 {#bilibili-up-zhu-dong-tai}

<Route author="DIYgod zytomorrow JimenezLi" example="/bilibili/user/dynamic/2267573" path="/bilibili/user/dynamic/:uid/:routeParams?" paramsDesc={['用户 id, 可在 UP 主主页中找到', '额外参数;请参阅以下说明和表格']} radar="1" rssbud="1">
<Route author="DIYgod zytomorrow CaoMeiYouRen JimenezLi" example="/bilibili/user/dynamic/2267573" path="/bilibili/user/dynamic/:uid/:routeParams?" paramsDesc={['用户 id, 可在 UP 主主页中找到', '额外参数;请参阅以下说明和表格']} radar="1" rssbud="1">

| 键 | 含义 | 接受的值 | 默认值 |
| -- | ---- | ------- | ------ |
Expand Down
Loading