Fix missing images in latest on MW. ()

This commit is contained in:
Alessandro Jean 2022-01-09 13:26:20 -03:00 committed by GitHub
parent 39f3a126ff
commit 5c190c4ce8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions
src/pt/mundowebtoon
build.gradle
src/eu/kanade/tachiyomi/extension/pt/mundowebtoon

View File

@ -5,7 +5,7 @@ ext {
extName = 'Mundo Webtoon' extName = 'Mundo Webtoon'
pkgNameSuffix = 'pt.mundowebtoon' pkgNameSuffix = 'pt.mundowebtoon'
extClass = '.MundoWebtoon' extClass = '.MundoWebtoon'
extVersionCode = 3 extVersionCode = 4
} }
dependencies { dependencies {

View File

@ -17,6 +17,7 @@ import okhttp3.Response
import org.jsoup.Jsoup import org.jsoup.Jsoup
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
import org.jsoup.select.Elements
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
@ -47,7 +48,7 @@ class MundoWebtoon : ParsedHttpSource() {
override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply {
title = element.select("h6.andro_product-title small").text().withoutLanguage() title = element.select("h6.andro_product-title small").text().withoutLanguage()
thumbnail_url = element.select("div.andro_product-thumb img").attr("abs:data-src") thumbnail_url = element.select("div.andro_product-thumb img").srcAttr()
setUrlWithoutDomain(element.select("div.andro_product-thumb > a").attr("abs:href")) setUrlWithoutDomain(element.select("div.andro_product-thumb > a").attr("abs:href"))
} }
@ -62,7 +63,7 @@ class MundoWebtoon : ParsedHttpSource() {
override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply { override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply {
title = element.select("h5.andro_product-title").text().withoutLanguage() title = element.select("h5.andro_product-title").text().withoutLanguage()
thumbnail_url = element.select("div.andro_product-thumb img").attr("abs:src") thumbnail_url = element.select("div.andro_product-thumb img").srcAttr()
setUrlWithoutDomain(element.select("div.andro_product-thumb > a").attr("abs:href")) setUrlWithoutDomain(element.select("div.andro_product-thumb > a").attr("abs:href"))
} }
@ -84,7 +85,7 @@ class MundoWebtoon : ParsedHttpSource() {
override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply { override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply {
title = element.select("span.andro_product-title").text().withoutLanguage() title = element.select("span.andro_product-title").text().withoutLanguage()
thumbnail_url = element.select("div.andro_product-thumb img").attr("abs:data-src") thumbnail_url = element.select("div.andro_product-thumb img").srcAttr()
setUrlWithoutDomain(element.select("div.andro_product-thumb > a").attr("abs:href")) setUrlWithoutDomain(element.select("div.andro_product-thumb > a").attr("abs:href"))
} }
@ -111,7 +112,7 @@ class MundoWebtoon : ParsedHttpSource() {
status = infoElement.select("div.BlDataItem:contains(Status) a").firstOrNull() status = infoElement.select("div.BlDataItem:contains(Status) a").firstOrNull()
?.text()?.toStatus() ?: SManga.UNKNOWN ?.text()?.toStatus() ?: SManga.UNKNOWN
description = infoElement.select("div.andro_product-excerpt").text() description = infoElement.select("div.andro_product-excerpt").text()
thumbnail_url = document.select("div.andro_product-single-thumb img").attr("abs:src") thumbnail_url = document.select("div.andro_product-single-thumb img").srcAttr()
} }
override fun chapterListSelector() = "div#CapitulosLista div.CapitulosListaItem" override fun chapterListSelector() = "div#CapitulosLista div.CapitulosListaItem"
@ -161,6 +162,9 @@ class MundoWebtoon : ParsedHttpSource() {
return GET(page.imageUrl!!, newHeaders) return GET(page.imageUrl!!, newHeaders)
} }
private fun Elements.srcAttr(): String =
attr(if (hasAttr("data-src")) "data-src" else "src")
private fun String.toDate(): Long { private fun String.toDate(): Long {
return runCatching { DATE_FORMATTER.parse(trim())?. time } return runCatching { DATE_FORMATTER.parse(trim())?. time }
.getOrNull() ?: 0L .getOrNull() ?: 0L