style: auto format
This commit is contained in:
+9
-7
@@ -223,13 +223,15 @@ for (const namespace in namespaces) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const sortedRoutes = Object.entries(namespaceData.apiRoutes) as Array<[
|
||||
string,
|
||||
APIRoute & {
|
||||
location: string;
|
||||
module?: () => Promise<{ apiRoute: APIRoute }>;
|
||||
},
|
||||
]>;
|
||||
const sortedRoutes = Object.entries(namespaceData.apiRoutes) as Array<
|
||||
[
|
||||
string,
|
||||
APIRoute & {
|
||||
location: string;
|
||||
module?: () => Promise<{ apiRoute: APIRoute }>;
|
||||
},
|
||||
]
|
||||
>;
|
||||
|
||||
for (const [path, routeData] of sortedRoutes) {
|
||||
const wrappedHandler: Handler = async (ctx) => {
|
||||
|
||||
@@ -43,14 +43,12 @@ export interface Work {
|
||||
}>;
|
||||
playlistStatus: any;
|
||||
price: number;
|
||||
rank:
|
||||
| Array<{
|
||||
category: string;
|
||||
rank: number;
|
||||
rank_date: string;
|
||||
term: string;
|
||||
}>
|
||||
| null;
|
||||
rank: Array<{
|
||||
category: string;
|
||||
rank: number;
|
||||
rank_date: string;
|
||||
term: string;
|
||||
}> | null;
|
||||
rate_average_2dp: number | number;
|
||||
rate_count: number;
|
||||
rate_count_detail: Array<{
|
||||
|
||||
@@ -51,7 +51,7 @@ async function handler(ctx: Context) {
|
||||
|
||||
const $ = load(response);
|
||||
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt((ctx.req.query('limit') as string)) : 20;
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit') as string) : 20;
|
||||
|
||||
const list =
|
||||
type === 'home'
|
||||
|
||||
@@ -27,7 +27,7 @@ export const route: Route = {
|
||||
async function handler(ctx): Promise<Data> {
|
||||
const { id } = ctx.req.param();
|
||||
const html = await ofetch(`https://javtiful.com/actress/${id}`);
|
||||
const $ = load((html as string));
|
||||
const $ = load(html as string);
|
||||
const items: DataItem[] = $('section .card:not(:has(.bg-danger))')
|
||||
.toArray()
|
||||
.map((item) => parseItems($(item)));
|
||||
|
||||
@@ -27,7 +27,7 @@ export const route: Route = {
|
||||
async function handler(ctx): Promise<Data> {
|
||||
const { id } = ctx.req.param();
|
||||
const html = await ofetch(`https://javtiful.com/channel/${id}`);
|
||||
const $ = load((html as string));
|
||||
const $ = load(html as string);
|
||||
const items: DataItem[] = $('section .card:not(:has(.bg-danger))')
|
||||
.toArray()
|
||||
.map((item) => parseItems($(item)));
|
||||
|
||||
@@ -31,7 +31,7 @@ async function handler(ctx): Promise<Data> {
|
||||
},
|
||||
});
|
||||
|
||||
const $ = load((html as string));
|
||||
const $ = load(html as string);
|
||||
const items: DataItem[] = $('li')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
|
||||
@@ -28,12 +28,10 @@ export interface ArticleDetailResponse {
|
||||
subtitle: string;
|
||||
content: string;
|
||||
editionName: string;
|
||||
picList:
|
||||
| null
|
||||
| Array<{
|
||||
url: string;
|
||||
picText: string;
|
||||
}>;
|
||||
picList: null | Array<{
|
||||
url: string;
|
||||
picText: string;
|
||||
}>;
|
||||
periodTime: string;
|
||||
author: string;
|
||||
};
|
||||
|
||||
@@ -58,7 +58,7 @@ const testFetchArticleFinishArticleItem = async (path: string, { setMpNameAsAuth
|
||||
|
||||
const ToBeFinishedArticleItem = { link: httpUrl };
|
||||
const expectedFinishedArticleItem = { ...fetchArticleItem };
|
||||
expectedFinishedArticleItem.author = setMpNameAsAuthor ? expectedFinishedArticleItem.mpName as string : expectedFinishedArticleItem.author;
|
||||
expectedFinishedArticleItem.author = setMpNameAsAuthor ? (expectedFinishedArticleItem.mpName as string) : expectedFinishedArticleItem.author;
|
||||
expectedFinishedArticleItem.link = skipLink ? ToBeFinishedArticleItem.link : expectedFinishedArticleItem.link;
|
||||
|
||||
const finishedArticleItem = await finishArticleItem(ToBeFinishedArticleItem, setMpNameAsAuthor, skipLink);
|
||||
|
||||
@@ -356,7 +356,7 @@ const fixArticleContent = (html?: string | Cheerio<Element>, skipImg = false) =>
|
||||
const dataSrc = $iframe.attr('data-src') as string;
|
||||
const srcUrlObj = new URL(dataSrc);
|
||||
if (srcUrlObj.host === 'v.qq.com' && srcUrlObj.searchParams.has('vid')) {
|
||||
const newSrc = genVideoSrc((srcUrlObj.searchParams.get('vid') as string));
|
||||
const newSrc = genVideoSrc(srcUrlObj.searchParams.get('vid') as string);
|
||||
$iframe.attr('src', newSrc);
|
||||
$iframe.removeAttr('data-src');
|
||||
const width = $iframe.attr('data-w');
|
||||
@@ -576,7 +576,7 @@ const redirectHelper = async (url: string, maxRedirects: number = 5) => {
|
||||
} else if (maxRedirects <= 0) {
|
||||
error('too many redirects', url);
|
||||
}
|
||||
return await redirectHelper((raw.headers.get('location') as string), maxRedirects);
|
||||
return await redirectHelper(raw.headers.get('location') as string, maxRedirects);
|
||||
}
|
||||
return raw;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user