fix(route/nyaa): fix Nyaa and added descriptions (#16217)

* fix(route/nyaa): fix Nyaa and added descriptions

* style(route/nyaa): adjust indentation for clarity
This commit is contained in:
camera-2018
2024-07-22 06:07:47 +08:00
committed by GitHub
parent 648a6420a6
commit ce0e081742
2 changed files with 12 additions and 3 deletions
+2 -3
View File
@@ -16,7 +16,7 @@ export const route: Route = {
supportScihub: false,
},
name: 'Search Result',
maintainers: ['Lava-Swimmer', 'noname1776'],
maintainers: ['Lava-Swimmer', 'noname1776', 'camera-2018'],
handler,
};
@@ -32,7 +32,7 @@ async function handler(ctx) {
const { query, username } = ctx.req.param();
const rootURL = ctx.routerPath.split('/')[1] === 'sukebei' ? 'https://sukebei.nyaa.si' : 'https://nyaa.si';
const rootURL = ctx.req.path.split('/')[2] === 'sukebei' ? 'https://sukebei.nyaa.si' : 'https://nyaa.si';
let currentRSSURL = `${rootURL}/?page=rss`;
let currentLink = `${rootURL}/`;
@@ -48,7 +48,6 @@ async function handler(ctx) {
const feed = await parser.parseURL(currentRSSURL);
feed.items.map((item) => {
item.link = item.guid;
item.description = item.content;
item.enclosure_url = `magnet:?xt=urn:btih:${item.infoHash}`;
item.enclosure_type = 'application/x-bittorrent';
+10
View File
@@ -3,4 +3,14 @@ import type { Namespace } from '@/types';
export const namespace: Namespace = {
name: 'Nyaa',
url: 'nyaa.si',
description: `
:::tip
The 'Nyaa' includes several routes to access different parts of the site:
1. \`/nyaa/search/:query?\` - Use this route to search for content with a specific query. For example, \`/nyaa/search/bocchi\` to search for bocchi related content.
2. \`/nyaa/user/:username?\` - Access a user's profile by their username, e.g., \`/nyaa/user/ANiTorrent\`.
3. \`/nyaa/user/:username/search/:query?\` - Search within a specific user's submissions using a query, e.g., \`/nyaa/user/ANiTorrent/search/bocchi\`.
4. \`/nyaa/sukebei/search/:query?\` - This route is for searching adult content with a specific query, e.g., \`/nyaa/sukebei/search/hentai\`.
5. \`/nyaa/sukebei/user/:username?\` - Access an adult content user's profile, e.g., \`/nyaa/sukebei/user/milannews\`.
6. \`/nyaa/sukebei/user/:username/search/:query?\` - Search within a specific user's adult content submissions, e.g., \`/nyaa/sukebei/user/milannews/search/hentai\`.
:::`,
};