Skip to content

Commit

Permalink
feat(route): add more popular acg routes
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudoyu committed Oct 25, 2024
1 parent 1d63753 commit 4aa40e5
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 22 deletions.
32 changes: 29 additions & 3 deletions lib/routes/acfun/article.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import cache from '@/utils/cache';
import got from '@/utils/got';
import { load } from 'cheerio';
Expand Down Expand Up @@ -37,9 +37,35 @@ const timeRangeEnum = new Set(['all', 'oneDay', 'threeDay', 'oneWeek', 'oneMonth

export const route: Route = {
path: '/article/:categoryId/:sortType?/:timeRange?',
categories: ['anime'],
categories: ['anime', 'popular'],
view: ViewType.Articles,
example: '/acfun/article/110',
parameters: { categoryId: '分区 ID,见下表', sortType: '排序,见下表,默认为 `createTime`', timeRange: '时间范围,见下表,仅在排序是 `hotScore` 有效,默认为 `all`' },
parameters: {
categoryId: {
description: '分区 ID',
options: Object.keys(categoryMap).map((id) => ({ value: id, label: categoryMap[id].title })),
},
sortType: {
description: '排序',
options: [
{ value: 'createTime', label: '最新发表' },
{ value: 'lastCommentTime', label: '最新动态' },
{ value: 'hotScore', label: '最热文章' },
],
default: 'createTime',
},
timeRange: {
description: '时间范围,仅在排序是 `hotScore` 有效',
options: [
{ value: 'all', label: '时间不限' },
{ value: 'oneDay', label: '24 小时' },
{ value: 'threeDay', label: '三天' },
{ value: 'oneWeek', label: '一周' },
{ value: 'oneMonth', label: '一个月' },
],
default: 'all',
},
},
features: {
requireConfig: false,
requirePuppeteer: false,
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/acfun/bangumi.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import got from '@/utils/got';
import { parseDate } from '@/utils/parse-date';

export const route: Route = {
path: '/bangumi/:id',
categories: ['anime'],
categories: ['anime', 'popular'],
view: ViewType.Videos,
example: '/acfun/bangumi/5022158',
parameters: { id: '番剧 id' },
features: {
Expand Down
6 changes: 4 additions & 2 deletions lib/routes/acfun/video.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import got from '@/utils/got';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
Expand All @@ -15,7 +15,9 @@ export const route: Route = {
parameters: {
uid: '用户 UID',
},
categories: ['anime'],
categories: ['anime', 'popular'],
example: '/acfun/user/video/6102',
view: ViewType.Videos,
maintainers: ['wdssmq'],
handler,
};
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/cngal/weekly.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);

Expand All @@ -9,7 +9,8 @@ import { parseDate } from '@/utils/parse-date';

export const route: Route = {
path: '/weekly',
categories: ['anime'],
categories: ['anime', 'popular'],
view: ViewType.Articles,
example: '/cngal/weekly',
parameters: {},
features: {
Expand Down
13 changes: 11 additions & 2 deletions lib/routes/dlsite/campaign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,18 @@ const setUrl = (info) => {

export const route: Route = {
path: '/campaign/:type/:free?',
categories: ['anime'],
categories: ['anime', 'popular'],
example: '/dlsite/campaign/home',
parameters: { type: 'Type, see table above', free: 'Free only, empty means false, other value means true' },
parameters: {
type: {
description: '类型',
options: Object.values(infos).map((info) => ({ value: info.type, label: info.name })),
},
free: {
description: '免费',
options: [{ value: '1', label: '是' }],
},
},
features: {
requireConfig: false,
requirePuppeteer: false,
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/dlsite/ci-en/article.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import cache from '@/utils/cache';
import got from '@/utils/got';
import { load } from 'cheerio';
Expand All @@ -7,7 +7,8 @@ import { parseDate } from '@/utils/parse-date';

export const route: Route = {
path: '/ci-en/:id/article',
categories: ['anime'],
categories: ['anime', 'popular'],
view: ViewType.Articles,
example: '/dlsite/ci-en/7400/article',
parameters: { id: 'Creator id, can be found in URL' },
features: {
Expand Down
12 changes: 9 additions & 3 deletions lib/routes/dlsite/new.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import got from '@/utils/got';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
Expand Down Expand Up @@ -53,9 +53,15 @@ const infos = {

export const route: Route = {
path: '/new/:type',
categories: ['anime'],
categories: ['anime', 'popular'],
view: ViewType.Articles,
example: '/dlsite/new/home',
parameters: { type: 'Type, see table below' },
parameters: {
type: {
description: '类型',
options: Object.values(infos).map((info) => ({ value: info.type, label: info.name })),
},
},
features: {
requireConfig: false,
requirePuppeteer: false,
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/dora-world/article.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route, Data, DataItem } from '@/types';
import { Route, Data, DataItem, ViewType } from '@/types';
import got from '@/utils/got';
import { load } from 'cheerio';
import cache from '@/utils/cache';
Expand All @@ -9,7 +9,8 @@ const baseUrl = 'https://www.dora-world.com';

export const route: Route = {
path: '/article/:topic/:topicId?',
categories: ['anime'],
categories: ['anime', 'popular'],
view: ViewType.Articles,
example: '/dora-world/article/contents',
parameters: {
topic: 'Topic name, can be found in URL. For example: the topic name of [https://www.dora-world.com/movie](https://www.dora-world.com/movie) is `movie`',
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/eventernote/actors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import got from '@/utils/got';
import { load } from 'cheerio';

Expand All @@ -14,7 +14,8 @@ const pageCount = 10;

export const route: Route = {
path: '/actors/:name/:id',
categories: ['anime'],
categories: ['anime', 'popular'],
view: ViewType.Videos,
example: '/eventernote/actors/三森すずこ/2634',
parameters: { name: '声优姓名', id: '声优 ID' },
features: {
Expand Down
5 changes: 3 additions & 2 deletions lib/routes/idolypride/news.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Route } from '@/types';
import { Route, ViewType } from '@/types';
import got from '@/utils/got';
import { parseDate } from '@/utils/parse-date';
import timezone from '@/utils/timezone';

export const route: Route = {
path: '/news',
categories: ['anime'],
categories: ['anime', 'popular'],
view: ViewType.Articles,
example: '/idolypride/news',
parameters: {},
features: {
Expand Down

0 comments on commit 4aa40e5

Please sign in to comment.