From 9bfbba7d9d7e66e4c8fe06fd007abdbfe7cc8abe Mon Sep 17 00:00:00 2001 From: Alessandro Jean Date: Fri, 18 Sep 2020 23:25:22 -0300 Subject: [PATCH] =?UTF-8?q?Fix=20thumbnails=20not=20loading=20at=20Mang?= =?UTF-8?q?=C3=A1Host.=20(#4396)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pt/mangahost/build.gradle | 2 +- .../tachiyomi/extension/pt/mangahost/MangaHost.kt | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/pt/mangahost/build.gradle b/src/pt/mangahost/build.gradle index 4e30ad43f..f127ba20f 100644 --- a/src/pt/mangahost/build.gradle +++ b/src/pt/mangahost/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'MangaHost' pkgNameSuffix = 'pt.mangahost' extClass = '.MangaHost' - extVersionCode = 13 + extVersionCode = 14 libVersion = '1.2' } diff --git a/src/pt/mangahost/src/eu/kanade/tachiyomi/extension/pt/mangahost/MangaHost.kt b/src/pt/mangahost/src/eu/kanade/tachiyomi/extension/pt/mangahost/MangaHost.kt index 394f51617..0c163234c 100644 --- a/src/pt/mangahost/src/eu/kanade/tachiyomi/extension/pt/mangahost/MangaHost.kt +++ b/src/pt/mangahost/src/eu/kanade/tachiyomi/extension/pt/mangahost/MangaHost.kt @@ -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