#35 Fix Mangaread parser

This commit is contained in:
Koitharu
2021-06-24 07:27:07 +03:00
parent 9fcc19ef7e
commit b6c50d59ed
2 changed files with 3 additions and 4 deletions

View File

@@ -49,8 +49,7 @@ class MangareadRepository(
id = generateUid(href),
url = href,
publicUrl = href.inContextOf(div),
coverUrl = div.selectFirst("img").attr("data-srcset")
.split(',').firstOrNull()?.substringBeforeLast(' ').orEmpty(),
coverUrl = div.selectFirst("img").absUrl("src"),
title = summary.selectFirst("h3").text(),
rating = div.selectFirst("span.total_votes")?.ownText()
?.toFloatOrNull()?.div(5f) ?: -1f,
@@ -148,7 +147,7 @@ class MangareadRepository(
?: throw ParseException("Root not found")
return root.select("div.page-break").map { div ->
val img = div.selectFirst("img")
val url = img.relUrl("data-src")
val url = img.relUrl("src")
MangaPage(
id = generateUid(url),
url = url,

View File

@@ -80,7 +80,7 @@ fun String.toRelativeUrl(domain: String): String {
}
fun Element.relUrl(attributeKey: String): String {
val attr = attr(attributeKey)
val attr = attr(attributeKey).trim()
if (attr.isEmpty()) {
return ""
}