From 44b5b1a1b1d9f7f20c5336065f6f2f8a0478fc5f Mon Sep 17 00:00:00 2001 From: pseudoyu Date: Tue, 24 Sep 2024 20:51:17 +0800 Subject: [PATCH] fix(route): revise changba and add more popular routes --- lib/routes/changba/user.ts | 11 ++++++----- lib/routes/jike/topic.ts | 8 +++++++- lib/routes/misskey/featured-notes.ts | 5 +++-- lib/routes/misskey/user-timeline.ts | 5 +++-- lib/routes/pornhub/pornstar.ts | 1 - lib/routes/qidian/namespace.ts | 2 +- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/lib/routes/changba/user.ts b/lib/routes/changba/user.ts index db74c3e405fcbf..b0e8f58a50e3e2 100644 --- a/lib/routes/changba/user.ts +++ b/lib/routes/changba/user.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import { Route, ViewType } from '@/types'; import { getCurrentPath } from '@/utils/helpers'; const __dirname = getCurrentPath(import.meta.url); @@ -11,7 +11,8 @@ const headers = { 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Ma export const route: Route = { path: '/:userid', - categories: ['social-media'], + categories: ['social-media', 'popular'], + view: ViewType.Audios, example: '/changba/skp6hhF59n48R-UpqO3izw', parameters: { userid: '用户ID, 可在对应分享页面的 URL 中找到' }, features: { @@ -28,7 +29,7 @@ export const route: Route = { }, ], name: '用户', - maintainers: [], + maintainers: ['pseudoyu'], handler, }; @@ -101,9 +102,9 @@ async function handler(ctx) { items = items.filter(Boolean); return { - title: $('title').text(), + title: author + ' - 唱吧', link: url, - description: $('meta[name="description"]').attr('content') || $('title').text(), + description: $('meta[name="description"]').attr('content') || author + ' - 唱吧', item: items, image: authorimg, itunes_author: author, diff --git a/lib/routes/jike/topic.ts b/lib/routes/jike/topic.ts index b2d1f11fec0289..b4d401b0df09bf 100644 --- a/lib/routes/jike/topic.ts +++ b/lib/routes/jike/topic.ts @@ -12,7 +12,13 @@ export const route: Route = { categories: ['social-media', 'popular'], view: ViewType.SocialMedia, example: '/jike/topic/556688fae4b00c57d9dd46ee', - parameters: { id: '圈子 id, 可在即刻 web 端圈子页或 APP 分享出来的圈子页 URL 中找到', showUid: '是否在内容中显示用户信息,设置为 1 则开启' }, + parameters: { + id: '圈子 id, 可在即刻 web 端圈子页或 APP 分享出来的圈子页 URL 中找到', + showUid: { + description: '是否在内容中显示用户信息,设置为 1 则开启', + options: [{ value: '1', label: '显示' }], + }, + }, features: { requireConfig: false, requirePuppeteer: false, diff --git a/lib/routes/misskey/featured-notes.ts b/lib/routes/misskey/featured-notes.ts index 2891809315cb68..ac7751bba261c8 100644 --- a/lib/routes/misskey/featured-notes.ts +++ b/lib/routes/misskey/featured-notes.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import { Route, ViewType } from '@/types'; import got from '@/utils/got'; import utils from './utils'; import { config } from '@/config'; @@ -6,7 +6,8 @@ import ConfigNotFoundError from '@/errors/types/config-not-found'; export const route: Route = { path: '/notes/featured/:site', - categories: ['social-media'], + categories: ['social-media', 'popular'], + view: ViewType.SocialMedia, example: '/misskey/notes/featured/misskey.io', parameters: { site: 'instance address, domain only, without `http://` or `https://` protocol header' }, features: { diff --git a/lib/routes/misskey/user-timeline.ts b/lib/routes/misskey/user-timeline.ts index 851ade81841166..29fb2f35fc7825 100644 --- a/lib/routes/misskey/user-timeline.ts +++ b/lib/routes/misskey/user-timeline.ts @@ -1,4 +1,4 @@ -import { Route } from '@/types'; +import { Route, ViewType } from '@/types'; import utils from './utils'; import { config } from '@/config'; import ConfigNotFoundError from '@/errors/types/config-not-found'; @@ -6,7 +6,8 @@ import InvalidParameterError from '@/errors/types/invalid-parameter'; export const route: Route = { path: '/users/notes/:username', - categories: ['social-media'], + categories: ['social-media', 'popular'], + view: ViewType.SocialMedia, example: '/misskey/users/notes/support@misskey.io', parameters: { username: 'misskey username format, like support@misskey.io' }, features: { diff --git a/lib/routes/pornhub/pornstar.ts b/lib/routes/pornhub/pornstar.ts index 767cbac1146e24..e4f5a260bec2fb 100644 --- a/lib/routes/pornhub/pornstar.ts +++ b/lib/routes/pornhub/pornstar.ts @@ -34,7 +34,6 @@ export const route: Route = { }, sort: { description: 'sorting method, leave empty for `Best`', - default: 'mr', options: [ { label: 'Most Recent', diff --git a/lib/routes/qidian/namespace.ts b/lib/routes/qidian/namespace.ts index 212b22f4e2beb3..ac775134efaac5 100644 --- a/lib/routes/qidian/namespace.ts +++ b/lib/routes/qidian/namespace.ts @@ -2,5 +2,5 @@ import type { Namespace } from '@/types'; export const namespace: Namespace = { name: '起点', - url: 'book.qidian.com', + url: 'qidian.com', };