fix async and remove .imageUrl() to add .src()
This commit is contained in:
@@ -43,12 +43,11 @@ class HentaiVNParser(context: MangaLoaderContext) : MangaParser(context, MangaSo
|
||||
|
||||
val id = docs.location().substringAfterLast("/").substringBefore("-")
|
||||
|
||||
val infoEl = webClient.httpGet("/list-info-all-mobile.php?id_anime=$id".toAbsoluteUrl(domain)).parseHtml()
|
||||
|
||||
val genreUrl = Regex(""""(list-info-theloai-mobile\.php?.+)"""").find(docs.toString())?.groupValues?.get(1)
|
||||
val genre = webClient.httpGet("https://$domain/$genreUrl").parseHtml().select("a.tag")
|
||||
val genre = async { webClient.httpGet("https://$domain/$genreUrl").parseHtml().select("a.tag") }.await()
|
||||
|
||||
val stateDoc = webClient.httpGet("/list-info-time-mobile.php?id_anime=$id".toAbsoluteUrl(domain)).parseHtml()
|
||||
val infoEl = async { webClient.httpGet("/list-info-all-mobile.php?id_anime=$id".toAbsoluteUrl(domain)).parseHtml() }.await()
|
||||
val stateDoc = async { webClient.httpGet("/list-info-time-mobile.php?id_anime=$id".toAbsoluteUrl(domain)).parseHtml() }.await()
|
||||
|
||||
manga.copy(
|
||||
altTitle = infoEl.infoText("Tên Khác:"),
|
||||
@@ -182,7 +181,7 @@ class HentaiVNParser(context: MangaLoaderContext) : MangaParser(context, MangaSo
|
||||
publicUrl = relativeUrl.toAbsoluteUrl(domain),
|
||||
rating = RATING_UNKNOWN,
|
||||
isNsfw = true,
|
||||
coverUrl = el.selectFirst("div.box-cover-2 img").imageUrl(),
|
||||
coverUrl = el.selectFirst("div.box-cover-2 img")?.src().orEmpty(),
|
||||
tags = emptySet(),
|
||||
state = null,
|
||||
author = null,
|
||||
@@ -244,17 +243,6 @@ class HentaiVNParser(context: MangaLoaderContext) : MangaParser(context, MangaSo
|
||||
}
|
||||
}
|
||||
|
||||
private fun Element?.imageUrl(): String {
|
||||
if (this == null) {
|
||||
return ""
|
||||
}
|
||||
|
||||
return attrAsRelativeUrlOrNull("data-src")
|
||||
?: attrAsRelativeUrlOrNull("data-srcset")
|
||||
?: attrAsRelativeUrlOrNull("src")
|
||||
?: ""
|
||||
}
|
||||
|
||||
private fun Element.infoText(title: String) = selectFirst("span.info:contains($title)")
|
||||
?.parent()
|
||||
?.select("span:not(.info) > a")
|
||||
|
||||
@@ -155,7 +155,7 @@ fun Element.attrOrNull(vararg names: String): String? {
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun Element.src(names: Array<String> = arrayOf("data-src", "data-cfsrc", "data-original", "data-cdn", "data-sizes", "data-lazy-src", "src")): String? {
|
||||
fun Element.src(names: Array<String> = arrayOf("data-src", "data-cfsrc", "data-original", "data-cdn", "data-sizes", "data-lazy-src", "data-srcset", "src")): String? {
|
||||
for (name in names) {
|
||||
val value = attrAsAbsoluteUrlOrNull(name)
|
||||
if (value != null) {
|
||||
|
||||
Reference in New Issue
Block a user