From bb9f90efcd96f1897eb8d7275bb7c199ee9b796a Mon Sep 17 00:00:00 2001 From: beerpsi <92439990+beerpiss@users.noreply.github.com> Date: Thu, 10 Aug 2023 00:55:36 +0700 Subject: [PATCH] Mangago: Properly parse chapter titles (#17438) --- src/en/mangago/build.gradle | 4 ++-- .../tachiyomi/extension/en/mangago/Mangago.kt | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/en/mangago/build.gradle b/src/en/mangago/build.gradle index 01b6e02b9..b6beb0dda 100644 --- a/src/en/mangago/build.gradle +++ b/src/en/mangago/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Mangago' pkgNameSuffix = 'en.mangago' extClass = '.Mangago' - extVersionCode = 12 + extVersionCode = 13 isNsfw = true } @@ -13,4 +13,4 @@ apply from: "$rootDir/common.gradle" dependencies { implementation(project(':lib-cryptoaes')) -} \ No newline at end of file +} diff --git a/src/en/mangago/src/eu/kanade/tachiyomi/extension/en/mangago/Mangago.kt b/src/en/mangago/src/eu/kanade/tachiyomi/extension/en/mangago/Mangago.kt index 8dd753fb8..71d2afb93 100644 --- a/src/en/mangago/src/eu/kanade/tachiyomi/extension/en/mangago/Mangago.kt +++ b/src/en/mangago/src/eu/kanade/tachiyomi/extension/en/mangago/Mangago.kt @@ -46,10 +46,11 @@ class Mangago : ParsedHttpSource() { .addInterceptor { chain -> val response = chain.proceed(chain.request()) - val key = - response.request.url.queryParameter("desckey") ?: return@addInterceptor response - val cols = response.request.url.queryParameter("cols")?.toIntOrNull() - ?: return@addInterceptor response + val fragment = response.request.url.fragment ?: return@addInterceptor response + + // desckey=...&cols=... + val key = fragment.substringAfter("desckey=").substringBefore("&") + val cols = fragment.substringAfter("&cols=").toIntOrNull() ?: return@addInterceptor response val image = unscrambleImage(response.body.byteStream(), key, cols) val body = image.toResponseBody("image/jpeg".toMediaTypeOrNull()) @@ -172,13 +173,14 @@ class Mangago : ParsedHttpSource() { override fun chapterListSelector() = "table#chapter_table > tbody > tr, table.uk-table > tbody > tr" override fun chapterFromElement(element: Element) = SChapter.create().apply { - val link = element.getElementsByTag("a") + val link = element.select("a.chico") setUrlWithoutDomain(link.attr("href")) name = link.text().trim() date_upload = runCatching { dateFormat.parse(element.select("td:last-child").text().trim())?.time }.getOrNull() ?: 0L + scanlator = element.selectFirst("td.no a, td.uk-table-shrink a")?.text()?.trim() } override fun pageListParse(document: Document): List { @@ -231,7 +233,7 @@ class Mangago : ParsedHttpSource() { .split(",") .mapIndexed { idx, it -> val url = if (it.contains("cspiclink")) { - "$it?desckey=${getDescramblingKey(deobfChapterJs, it)}&cols=$cols" + "$it#desckey=${getDescramblingKey(deobfChapterJs, it)}&cols=$cols" } else { it }