@@ -119,15 +119,18 @@ internal abstract class KeyoappParser(
|
||||
return manga
|
||||
}
|
||||
|
||||
protected open val cover: (Element) -> String? = { div ->
|
||||
div.selectFirst("a div.bg-cover")?.styleValueOrNull("background-image")?.cssUrl()
|
||||
}
|
||||
|
||||
private fun addManga(div: Element): Manga {
|
||||
val href = div.selectFirstOrThrow("a").attrAsRelativeUrl("href")
|
||||
val cover = div.selectFirst("a div.bg-cover")
|
||||
val coverUrl = cover(div)
|
||||
return Manga(
|
||||
id = generateUid(href),
|
||||
url = href,
|
||||
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
||||
coverUrl = cover?.styleValueOrNull("background-image")?.cssUrl(),
|
||||
coverUrl = coverUrl,
|
||||
title = (div.selectFirst("h3")?.text() ?: div.selectFirst("a")?.attr("title")).orEmpty(),
|
||||
altTitles = emptySet(),
|
||||
rating = RATING_UNKNOWN,
|
||||
|
||||
@@ -1,10 +1,24 @@
|
||||
package org.koitharu.kotatsu.parsers.site.keyoapp.en
|
||||
|
||||
import org.jsoup.nodes.Element
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.model.MangaParserSource
|
||||
import org.koitharu.kotatsu.parsers.site.keyoapp.KeyoappParser
|
||||
import org.koitharu.kotatsu.parsers.util.styleValueOrNull
|
||||
import org.koitharu.kotatsu.parsers.util.cssUrl
|
||||
|
||||
@MangaSourceParser("AGSCOMICS", "AgsComics", "en")
|
||||
internal class AgsComics(context: MangaLoaderContext) :
|
||||
KeyoappParser(context, MangaParserSource.AGSCOMICS, "agrcomics.com")
|
||||
KeyoappParser(context, MangaParserSource.AGSCOMICS, "agrcomics.com") {
|
||||
|
||||
override val cover: (Element) -> String? = { div ->
|
||||
val coverDiv = div.selectFirst("div.bg-cover[style*=background-image]")
|
||||
?: div.takeIf { it.hasClass("bg-cover") && it.hasAttr("style") }
|
||||
?: div.selectFirst("[style*=background-image]")
|
||||
?: throw Exception("Element or image url not found")
|
||||
|
||||
coverDiv.styleValueOrNull("background-image")?.cssUrl()
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user