From 24a45102b70ae34c2092c9ff78086f9bdf129fa3 Mon Sep 17 00:00:00 2001 From: hamedhani1998 Date: Sat, 26 Sep 2026 13:37:19 +0300 Subject: [PATCH 1/3] Add MTL Arabic (mtlarabic.com) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit مكتبة الخيال — an Arabic web-novel library. Built against lib 1.6, using the suspend API directly (the *Request/*Parse pair is deprecated and final in KeiSource). The site has no browse API: /novels and /novel-details ship their payload as a """, RegexOption.IGNORE_CASE) + +/** Pulls the first island out of an HTML page, for use as a `String.parseAs` transform. */ +fun extractIsland(html: String): String = ISLAND.find(html)?.groupValues?.get(1) + ?: throw IllegalStateException("No JSON island in the page") + +/** Parses a response body that is an HTML page with the JSON embedded in a script tag. */ +inline fun Response.parseAsIsland(json: Json = islandJson): T = parseAs(json) { extractIsland(it) } diff --git a/src/ar/mtlarabic/src/eu/kanade/tachiyomi/extension/ar/mtlarabic/MtlArabic.kt b/src/ar/mtlarabic/src/eu/kanade/tachiyomi/extension/ar/mtlarabic/MtlArabic.kt index e22a9bcc1..572077d93 100644 --- a/src/ar/mtlarabic/src/eu/kanade/tachiyomi/extension/ar/mtlarabic/MtlArabic.kt +++ b/src/ar/mtlarabic/src/eu/kanade/tachiyomi/extension/ar/mtlarabic/MtlArabic.kt @@ -12,7 +12,6 @@ import keiyoushi.annotation.Source import keiyoushi.network.get import keiyoushi.source.KeiSource import keiyoushi.utils.parseAs -import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonElement import okhttp3.HttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl @@ -23,11 +22,12 @@ private const val SORT_BY_CHAPTERS = "-num_chapters" /** * مكتبة الخيال (mtlarabic.com) — an Arabic web-novel library. * - * The site is a server-rendered Node app with no browse API: `/novels` and `/novel-details` - * ship their payload as a `