Fix thumbnails not loading at MangáHost. (#4396)

This commit is contained in:
Alessandro Jean 2020-09-18 23:25:22 -03:00 committed by GitHub
parent d7e5ab005a
commit 9bfbba7d9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'MangaHost'
pkgNameSuffix = 'pt.mangahost'
extClass = '.MangaHost'
extVersionCode = 13
extVersionCode = 14
libVersion = '1.2'
}

View File

@ -36,10 +36,13 @@ class MangaHost : ParsedHttpSource() {
.add("User-Agent", USER_AGENT)
.add("Referer", baseUrl)
private fun genericMangaFromElement(element: Element, attr: String = "src"): SManga =
private fun genericMangaFromElement(element: Element): SManga =
SManga.create().apply {
val thumbnailEl = element.select("img")
val thumbnailAttr = if (thumbnailEl.hasAttr("data-path")) "data-path" else "src"
title = element.attr("title").withoutLanguage()
thumbnail_url = element.select("img").attr(attr).toLargeUrl()
thumbnail_url = thumbnailEl.attr(thumbnailAttr).toLargeUrl()
setUrlWithoutDomain(element.attr("href").substringBeforeLast("-mh"))
}
@ -71,8 +74,7 @@ class MangaHost : ParsedHttpSource() {
override fun latestUpdatesSelector() = "div#dados div.line-lancamentos div.column-img a"
override fun latestUpdatesFromElement(element: Element): SManga =
genericMangaFromElement(element, "data-lazy-src")
override fun latestUpdatesFromElement(element: Element): SManga = genericMangaFromElement(element)
override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
@ -85,8 +87,7 @@ class MangaHost : ParsedHttpSource() {
override fun searchMangaSelector() = "table.table-search > tbody > tr > td:eq(0) > a"
override fun searchMangaFromElement(element: Element): SManga =
genericMangaFromElement(element, "data-path")
override fun searchMangaFromElement(element: Element): SManga = genericMangaFromElement(element)
override fun searchMangaNextPageSelector(): String? = null