diff --git a/assets/radar-rules.js b/assets/radar-rules.js
index 43a37b93a..e48d2f00d 100644
--- a/assets/radar-rules.js
+++ b/assets/radar-rules.js
@@ -140,24 +140,26 @@
{
title: '用户收藏',
docs: 'https://docs.rsshub.app/social-media.html#pixiv',
- source: '/bookmark.php',
- target: (params, url) => `/pixiv/user/bookmarks/${new URL(url).searchParams.get('id')}`,
+ source: '/users/:id/bookmarks/artworks',
+ target: '/pixiv/user/bookmarks/:id',
},
{
title: '用户动态',
docs: 'https://docs.rsshub.app/social-media.html#pixiv',
- source: '/member.php',
- target: (params, url) => `/pixiv/user/${new URL(url).searchParams.get('id')}`,
+ source: '/users/:id',
+ target: '/pixiv/user/:id',
},
{
title: '排行榜',
docs: 'https://docs.rsshub.app/social-media.html#pixiv',
source: '/ranking.php',
+ target: (params, url) => `/pixiv/ranking/${new URL(url).searchParams.get('mode') || 'daily'}`,
},
{
title: '关键词',
docs: 'https://docs.rsshub.app/social-media.html#pixiv',
- source: '/search.php',
+ source: ['/tags/:keyword', '/tags/:keyword/:type?'],
+ target: (params, url) => `/pixiv/search/:keyword/${new URL(url).searchParams.get('order')}/${new URL(url).searchParams.get('mode')}`,
},
{
title: '关注的新作品',
diff --git a/docs/en/social-media.md b/docs/en/social-media.md
index 473a46f23..3d49065f9 100644
--- a/docs/en/social-media.md
+++ b/docs/en/social-media.md
@@ -209,7 +209,13 @@ These feed do not include boosts (a.k.a. reblogs). RSSHub provides a feed for us
### Keyword
-
+
+
+| only not R18 | only R18 | no filter |
+| ----------------- | ------------------------- | ------------------------- |
+| safe | r18 | empty or other |
+
+
### Following timeline
diff --git a/docs/social-media.md b/docs/social-media.md
index f2fcd5725..79fb4ccf8 100644
--- a/docs/social-media.md
+++ b/docs/social-media.md
@@ -529,8 +529,13 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性
### 关键词
-
+
+| 只看非 R18 内容 | 只看 R18 内容 | 不过滤 |
+| ----------------- | ------------------------- | ------------------------- |
+| safe | r18 | 空或其他任意值 |
+
+
### 关注的新作品
diff --git a/lib/router.js b/lib/router.js
index 2785a0347..8254645f6 100644
--- a/lib/router.js
+++ b/lib/router.js
@@ -174,7 +174,7 @@ router.get('/pixiv/user/bookmarks/:id', require('./routes/pixiv/bookmarks'));
router.get('/pixiv/user/illustfollows', require('./routes/pixiv/illustfollow'));
router.get('/pixiv/user/:id', require('./routes/pixiv/user'));
router.get('/pixiv/ranking/:mode/:date?', require('./routes/pixiv/ranking'));
-router.get('/pixiv/search/:keyword/:order?/:r18?', require('./routes/pixiv/search'));
+router.get('/pixiv/search/:keyword/:order?/:mode?', require('./routes/pixiv/search'));
// pixiv-fanbox
router.get('/fanbox/:user?', require('./routes/fanbox/main'));
diff --git a/lib/routes/pixiv/ranking.js b/lib/routes/pixiv/ranking.js
index 837318e20..7d11991aa 100644
--- a/lib/routes/pixiv/ranking.js
+++ b/lib/routes/pixiv/ranking.js
@@ -32,12 +32,27 @@ const links = {
week_r18g: 'https://www.pixiv.net/ranking.php?mode=r18g',
};
+const alias = {
+ daily: 'day',
+ weekly: 'week',
+ monthly: 'month',
+ male: 'day_male',
+ female: 'day_female',
+ original: 'week_original',
+ rookie: 'week_rookie',
+ daily_r18: 'day_r18',
+ male_r18: 'day_male_r18',
+ female_r18: 'day_female_r18',
+ weekly_r18: 'week_r18',
+ r18g: 'week_r18g',
+};
+
module.exports = async (ctx) => {
if (!config.pixiv || !config.pixiv.refreshToken) {
throw 'pixiv RSS is disabled due to the lack of relevant config';
}
- const mode = ctx.params.mode;
+ const mode = alias[ctx.params.mode] ? alias[ctx.params.mode] : ctx.params.mode;
const date = ctx.params.date ? new Date(ctx.params.date) : new Date();
if (!getToken()) {
diff --git a/lib/routes/pixiv/search.js b/lib/routes/pixiv/search.js
index 174d24bb1..567f10a81 100644
--- a/lib/routes/pixiv/search.js
+++ b/lib/routes/pixiv/search.js
@@ -10,7 +10,7 @@ module.exports = async (ctx) => {
const keyword = ctx.params.keyword;
const order = ctx.params.order || 'date';
- const r18 = ctx.params.r18;
+ const mode = ctx.params.mode;
if (!getToken()) {
throw 'pixiv not login';
@@ -24,9 +24,9 @@ module.exports = async (ctx) => {
}
let illusts = response.data.illusts;
- if (r18 === '1') {
+ if (mode === 'safe' || mode === '1') {
illusts = illusts.filter((item) => item.x_restrict === 0);
- } else if (r18 === '2') {
+ } else if (mode === 'r18' || mode === '2') {
illusts = illusts.filter((item) => item.x_restrict === 1);
}