diff --git a/src/utils/siteList.ts b/src/utils/siteList.ts index f9ca4b9..b0ef621 100644 --- a/src/utils/siteList.ts +++ b/src/utils/siteList.ts @@ -17,7 +17,7 @@ export interface DomQuery_parser { /** 检测有无字幕的方法 * 点名:Jable */ - checkFn?: (arg: any) => boolean; + checkTextFn?: (arg: any) => boolean; } export interface DomQuery_get { @@ -76,7 +76,7 @@ export const siteList: SiteItem[] = [ domQuery: { linkQuery: `.container .detail>.title>a`, titleQuery: `.container .detail>.title>a`, - checkFn: (linkResult: string) => /-c\/$/.test(linkResult), + checkTextFn: (linkResult: string) => /-c\/$/.test(linkResult), }, method: print, }, @@ -285,8 +285,11 @@ export const siteList: SiteItem[] = [ disable: false, hostname: "javlibrary.com", url: "https://www.javlibrary.com/cn/vl_searchbyid.php?keyword={{code}}", - fetcher: "get", - domQuery: {}, + fetcher: "parser", + domQuery: { + linkQuery: ".videothumblist .video[id]:first-child>a", + titleQuery: ".videothumblist .video[id]:first-child>a>div.id", + }, method: print, }, ]; diff --git a/src/utils/xhr.ts b/src/utils/xhr.ts index 3a4649f..8272f9d 100644 --- a/src/utils/xhr.ts +++ b/src/utils/xhr.ts @@ -33,13 +33,7 @@ function videoPageParser(responseText: string, { subQuery, leakQuery, videoQuery */ function serachPageParser( responseText: string, - { - linkQuery, - titleQuery, - listIndex = 0, - spaceCode = false, - checkFn: checkTextFn, - }: DomQuery_parser, + { linkQuery, titleQuery, listIndex = 0, checkTextFn }: DomQuery_parser, siteHostName: string, CODE: string, ) { @@ -50,12 +44,13 @@ function serachPageParser( const titleNodeText = titleNode ? titleNode?.outerHTML : ""; /** 空格版本的 code */ - const formatCode = spaceCode ? CODE.replace("-", " ") : CODE; + // const formatCode = spaceCode ? CODE.replace("-", " ") : CODE; - const isSuccess = linkNode && titleNode && titleNodeText.includes(formatCode); + const isSuccess = linkNode && titleNode && titleNodeText.includes(CODE); if (isSuccess) { const targetLinkText = linkNode.href.replace(linkNode.hostname, siteHostName); + const checkResult = checkTextFn ? checkTextFn(targetLinkText) : false; const hasSubtitle = titleNodeText.includes("字幕") || titleNodeText.includes("subtitle") || checkResult;