From c4839db8c959ae22319f365f21503a44a54a22d9 Mon Sep 17 00:00:00 2001 From: Jurangren Date: Sat, 20 Dec 2025 08:47:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=20GAL=20=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E5=88=97=E8=A1=A8=E5=8F=8A=E4=BF=AE=E5=A4=8D=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 重新对 YingZhiGuang 和 TianYouErCiYuan 平台支持 * 移除已失效或不再维护的 TaoHuaYuan(移除搜索功能) 和 Hikarinagi(网站转型) 平台。 * 修复 YouYuDeloli 平台的搜索请求,补充缺失的 submit 参数。 * 同步更新 src/platforms/gal/index.ts 中的平台导出列表。 --- src/platforms/gal/TaoHuaYuan.ts | 55 ----------------- .../gal/{Hikarinagi.ts => TianYouErCiYuan.ts} | 25 ++++---- src/platforms/gal/YingZhiGuang.ts | 59 +++++++++++++++++++ src/platforms/gal/YouYuDeloli.ts | 1 + src/platforms/gal/index.ts | 8 +-- 5 files changed, 76 insertions(+), 72 deletions(-) delete mode 100644 src/platforms/gal/TaoHuaYuan.ts rename src/platforms/gal/{Hikarinagi.ts => TianYouErCiYuan.ts} (65%) create mode 100644 src/platforms/gal/YingZhiGuang.ts diff --git a/src/platforms/gal/TaoHuaYuan.ts b/src/platforms/gal/TaoHuaYuan.ts deleted file mode 100644 index 4750270..0000000 --- a/src/platforms/gal/TaoHuaYuan.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { fetchClient } from "../../utils/httpClient"; -import type { Platform, PlatformSearchResult, SearchResultItem } from "../../types"; - -const DATA_URL = "https://peach.sslswwdx.top/page/search/index.json"; - -interface TaoHuaYuanItem { - title: string; - permalink: string; -} - -async function searchTaoHuaYuan(game: string): Promise { - const searchResult: PlatformSearchResult = { - count: 0, - items: [], - }; - - try { - const response = await fetchClient(DATA_URL); - if (!response.ok) { - throw new Error(`Failed to fetch data from ${DATA_URL}`); - } - - const data = await response.json() as TaoHuaYuanItem[]; - - const items: SearchResultItem[] = data - .filter(item => item.title.includes(game)) - .map(item => ({ - name: item.title.trim(), - url: item.permalink, - })); - - searchResult.items = items; - searchResult.count = items.length; - - } catch (error) { - if (error instanceof Error) { - searchResult.error = error.message; - } else { - searchResult.error = "An unknown error occurred"; - } - searchResult.count = -1; - } - - return searchResult; -} - -const TaoHuaYuan: Platform = { - name: "桃花源", - color: "lime", - tags: ["NoReq", "SuDrive"], - magic: false, - search: searchTaoHuaYuan, -}; - -export default TaoHuaYuan; \ No newline at end of file diff --git a/src/platforms/gal/Hikarinagi.ts b/src/platforms/gal/TianYouErCiYuan.ts similarity index 65% rename from src/platforms/gal/Hikarinagi.ts rename to src/platforms/gal/TianYouErCiYuan.ts index 5cac60c..40865be 100644 --- a/src/platforms/gal/Hikarinagi.ts +++ b/src/platforms/gal/TianYouErCiYuan.ts @@ -1,19 +1,18 @@ import { fetchClient } from "../../utils/httpClient"; import type { Platform, PlatformSearchResult, SearchResultItem } from "../../types"; -const API_URL = "https://www.hikarinagi.net/"; -const REGEX = /" class="lazyload fit-cover radius8">.*?

(?.*?)<\/a><\/h2>/gs; +const API_URL = "https://www.tiangal.com/search/"; +const REGEX = /

\s* { +async function searchTianYouErCiYuan(game: string): Promise { const searchResult: PlatformSearchResult = { count: 0, items: [], }; try { - const url = new URL(API_URL); - url.searchParams.set("s", game); - + const url = new URL(API_URL + encodeURIComponent(game)); // URL path parameter + const response = await fetchClient(url); if (!response.ok) { throw new Error(`资源平台 SearchAPI 响应异常状态码 ${response.status}`); @@ -27,7 +26,7 @@ async function searchHikarinagi(game: string): Promise { if (match.groups?.NAME && match.groups?.URL) { items.push({ name: match.groups.NAME.trim(), - url: match.groups.URL, + url: new URL(match.groups.URL, API_URL).toString(), }); } } @@ -47,12 +46,12 @@ async function searchHikarinagi(game: string): Promise { return searchResult; } -const Hikarinagi: Platform = { - name: "Hikarinagi", +const TianYouErCiYuan: Platform = { + name: "天游二次元", color: "white", - tags: ["LoginPay", "SuDrive"], - magic: false, - search: searchHikarinagi, + tags: ["LoginPay", "MixDrive"], + magic: true, + search: searchTianYouErCiYuan, }; -export default Hikarinagi; \ No newline at end of file +export default TianYouErCiYuan; \ No newline at end of file diff --git a/src/platforms/gal/YingZhiGuang.ts b/src/platforms/gal/YingZhiGuang.ts new file mode 100644 index 0000000..7a44b11 --- /dev/null +++ b/src/platforms/gal/YingZhiGuang.ts @@ -0,0 +1,59 @@ +import { fetchClient } from "../../utils/httpClient"; +import type { Platform, PlatformSearchResult, SearchResultItem } from "../../types"; + +const DATA_URL = "https://yinghu.netlify.app/search.xml"; +const BASE_URL = "https://yinghu.netlify.app"; +const REGEX = /.*?(.*?)<\/title>.*?<url>(.*?)<\/url>.*?<\/entry>/gs; + +async function searchYingZhiGuang(game: string): Promise<PlatformSearchResult> { + const searchResult: PlatformSearchResult = { + count: 0, + items: [], + }; + + try { + const response = await fetchClient(DATA_URL); + if (!response.ok) { + throw new Error(`Failed to fetch data from ${DATA_URL}`); + } + + const xmlText = await response.text(); + const matches = xmlText.matchAll(REGEX); + + const items: SearchResultItem[] = []; + for (const match of matches) { + const title = match[1]; + const urlPath = match[2]; + + if (title && urlPath && title.includes(game)) { + items.push({ + name: title.trim(), + url: BASE_URL + urlPath, + }); + } + } + + searchResult.items = items; + searchResult.count = items.length; + + } catch (error) { + if (error instanceof Error) { + searchResult.error = error.message; + } else { + searchResult.error = "An unknown error occurred"; + } + searchResult.count = -1; + } + + return searchResult; +} + +const YingZhiGuang: Platform = { + name: "萤ノ光", + color: "lime", + tags: ["NoReq", "SuDrive"], + magic: false, + search: searchYingZhiGuang, +}; + +export default YingZhiGuang; \ No newline at end of file diff --git a/src/platforms/gal/YouYuDeloli.ts b/src/platforms/gal/YouYuDeloli.ts index 9a380a0..44bd581 100644 --- a/src/platforms/gal/YouYuDeloli.ts +++ b/src/platforms/gal/YouYuDeloli.ts @@ -13,6 +13,7 @@ async function searchYouYuDeloli(game: string): Promise<PlatformSearchResult> { try { const url = new URL(API_URL); url.searchParams.set("s", game); + url.searchParams.set("submit", ''); const response = await fetchClient(url); if (!response.ok) { diff --git a/src/platforms/gal/index.ts b/src/platforms/gal/index.ts index 10ce314..936d7ee 100644 --- a/src/platforms/gal/index.ts +++ b/src/platforms/gal/index.ts @@ -7,7 +7,6 @@ import GalgameX from "./GalgameX"; import GalTuShuGuan from "./GalTuShuGuan"; import GGBases from "./GGBases"; import GGS from "./GGS"; -import Hikarinagi from "./Hikarinagi"; import JiMengACG from "./JiMengACG"; import Koyso from "./Koyso"; import KunGalgame from "./KunGalgame"; @@ -18,11 +17,12 @@ import MiaoYuanLingYu from "./MiaoYuanLingYu"; import Nysoure from "./Nysoure"; import QingJiACG from "./QingJiACG"; import ShenShiTianTang from "./ShenShiTianTang"; -import TaoHuaYuan from "./TaoHuaYuan"; +import TianYouErCiYuan from "./TianYouErCiYuan"; import TouchGal from "./TouchGal"; import VikaACG from "./VikaACG"; import WeiZhiYunPan from "./WeiZhiYunPan"; import xxacg from "./xxacg"; +import YingZhiGuang from "./YingZhiGuang"; import YouYuDeloli from "./YouYuDeloli"; import YueYao from "./YueYao"; import ZeroFive from "./ZeroFive"; @@ -39,7 +39,6 @@ const platforms: Platform[] = [ GalTuShuGuan, GGBases, GGS, - Hikarinagi, JiMengACG, Koyso, KunGalgame, @@ -50,11 +49,12 @@ const platforms: Platform[] = [ Nysoure, QingJiACG, ShenShiTianTang, - TaoHuaYuan, + TianYouErCiYuan, TouchGal, VikaACG, WeiZhiYunPan, xxacg, + YingZhiGuang, YouYuDeloli, YueYao, ZeroFive,