From c0090877facf97146aa0f849907a9339ff6a01c5 Mon Sep 17 00:00:00 2001 From: Raiyn Aydin Date: Thu, 15 Oct 2026 19:31:37 +0800 Subject: [PATCH] fix(arabic/dilartube): search via golden.rest quick_search endpoint The search call pointed at dilar.tube/api/quick_search, which now answers 404 with an HTML page, so JSON parsing failed. The site's own client posts JSON to golden.rest/api/quick_search; use that same endpoint and report non-array responses as errors instead of indexing into them. Bump version to 1.0.3. Live check: popularNovels, parseNovel and parseChapter pass. searchNovels currently fails because golden.rest answers every POST with HTTP 503 and the site's read-only message, so search is not yet verified live. --- plugins/arabic/dilartube.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/plugins/arabic/dilartube.ts b/plugins/arabic/dilartube.ts index f24158982..d068181f2 100644 --- a/plugins/arabic/dilartube.ts +++ b/plugins/arabic/dilartube.ts @@ -7,7 +7,7 @@ import { defaultCover } from '@libs/defaultCover'; class dilartube implements Plugin.PluginBase { id = 'dilartube'; name = 'dilar tube'; - version = '1.0.2'; + version = '1.0.3'; icon = 'src/ar/dilartube/icon.png'; site = 'https://golden.rest/'; @@ -153,15 +153,18 @@ class dilartube implements Plugin.PluginBase { searchTerm: string, // page: number, ): Promise { - const formData = new FormData(); - formData.append('query', searchTerm); - formData.append('includes', '["Manga","Team","Member"]'); - const response = await fetchApi('https://dilar.tube/api/quick_search', { + const response = await fetchApi(`${this.site}api/quick_search`, { method: 'POST', - body: formData, + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + query: searchTerm, + includes: ['Manga', 'Team', 'Member'], + }), }).then(r => r.json()); - const data: ApiResponse = response[0]; - return this.parseNovels(data); + if (!Array.isArray(response)) { + throw new Error(response?.error ?? 'Unexpected search response'); + } + return response[0] ? this.parseNovels(response[0]) : []; } filters: Filters | undefined = undefined;