Fix some chapter images still not loading at MY!. (#8448)

This commit is contained in:
Alessandro Jean 2021-08-07 13:59:35 -03:00 committed by GitHub
parent f61b2e1553
commit 0120ffbb08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'MangaYabu!'
pkgNameSuffix = 'pt.mangayabu'
extClass = '.MangaYabu'
extVersionCode = 10
extVersionCode = 11
libVersion = '1.2'
}

View File

@ -55,7 +55,7 @@ class MangaYabu : ParsedHttpSource() {
val tooltip = element.select("div.card-image.mango-hover").first()!!
title = Jsoup.parse(tooltip.attr("data-tooltip")).select("span b").first()!!.text()
thumbnail_url = element.select("img").first()!!.attr("data-ezsrc")
thumbnail_url = element.selectFirst("img")!!.imgAttr()
setUrlWithoutDomain(element.attr("href"))
}
@ -72,7 +72,7 @@ class MangaYabu : ParsedHttpSource() {
override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply {
title = element.select("div.card-content h4").first()!!.text().withoutFlags()
thumbnail_url = element.select("div.card-image img").first()!!.attr("src")
thumbnail_url = element.selectFirst("div.card-image img")!!.imgAttr()
url = mapChapterToMangaUrl(element.select("div.card-image > a").first()!!.attr("href"))
}
@ -117,8 +117,7 @@ class MangaYabu : ParsedHttpSource() {
description = document.select("div.manga-info").first()!!.text()
.substringAfter(title)
.trim()
thumbnail_url = document.select("div.manga-index div.mango-hover img")!!
.attr("data-ezsrc")
thumbnail_url = document.selectFirst("div.manga-index div.mango-hover img")!!.imgAttr()
}
override fun chapterListSelector() = "div.manga-info:contains(Capítulos) div.manga-chapters div.single-chapter"
@ -132,7 +131,7 @@ class MangaYabu : ParsedHttpSource() {
override fun pageListParse(document: Document): List<Page> {
return document.select("div.image-navigator img.slideit")
.mapIndexed { i, element ->
Page(i, document.location(), element.attr("abs:src"))
Page(i, document.location(), element.imgAttr())
}
}
@ -163,6 +162,17 @@ class MangaYabu : ParsedHttpSource() {
return "/manga/" + (SLUG_EXCEPTIONS[chapterSlug] ?: chapterSlug)
}
private fun Element.imgAttr(): String {
var imageSrc = attr(if (hasAttr("data-ezsrc")) "abs:data-ezsrc" else "abs:src")
.substringBeforeLast("?")
if (imageSrc.contains("ezoimgfmt")) {
imageSrc = "https://" + imageSrc.substringAfter("ezoimgfmt/")
}
return imageSrc
}
private fun String.toDate(): Long {
return try {
DATE_FORMATTER.parse(this)?.time ?: 0L