#35 Fix Mangaread parser
This commit is contained in:
@@ -49,8 +49,7 @@ class MangareadRepository(
|
|||||||
id = generateUid(href),
|
id = generateUid(href),
|
||||||
url = href,
|
url = href,
|
||||||
publicUrl = href.inContextOf(div),
|
publicUrl = href.inContextOf(div),
|
||||||
coverUrl = div.selectFirst("img").attr("data-srcset")
|
coverUrl = div.selectFirst("img").absUrl("src"),
|
||||||
.split(',').firstOrNull()?.substringBeforeLast(' ').orEmpty(),
|
|
||||||
title = summary.selectFirst("h3").text(),
|
title = summary.selectFirst("h3").text(),
|
||||||
rating = div.selectFirst("span.total_votes")?.ownText()
|
rating = div.selectFirst("span.total_votes")?.ownText()
|
||||||
?.toFloatOrNull()?.div(5f) ?: -1f,
|
?.toFloatOrNull()?.div(5f) ?: -1f,
|
||||||
@@ -148,7 +147,7 @@ class MangareadRepository(
|
|||||||
?: throw ParseException("Root not found")
|
?: throw ParseException("Root not found")
|
||||||
return root.select("div.page-break").map { div ->
|
return root.select("div.page-break").map { div ->
|
||||||
val img = div.selectFirst("img")
|
val img = div.selectFirst("img")
|
||||||
val url = img.relUrl("data-src")
|
val url = img.relUrl("src")
|
||||||
MangaPage(
|
MangaPage(
|
||||||
id = generateUid(url),
|
id = generateUid(url),
|
||||||
url = url,
|
url = url,
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ fun String.toRelativeUrl(domain: String): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Element.relUrl(attributeKey: String): String {
|
fun Element.relUrl(attributeKey: String): String {
|
||||||
val attr = attr(attributeKey)
|
val attr = attr(attributeKey).trim()
|
||||||
if (attr.isEmpty()) {
|
if (attr.isEmpty()) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user