* refactor(route/chikubi): switch to native /feed for article URL fetching * feat: add new routes * refactor: remove decodeURIComponent * fix: Handle unescaped characters in tag URLs * chore: use '@/utils/rss-parser' instead of 'rss-parser' * chore: update description * feat(utils): add getPostById and getPostsByIdList for REST API content fetching * refactor(search): use getPostsByIdList instead of processItems * fix: Handle unescaped characters * refactor: Separate index and navigation * feat: optimize post fetching by id and add category & tag functions * refactor: use api to get posts for tags and categories * chore: directly use url * fix: use API to fetch 'best' * fix: destructure post object in map function * feat: optimize getPosts function for reusability * refactor: remove wrapper functions for getBySlug and getPostsBy
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { Route, Data } from '@/types';
|
|
import { getBySlug, getPostsBy } from './utils';
|
|
|
|
export const route: Route = {
|
|
path: '/category/:keyword',
|
|
categories: ['multimedia'],
|
|
example: '/chikubi/category/nipple-lesbian',
|
|
parameters: { keyword: 'Keyword' },
|
|
features: {
|
|
requireConfig: false,
|
|
requirePuppeteer: false,
|
|
antiCrawler: false,
|
|
supportBT: false,
|
|
supportPodcast: false,
|
|
supportScihub: false,
|
|
},
|
|
name: 'Category',
|
|
maintainers: ['SnowAgar25'],
|
|
handler,
|
|
radar: [
|
|
{
|
|
title: 'Category',
|
|
source: ['chikubi.jp/category/:keyword'],
|
|
target: '/category/:keyword',
|
|
},
|
|
],
|
|
};
|
|
|
|
async function handler(ctx): Promise<Data> {
|
|
const baseUrl = 'https://chikubi.jp';
|
|
const { keyword } = ctx.req.param();
|
|
const { id, name } = await getBySlug('category', keyword);
|
|
|
|
const items = await getPostsBy('category', id);
|
|
|
|
return {
|
|
title: `Category: ${name} - chikubi.jp`,
|
|
link: `${baseUrl}/category/${keyword}`,
|
|
item: items,
|
|
};
|
|
}
|