From 8ae5456b721ad67f2abdf82343fb840bf8ca1b85 Mon Sep 17 00:00:00 2001 From: Mike <51273546+SnakeDoc83@users.noreply.github.com> Date: Tue, 1 Oct 2019 07:23:13 -0400 Subject: [PATCH] Genkan - relative URLs (#1591) Genkan - relative URLs --- src/all/genkan/build.gradle | 2 +- .../tachiyomi/extension/all/genkan/Genkan.kt | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/all/genkan/build.gradle b/src/all/genkan/build.gradle index 75d892011..cdc10e84b 100644 --- a/src/all/genkan/build.gradle +++ b/src/all/genkan/build.gradle @@ -5,7 +5,7 @@ ext { appName = 'Tachiyomi: Genkan (multiple sources)' pkgNameSuffix = 'all.genkan' extClass = '.GenkanFactory' - extVersionCode = 5 + extVersionCode = 6 libVersion = '1.2' } diff --git a/src/all/genkan/src/eu/kanade/tachiyomi/extension/all/genkan/Genkan.kt b/src/all/genkan/src/eu/kanade/tachiyomi/extension/all/genkan/Genkan.kt index 45966b970..e843b0031 100644 --- a/src/all/genkan/src/eu/kanade/tachiyomi/extension/all/genkan/Genkan.kt +++ b/src/all/genkan/src/eu/kanade/tachiyomi/extension/all/genkan/Genkan.kt @@ -62,7 +62,7 @@ abstract class Genkan( manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.text() } - manga.thumbnail_url = element.select("a.media-content").first().attr("style").substringAfter("(").substringBefore(")") + manga.thumbnail_url = styleToUrl(element.select("a.media-content").first()) return manga } @@ -84,6 +84,13 @@ abstract class Genkan( override fun searchMangaNextPageSelector() = popularMangaNextPageSelector() + // Details + + private fun styleToUrl(element: Element): String { + return element.attr("style").substringAfter("(").substringBefore(")") + .let{ if (it.startsWith("http")) it else baseUrl + it } + } + override fun mangaDetailsParse(document: Document): SManga { val infoElement = document.select("div#content").first() @@ -91,7 +98,7 @@ abstract class Genkan( manga.title = infoElement.select("h5").first().text() manga.description = document.select("div.col-lg-9").text().substringAfter("Description ").substringBefore(" Volume") - manga.thumbnail_url = document.select("div.media a").first().attr("style").substringAfter("(").substringBefore(")") + manga.thumbnail_url = styleToUrl(document.select("div.media a").first()) return manga } @@ -161,6 +168,10 @@ abstract class Genkan( override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used") + override fun imageRequest(page: Page): Request { + return if (page.imageUrl!!.startsWith("http")) GET(page.imageUrl!!, headers) else GET(baseUrl + page.imageUrl!!, headers) + } + override fun getFilterList() = FilterList() }