From 3047949b2255686078dd6c22aadef5e59d7462bc Mon Sep 17 00:00:00 2001 From: Draken <131387159+dragonx943@users.noreply.github.com> Date: Wed, 7 May 2025 14:08:31 +0700 Subject: [PATCH] [ru/grouple] Small fixes (#1761) Co-authored-by: Draken --- .github/summary.yaml | 2 +- .../parsers/site/ru/grouple/GroupleParser.kt | 24 ++++++++++++++++--- .../site/ru/grouple/MintMangaParser.kt | 4 ++++ .../parsers/site/ru/grouple/SeiMangaParser.kt | 4 ++++ .../site/ru/grouple/SelfMangaParser.kt | 4 ++++ .../parsers/site/ru/grouple/UsagiParser.kt | 4 ++++ 6 files changed, 38 insertions(+), 4 deletions(-) diff --git a/.github/summary.yaml b/.github/summary.yaml index 3d860c61..54d1056d 100644 --- a/.github/summary.yaml +++ b/.github/summary.yaml @@ -1 +1 @@ -total: 1222 +total: 1222 \ No newline at end of file diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/GroupleParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/GroupleParser.kt index 4ad4ad05..e29f247e 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/GroupleParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/GroupleParser.kt @@ -457,9 +457,15 @@ internal abstract class GroupleParser( val page = pages.getJSONArray(i) val primaryServer = page.getString(0) val url = page.getString(2) + val fullSrc = if ("$primaryServer|$serversStr|$url".contains("one-way.work")) { + // domain that does not need a token + "$primaryServer|$serversStr|${url}".substringBefore("?") + } else { + "$primaryServer|$serversStr|$url" + } MangaPage( id = generateUid(url), - url = "$primaryServer|$serversStr|$url", + url = fullSrc, preview = null, source = source, ) @@ -479,9 +485,15 @@ internal abstract class GroupleParser( val page = pages.getJSONArray(i) val primaryServer = page.getString(0) val url = page.getString(2) + val fullSrc = if ("$primaryServer|$serversStr|$url".contains("one-way.work")) { + // domain that does not need a token + "$primaryServer|$serversStr|${url}".substringBefore("?") + } else { + "$primaryServer|$serversStr|$url" + } MangaPage( id = generateUid(url), - url = "$primaryServer|$serversStr|$url", + url = fullSrc, preview = null, source = source, ) @@ -494,9 +506,15 @@ internal abstract class GroupleParser( val ja = json.getJSONArray(i) val server = ja.getString(0).ifEmpty { "https://$domain" } val url = ja.getString(2) + val fullUrl = concatUrl(server, url) MangaPage( id = generateUid(url), - url = concatUrl(server, url), + url = if (fullUrl.contains("one-way.work")) { + // domain that does not need a token + fullUrl.substringBefore("?") + } else { + fullUrl + }, preview = null, source = source, ) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/MintMangaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/MintMangaParser.kt index e2838d63..f89f9cce 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/MintMangaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/MintMangaParser.kt @@ -12,6 +12,10 @@ internal class MintMangaParser( override val configKeyDomain = ConfigKey.Domain(*domains) + override fun getRequestHeaders() = super.getRequestHeaders().newBuilder() + .add("referer", "https://$domain/") + .build() + companion object { val domains = arrayOf( diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/SeiMangaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/SeiMangaParser.kt index 6506d35c..2ecf97a6 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/SeiMangaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/SeiMangaParser.kt @@ -12,6 +12,10 @@ internal class SeiMangaParser( override val configKeyDomain = ConfigKey.Domain(*domains) + override fun getRequestHeaders() = super.getRequestHeaders().newBuilder() + .add("referer", "https://$domain/") + .build() + companion object { val domains = arrayOf( diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/SelfMangaParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/SelfMangaParser.kt index 2e0e0926..e5c3cb15 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/SelfMangaParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/SelfMangaParser.kt @@ -13,6 +13,10 @@ internal class SelfMangaParser( override val configKeyDomain = ConfigKey.Domain(*domains) + override fun getRequestHeaders() = super.getRequestHeaders().newBuilder() + .add("referer", "https://$domain/") + .build() + companion object { val domains = arrayOf( diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/UsagiParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/UsagiParser.kt index b39962a8..e37f117b 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/UsagiParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/ru/grouple/UsagiParser.kt @@ -12,6 +12,10 @@ internal class UsagiParser( override val configKeyDomain = ConfigKey.Domain(*domains) + override fun getRequestHeaders() = super.getRequestHeaders().newBuilder() + .add("referer", "https://$domain/") + .build() + companion object { val domains = arrayOf("web.usagi.one")