Genkan - relative URLs (#1591)

Genkan - relative URLs
This commit is contained in:
Mike 2019-10-01 07:23:13 -04:00 committed by arkon
parent 54be9e1ed4
commit 8ae5456b72
2 changed files with 14 additions and 3 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: Genkan (multiple sources)' appName = 'Tachiyomi: Genkan (multiple sources)'
pkgNameSuffix = 'all.genkan' pkgNameSuffix = 'all.genkan'
extClass = '.GenkanFactory' extClass = '.GenkanFactory'
extVersionCode = 5 extVersionCode = 6
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -62,7 +62,7 @@ abstract class Genkan(
manga.setUrlWithoutDomain(it.attr("href")) manga.setUrlWithoutDomain(it.attr("href"))
manga.title = it.text() 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 return manga
} }
@ -84,6 +84,13 @@ abstract class Genkan(
override fun searchMangaNextPageSelector() = popularMangaNextPageSelector() 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 { override fun mangaDetailsParse(document: Document): SManga {
val infoElement = document.select("div#content").first() val infoElement = document.select("div#content").first()
@ -91,7 +98,7 @@ abstract class Genkan(
manga.title = infoElement.select("h5").first().text() manga.title = infoElement.select("h5").first().text()
manga.description = document.select("div.col-lg-9").text().substringAfter("Description ").substringBefore(" Volume") 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 return manga
} }
@ -161,6 +168,10 @@ abstract class Genkan(
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used") 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() override fun getFilterList() = FilterList()
} }