diff --git a/src/main.tsx b/src/main.tsx index ea041a5..625e708 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -6,7 +6,7 @@ import "@/style.css"; import App from "./components/App"; if (!import.meta.env.PROD) { - document.querySelectorAll("img").forEach((item) => (item.style.visibility = "hidden")); + // document.querySelectorAll("img").forEach((item) => (item.style.visibility = "hidden")); } function main() { diff --git a/src/utils/siteList.ts b/src/utils/siteList.ts index c10a3a8..6295b16 100644 --- a/src/utils/siteList.ts +++ b/src/utils/siteList.ts @@ -55,8 +55,11 @@ export interface SiteItem_parser extends SiteItemBase { // postParams: Record; // domQuery: DomQuery_parser; // } +export interface SiteItem_false extends SiteItemBase { + fetchType: "false"; +} -export type SiteItem = SiteItem_get | SiteItem_parser; +export type SiteItem = SiteItem_get | SiteItem_parser | SiteItem_false; /** 在线网站列表 */ export const siteList: SiteItem[] = [ @@ -308,11 +311,11 @@ export const siteList: SiteItem[] = [ name: "JAVLib", hostname: "javlibrary.com", url: "https://www.javlibrary.com/cn/vl_searchbyid.php?keyword={{code}}", - fetchType: "parser", - domQuery: { - linkQuery: ".videothumblist .video[id]:first-child>a", - titleQuery: ".videothumblist .video[id]:first-child>a>div.id", - }, + fetchType: "false", + // domQuery: { + // linkQuery: ".videothumblist .video[id]:first-child>a", + // titleQuery: ".videothumblist .video[id]:first-child>a>div.id", + // }, }, ]; diff --git a/src/utils/xhr.ts b/src/utils/xhr.ts index f070211..632886c 100644 --- a/src/utils/xhr.ts +++ b/src/utils/xhr.ts @@ -1,5 +1,5 @@ import { gmGet, isCaseInsensitiveEqual, isErrorCode, tagsQuery } from "./"; -import type { DomQuery_get, SiteItem, SiteItem_parser } from "./siteList"; +import type { DomQuery_get, SiteItem, SiteItem_get, SiteItem_parser } from "./siteList"; export type FetchResult = { isSuccess: boolean; @@ -87,14 +87,21 @@ type Args = { targetLink: string; CODE: string; }; -export const baseFetcher = async ({ siteItem, targetLink, CODE }: Args): Promise => { + +const baseFetcher = async ({ siteItem, targetLink, CODE }: Args): Promise => { + if (siteItem.fetchType === "false") { + return Promise.resolve({ + isSuccess: true, + resultLink: targetLink, + }); + } + try { const response = await gmGet({ url: targetLink }); if (isErrorCode(response.status)) { // 请求 404,大概是对应网站没有资源 throw Error(String(response.status)); } - if (siteItem.fetchType === "get") { // 直接 get 网页,成功,需要进一步解析 videoPage,获取字幕等信息 return { @@ -114,7 +121,7 @@ export const baseFetcher = async ({ siteItem, targetLink, CODE }: Args): Promise }; /** jable 有些域名是带 -c */ -export const javbleFetcher = async (args: Args): Promise => { +const javbleFetcher = async (args: Args): Promise => { const res = await baseFetcher(args); if (res.isSuccess) return res; const newLink = args.targetLink.slice(0, -1) + "-c/";