diff --git a/src/all/myreadingmanga/build.gradle b/src/all/myreadingmanga/build.gradle index 3286a3d83..dc71bb938 100644 --- a/src/all/myreadingmanga/build.gradle +++ b/src/all/myreadingmanga/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'MyReadingManga' pkgNameSuffix = 'all.myreadingmanga' extClass = '.MyReadingMangaFactory' - extVersionCode = 48 + extVersionCode = 49 isNsfw = true } diff --git a/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt b/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt index 5ffee4c8e..6cae87895 100644 --- a/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt +++ b/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt @@ -108,12 +108,14 @@ open class MyReadingManga(override val lang: String, private val siteLang: Strin private val extensionRegex = Regex("""\.(jpg|png|jpeg|webp)""") - private fun getImage(element: Element): String { - return when { + private fun getImage(element: Element): String? { + val url = when { element.attr("data-src").contains(extensionRegex) -> element.attr("abs:data-src") element.attr("src").contains(extensionRegex) -> element.attr("abs:src") else -> element.attr("abs:data-lazy-src") } + + return if (URLUtil.isValidUrl(url)) url else null } // removes resizing @@ -151,7 +153,7 @@ open class MyReadingManga(override val lang: String, private val siteLang: Strin val scanlatedBy = document.select(".entry-terms:has(a[href*=group])").firstOrNull() ?.select("a[href*=group]")?.joinToString(prefix = "Scanlated by: ") { it.text() } val extendedDescription = document.select(".entry-content p:not(p:containsOwn(|)):not(.chapter-class + p)").joinToString("\n") { it.text() } - description = listOfNotNull(basicDescription, scanlatedBy, extendedDescription).joinToString("\n") + description = listOfNotNull(basicDescription, scanlatedBy, extendedDescription).joinToString("\n").trim() status = when (document.select("a[href*=status]").first()?.text()) { "Ongoing" -> SManga.ONGOING "Completed" -> SManga.COMPLETED @@ -218,7 +220,7 @@ open class MyReadingManga(override val lang: String, private val siteLang: Strin override fun pageListParse(document: Document): List { return (document.select("div img") + document.select("div.separator img[data-src]")) - .map { getImage(it) } + .mapNotNull { getImage(it) } .distinct() .mapIndexed { i, url -> Page(i, "", url) } }