From 8e9da4e39f7ad529cd6074d9bba871562abc23aa Mon Sep 17 00:00:00 2001 From: Draken <131387159+dragonx943@users.noreply.github.com> Date: Mon, 31 Mar 2025 15:30:38 +0700 Subject: [PATCH] [Hitomi.La] Change cdn domain & fix image url logic (#1624) * [Hitomi.La] Change cdn domain & fix image url logic * [Hitomi.La] Set null for preview in getPages * [Hitomi.La] Remove unused function * [Hitomi.La] Use webp for preview images * [Hitomi.La] Fix build --- .../kotatsu/parsers/site/all/HitomiLaParser.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/HitomiLaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/HitomiLaParser.kt index ab5af543..e940de43 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/HitomiLaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/HitomiLaParser.kt @@ -31,12 +31,14 @@ import kotlin.math.min internal class HitomiLaParser(context: MangaLoaderContext) : LegacyMangaParser(context, MangaParserSource.HITOMILA) { override val configKeyDomain = ConfigKey.Domain("hitomi.la") + private val cdnDomain = "gold-usergeneratedcontent.net" + override fun onCreateConfig(keys: MutableCollection>) { super.onCreateConfig(keys) keys.add(userAgentKey) } - private val ltnBaseUrl get() = "https://${getDomain("ltn")}" + private val ltnBaseUrl get() = "https://ltn.$cdnDomain" override val availableSortOrders: Set = EnumSet.of( SortOrder.NEWEST, @@ -556,7 +558,7 @@ internal class HitomiLaParser(context: MangaLoaderContext) : LegacyMangaParser(c val imageId = imageIdFromHash(hash) val subDomain = 'a' + subdomainOffset(imageId) - "https://${getDomain("${subDomain}a")}/webp/$commonId$imageId/$hash.webp" + "https://${subDomain}tn.$cdnDomain/avifbigtn/${thumbPathFromHash(hash)}/$hash.avif" }, authors = setOfNotNull(author), publicUrl = json.getString("galleryurl").toAbsoluteUrl(domain), @@ -656,12 +658,12 @@ internal class HitomiLaParser(context: MangaLoaderContext) : LegacyMangaParser(c val hash = image.getString("hash") val commonId = commonImageId() val imageId = imageIdFromHash(hash) - val subDomain = 'a' + subdomainOffset(imageId) - + val subDomain = subdomainOffset(imageId) + 1 + val thumbSubdomain = 'a' + subdomainOffset(imageId) MangaPage( id = generateUid(hash), - url = "https://${getDomain("${subDomain}a")}/webp/$commonId$imageId/$hash.webp", - preview = "https://${getDomain("${subDomain}tn")}/webpsmalltn/${thumbPathFromHash(hash)}/$hash.webp", + url = "https://a${subDomain}.$cdnDomain/$commonId$imageId/$hash.avif", + preview = "https://${thumbSubdomain}tn.$cdnDomain/webpsmalltn/${thumbPathFromHash(hash)}/$hash.webp", source = source, ) }