feat(route): 新增 ASMR Online (#16027)
* feat(route): 新增 ASMR Online * null
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
import { Result, Work } from '@/routes/asmr-200/type';
|
||||
import { DataItem, Route } from '@/types';
|
||||
import ofetch from '@/utils/ofetch';
|
||||
import path from 'node:path';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { getCurrentPath } from '@/utils/helpers';
|
||||
|
||||
const render = (work: Work, link: string) => art(path.join(getCurrentPath(import.meta.url), 'templates', 'work.art'), { work, link });
|
||||
|
||||
export const route: Route = {
|
||||
path: '/works/:order?/:subtitle?/:sort?',
|
||||
categories: ['multimedia'],
|
||||
example: '/works',
|
||||
features: {
|
||||
requireConfig: false,
|
||||
requirePuppeteer: false,
|
||||
antiCrawler: true,
|
||||
supportBT: false,
|
||||
supportPodcast: false,
|
||||
supportScihub: false,
|
||||
},
|
||||
parameters: {
|
||||
order: '排序字段,默认按照资源的收录日期来排序,详见下表',
|
||||
sort: '排序方式,可选 `asc` 和 `desc` ,默认倒序',
|
||||
subtitle: '筛选带字幕音频,可选 `0` 和 `1` ,默认关闭',
|
||||
},
|
||||
radar: [
|
||||
{
|
||||
source: ['asmr-200.com'],
|
||||
target: 'asmr-200/works',
|
||||
},
|
||||
],
|
||||
name: '最新资源',
|
||||
maintainers: ['hualiong'],
|
||||
url: 'asmr-200.com',
|
||||
description: `| 发售日期 | 收录日期 | 销量 | 价格 | 评价 | 随机 | RJ号 |
|
||||
| ---- | ---- | ---- | ---- | ---- | ---- | ---- |
|
||||
| release | create_date | dl_count | price | rate_average_2dp | random | id |`,
|
||||
handler: async (ctx) => {
|
||||
const { order = 'create_date', sort = 'desc', subtitle = '0' } = ctx.req.param();
|
||||
const res = await ofetch<Result>('https://api.asmr-200.com/api/works', { query: { order, sort, page: 1, subtitle } });
|
||||
|
||||
const items: DataItem[] = res.works.map((each) => {
|
||||
const category = each.tags.map((tag) => tag.name);
|
||||
each.category = category.join(',');
|
||||
each.cv = each.vas.map((cv) => cv.name).join(',');
|
||||
return {
|
||||
title: each.title,
|
||||
image: each.mainCoverUrl,
|
||||
author: each.name,
|
||||
link: `https://asmr-200.com/work/${each.source_id}`,
|
||||
pubDate: timezone(parseDate(each.release, 'YYYY-MM-DD'), +8),
|
||||
category,
|
||||
description: render(each, `https://asmr-200.com/work/${each.source_id}`),
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
title: '最新收录 - ASMR Online',
|
||||
link: 'https://asmr-200.com/',
|
||||
language: 'zh-cn',
|
||||
item: items,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
import type { Namespace } from '@/types';
|
||||
|
||||
export const namespace: Namespace = {
|
||||
name: 'ASMR Online',
|
||||
url: 'asmr-200.com',
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
<a href="{{ link }}" title="点击进入官网查看"><img src="{{ work.mainCoverUrl }}" alt="{{ work.title }}" /></a>
|
||||
<h1>{{ work.title }} <span style="font-size: 0.6em; color: darkred;">{{ work.source_id }}</span></h1>
|
||||
<p><b>发布者:</b>{{ work.name }}</p>
|
||||
<p><b>评分:</b>{{ work.rate_average_2dp }} | <b>评论数:</b>{{ work.review_count }} | <b>总时长:</b>{{ work.duration }} | <b>音频来源:</b>{{ work.source_type }}</p>
|
||||
<p><b>价格:</b><span style="color: #f44336">{{ work.price }} JPY</span> | <b>销量:</b>{{ work.dl_count }}</p>
|
||||
<p><b>分类:</b>{{ work.category }}</p>
|
||||
<p><b>声优:</b>{{ work.cv }}</p>
|
||||
@@ -0,0 +1,96 @@
|
||||
export interface Result {
|
||||
pagination: {
|
||||
currentPage: number;
|
||||
pageSize: number;
|
||||
totalCount: number;
|
||||
};
|
||||
works: Work[];
|
||||
}
|
||||
|
||||
export interface Work {
|
||||
age_category_string: string;
|
||||
circle: {
|
||||
id: number;
|
||||
name: string;
|
||||
source_id: string;
|
||||
source_type: string;
|
||||
};
|
||||
circle_id: number;
|
||||
create_date: string;
|
||||
dl_count: number;
|
||||
duration: number;
|
||||
has_subtitle: boolean;
|
||||
id: number;
|
||||
language_editions: {
|
||||
display_order: number;
|
||||
edition_id: number;
|
||||
edition_type: string;
|
||||
label: string;
|
||||
lang: string;
|
||||
workno: string;
|
||||
}[];
|
||||
mainCoverUrl: string;
|
||||
name: string;
|
||||
nsfw: boolean;
|
||||
original_workno: null | string;
|
||||
other_language_editions_in_db: {
|
||||
id: number;
|
||||
is_original: boolean;
|
||||
lang: string;
|
||||
source_id: string;
|
||||
source_type: string;
|
||||
title: string;
|
||||
}[];
|
||||
playlistStatus: any;
|
||||
price: number;
|
||||
rank:
|
||||
| {
|
||||
category: string;
|
||||
rank: number;
|
||||
rank_date: string;
|
||||
term: string;
|
||||
}[]
|
||||
| null;
|
||||
rate_average_2dp: number | number;
|
||||
rate_count: number;
|
||||
rate_count_detail: {
|
||||
count: number;
|
||||
ratio: number;
|
||||
review_point: number;
|
||||
}[];
|
||||
release: string;
|
||||
review_count: number;
|
||||
samCoverUrl: string;
|
||||
source_id: string;
|
||||
source_type: string;
|
||||
source_url: string;
|
||||
tags: {
|
||||
i18n: any;
|
||||
id: number;
|
||||
name: string;
|
||||
}[];
|
||||
category: string;
|
||||
thumbnailCoverUrl: string;
|
||||
title: string;
|
||||
translation_info: {
|
||||
child_worknos: string[];
|
||||
is_child: boolean;
|
||||
is_original: boolean;
|
||||
is_parent: boolean;
|
||||
is_translation_agree: boolean;
|
||||
is_translation_bonus_child: boolean;
|
||||
is_volunteer: boolean;
|
||||
lang: null | string;
|
||||
original_workno: null | string;
|
||||
parent_workno: null | string;
|
||||
production_trade_price_rate: number;
|
||||
translation_bonus_langs: string[];
|
||||
};
|
||||
userRating: null;
|
||||
vas: {
|
||||
id: string;
|
||||
name: string;
|
||||
}[];
|
||||
cv: string;
|
||||
work_attributes: string;
|
||||
}
|
||||
Reference in New Issue
Block a user