From 7f8350e669228b8d260dbaaae7bea360e6f033ee Mon Sep 17 00:00:00 2001 From: bapeey <90949336+bapeey@users.noreply.github.com> Date: Thu, 25 Jan 2024 21:39:19 -0500 Subject: [PATCH] ReaperScans (en): Fix thumbnails on mobile UA (#644) Smh --- src/en/reaperscans/build.gradle | 2 +- .../extension/en/reaperscans/ReaperScans.kt | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/en/reaperscans/build.gradle b/src/en/reaperscans/build.gradle index 9def6e99d..a25ef7ec4 100644 --- a/src/en/reaperscans/build.gradle +++ b/src/en/reaperscans/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'Reaper Scans' extClass = '.ReaperScans' - extVersionCode = 47 + extVersionCode = 48 } apply from: "$rootDir/common.gradle" diff --git a/src/en/reaperscans/src/eu/kanade/tachiyomi/extension/en/reaperscans/ReaperScans.kt b/src/en/reaperscans/src/eu/kanade/tachiyomi/extension/en/reaperscans/ReaperScans.kt index 09b30678a..6f70bae16 100644 --- a/src/en/reaperscans/src/eu/kanade/tachiyomi/extension/en/reaperscans/ReaperScans.kt +++ b/src/en/reaperscans/src/eu/kanade/tachiyomi/extension/en/reaperscans/ReaperScans.kt @@ -30,6 +30,7 @@ import okhttp3.Response import org.jsoup.Jsoup import org.jsoup.nodes.Document import org.jsoup.nodes.Element +import org.jsoup.select.Elements import rx.Observable import uy.kohesive.injekt.injectLazy import java.util.Calendar @@ -67,7 +68,7 @@ class ReaperScans : ParsedHttpSource() { title = it.text() setUrlWithoutDomain(it.attr("href")) } - thumbnail_url = element.select("img").attr("abs:src") + thumbnail_url = element.select("img").imgAttr() } } @@ -84,7 +85,7 @@ class ReaperScans : ParsedHttpSource() { title = it.text().trim() setUrlWithoutDomain(it.attr("href")) } - thumbnail_url = element.select("img").attr("abs:src") + thumbnail_url = element.select("img").imgAttr() } } @@ -144,7 +145,7 @@ class ReaperScans : ParsedHttpSource() { return SManga.create().apply { setUrlWithoutDomain(element.attr("href")) element.select("img").first()?.let { - thumbnail_url = it.attr("abs:src") + thumbnail_url = it.imgAttr() } title = element.select("p").first()!!.text() } @@ -166,7 +167,7 @@ class ReaperScans : ParsedHttpSource() { // Details override fun mangaDetailsParse(document: Document): SManga { return SManga.create().apply { - thumbnail_url = document.select("div > img").first()!!.attr("abs:src") + thumbnail_url = document.select("div > img").first()!!.imgAttr() title = document.select("h1").first()!!.text() status = when (document.select("dt:contains(Release Status)").next().first()!!.text()) { @@ -326,13 +327,15 @@ class ReaperScans : ParsedHttpSource() { } } - fun Element.imgAttr(): String = when { + private fun Element.imgAttr(): String = when { hasAttr("data-lazy-src") -> attr("abs:data-lazy-src") hasAttr("data-src") -> attr("abs:data-src") hasAttr("data-cfsrc") -> attr("abs:data-cfsrc") else -> attr("abs:src") } + private fun Elements.imgAttr(): String = this.first()!!.imgAttr() + // Unused override fun searchMangaNextPageSelector() = throw UnsupportedOperationException()