diff --git a/docs/en/multimedia.md b/docs/en/multimedia.md
index c22533f90f..36d6b9545e 100644
--- a/docs/en/multimedia.md
+++ b/docs/en/multimedia.md
@@ -391,19 +391,27 @@ See [Directory](https://www.javlibrary.com/en/star_list.php) to view all stars.
### Search Result
-
+
### User
-
+
+
+### Search Result with specify user
+
+
### Sukebei Search Result
-
+
### Sukebei User
-
+
+
+### Sukebei search Result with specify user
+
+
## PornHub
diff --git a/docs/multimedia.md b/docs/multimedia.md
index fcea7b3268..8c3054eee8 100644
--- a/docs/multimedia.md
+++ b/docs/multimedia.md
@@ -948,19 +948,27 @@ JavDB 有多个备用域名,本路由默认使用永久域名
+
### 用户
-
+
+
+### 对指定用户进行搜索
+
+
### Sukebei 搜索结果
-
+
### Sukebei 用户
-
+
+
+### Sukebei 对指定用户进行搜索
+
+
## OneJAV
diff --git a/lib/v2/nyaa/main.js b/lib/v2/nyaa/main.js
index 46a2977abb..530c10ee14 100644
--- a/lib/v2/nyaa/main.js
+++ b/lib/v2/nyaa/main.js
@@ -11,34 +11,27 @@ module.exports = async (ctx) => {
},
});
- let currentURL;
- let currentLink;
+ const { query, username } = ctx.params;
+ let rootURL;
if (ctx.routerPath.split('/')[1] === 'sukebei') {
- const rootURL = 'https://sukebei.nyaa.si';
- const { username = 'ohys' } = ctx.params;
- const { query = '' } = ctx.params;
- if (ctx.routerPath.split('/')[2] === 'user') {
- currentURL = `${rootURL}/?page=rss&u=${username}`;
- currentLink = `${rootURL}/user/${username}`;
- } else {
- currentURL = `${rootURL}/?page=rss&c=0_0&f=0&q=${encodeURI(query)}`;
- currentLink = `${rootURL}/?f=0&c=0_0&q=${query}`;
- }
+ rootURL = 'https://sukebei.nyaa.si';
} else {
- const rootURL = 'https://nyaa.si';
- const { username = 'Tarakara168' } = ctx.params;
- const { query = '' } = ctx.params;
- if (ctx.routerPath.split('/')[1] === 'user') {
- currentURL = `${rootURL}/?page=rss&u=${username}`;
- currentLink = `${rootURL}/user/${username}`;
- } else {
- currentURL = `${rootURL}/?page=rss&c=0_0&f=0&q=${encodeURI(query)}`;
- currentLink = `${rootURL}/?f=0&c=0_0&q=${query}`;
- }
+ rootURL = 'https://nyaa.si';
}
- const feed = await parser.parseURL(currentURL);
+ let currentRSSURL = `${rootURL}/?page=rss`;
+ let currentLink = `${rootURL}/`;
+ if (username !== undefined) {
+ currentRSSURL = `${currentRSSURL}&u=${encodeURI(username)}`;
+ currentLink = `${currentLink}user/${encodeURI(username)}`;
+ }
+ if (query !== undefined) {
+ currentRSSURL = `${currentRSSURL}&q=${encodeURI(query)}`;
+ currentLink = `${currentLink}?q=${encodeURI(query)}`;
+ }
+
+ const feed = await parser.parseURL(currentRSSURL);
feed.items.map((item) => {
item.link = item.guid;
diff --git a/lib/v2/nyaa/maintainer.js b/lib/v2/nyaa/maintainer.js
index 218b51bfaf..20674e8341 100644
--- a/lib/v2/nyaa/maintainer.js
+++ b/lib/v2/nyaa/maintainer.js
@@ -1,6 +1,9 @@
module.exports = {
- '/search/:query?': ['Lava-Swimmer', 'noname1897'],
- '/sukebei/search/:query?': ['Lava-Swimmer', 'noname1897'],
- '/user/:username?': ['Lava-Swimmer', 'noname1897'],
- '/sukebei/user/:username?': ['Lava-Swimmer', 'noname1897'],
+ '/search/:query?': ['Lava-Swimmer', 'noname1776'],
+ '/user/:username?': ['Lava-Swimmer', 'noname1776'],
+ '/user/:username/search/:query?': ['Lava-Swimmer', 'noname1776'],
+
+ '/sukebei/search/:query?': ['Lava-Swimmer', 'noname1776'],
+ '/sukebei/user/:username?': ['Lava-Swimmer', 'noname1776'],
+ '/sukebei/user/:username/search/:query?': ['Lava-Swimmer', 'noname1776'],
};
diff --git a/lib/v2/nyaa/radar.js b/lib/v2/nyaa/radar.js
index 2c61e85532..b22c31c179 100644
--- a/lib/v2/nyaa/radar.js
+++ b/lib/v2/nyaa/radar.js
@@ -3,47 +3,45 @@ module.exports = {
_name: 'nyaa',
'.': [
{
- title: '搜索结果',
- docs: 'https://docs.rsshub.app/multimedia.html#nyaa-sou-suo-jie-guo',
- source: '/',
+ title: 'nyaa 的搜索结果、指定用户、指定用户的搜索结果',
+ docs: 'https://docs.rsshub.app/multimedia.html#nyaa',
+ source: ['/', '/user/:username'],
target: (params, url) => {
url = new URL(url);
- if (url.hostname.split('.')[0] === 'nyaa') {
- const searchParams = url.searchParams;
- const query = searchParams.has('q') ? searchParams.get('q') : '';
- return `/nyaa/search/${query}`;
+ const username = params.username;
+ const query = url.searchParams.get('q');
+
+ let currentURL = '/nyaa';
+ if (username !== undefined) {
+ currentURL = `${currentURL}/user/${username}`;
}
- },
- },
- {
- title: '用户',
- docs: 'https://docs.rsshub.app/multimedia.html#nyaa-yong-hu',
- source: '/user/:username',
- target: (params, url) => {
- url = new URL(url);
- if (url.hostname.split('.')[0] === 'nyaa') {
- return `/nyaa/user/${params.username}`;
+ if (query !== null) {
+ currentURL = `${currentURL}/search/${query}`;
}
+ return currentURL;
},
},
],
sukebei: [
{
- title: 'sukebei 搜索结果',
- docs: 'https://docs.rsshub.app/multimedia.html#nyaa-sukebei-sou-suo-jie-guo',
- source: '/',
+ title: 'sukebei 的搜索结果、指定用户、指定用户的搜索结果',
+ docs: 'https://docs.rsshub.app/multimedia.html#nyaa',
+ source: ['/', '/user/:username'],
target: (params, url) => {
- const searchParams = new URL(url).searchParams;
- const query = searchParams.has('q') ? searchParams.get('q') : '';
- return `/nyaa/sukebei/search/${query}`;
+ url = new URL(url);
+ const username = params.username;
+ const query = url.searchParams.get('q');
+
+ let currentURL = '/nyaa/sukebei';
+ if (username !== undefined) {
+ currentURL = `${currentURL}/user/${username}`;
+ }
+ if (query !== null) {
+ currentURL = `${currentURL}/search/${query}`;
+ }
+ return currentURL;
},
},
- {
- title: 'sukebei 用户',
- docs: 'https://docs.rsshub.app/multimedia.html#nyaa-sukebei-yong-hu',
- source: '/user/:username',
- target: (params) => `/nyaa/sukebei/user/${params.username}`,
- },
],
},
};
diff --git a/lib/v2/nyaa/router.js b/lib/v2/nyaa/router.js
index 6c4f092c2c..4db3004a1d 100644
--- a/lib/v2/nyaa/router.js
+++ b/lib/v2/nyaa/router.js
@@ -1,7 +1,9 @@
module.exports = (router) => {
router.get('/search/:query?', require('./main'));
- router.get('/sukebei/search/:query?', require('./main'));
-
router.get('/user/:username?', require('./main'));
+ router.get('/user/:username/search/:query?', require('./main'));
+
+ router.get('/sukebei/search/:query?', require('./main'));
router.get('/sukebei/user/:username?', require('./main'));
+ router.get('/sukebei/user/:username/search/:query?', require('./main'));
};