|
|
|
|
@ -2,13 +2,57 @@ package org.koitharu.kotatsu.parsers.site.madara.en
|
|
|
|
|
|
|
|
|
|
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
|
|
|
|
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
|
|
|
|
import org.koitharu.kotatsu.parsers.model.MangaSource
|
|
|
|
|
import org.koitharu.kotatsu.parsers.model.*
|
|
|
|
|
import org.koitharu.kotatsu.parsers.site.madara.MadaraParser
|
|
|
|
|
import org.jsoup.nodes.Document
|
|
|
|
|
import org.koitharu.kotatsu.parsers.util.*
|
|
|
|
|
|
|
|
|
|
@MangaSourceParser("SHIBAMANGA", "ShibaManga", "en")
|
|
|
|
|
internal class ShibaManga(context: MangaLoaderContext) :
|
|
|
|
|
MadaraParser(context, MangaSource.SHIBAMANGA, "shibamanga.com") {
|
|
|
|
|
|
|
|
|
|
override val datePattern = "MM/dd/yyyy"
|
|
|
|
|
override fun parseMangaList(doc: Document): List<Manga> {
|
|
|
|
|
println(doc)
|
|
|
|
|
return doc.select("div.row.c-tabs-item__content").ifEmpty {
|
|
|
|
|
doc.select("div.page-item-detail")
|
|
|
|
|
}.map { div ->
|
|
|
|
|
val href = div.selectFirst("a")?.attrAsRelativeUrlOrNull("href") ?: div.parseFailed("Link not found")
|
|
|
|
|
val summary = div.selectFirst(".tab-summary") ?: div.selectFirst(".item-summary")
|
|
|
|
|
Manga(
|
|
|
|
|
id = generateUid(href),
|
|
|
|
|
url = href,
|
|
|
|
|
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
|
|
|
|
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
|
|
|
|
title = (summary?.selectFirst("h3") ?: summary?.selectFirst("h4")
|
|
|
|
|
?: div.selectFirst("div.post-title a"))?.text().orEmpty(),
|
|
|
|
|
altTitle = null,
|
|
|
|
|
rating = div.selectFirst("span.total_votes")?.ownText()?.toFloatOrNull()?.div(5f) ?: -1f,
|
|
|
|
|
tags = summary?.selectFirst(".mg_genres")?.select("a")?.mapNotNullToSet { a ->
|
|
|
|
|
MangaTag(
|
|
|
|
|
key = a.attr("href").removeSuffix('/').substringAfterLast('/'),
|
|
|
|
|
title = a.text().ifEmpty { return@mapNotNullToSet null }.toTitleCase(),
|
|
|
|
|
source = source,
|
|
|
|
|
)
|
|
|
|
|
}.orEmpty(),
|
|
|
|
|
author = summary?.selectFirst(".mg_author")?.selectFirst("a")?.ownText(),
|
|
|
|
|
state = when (
|
|
|
|
|
summary?.selectFirst(".mg_status")
|
|
|
|
|
?.selectFirst(".summary-content")
|
|
|
|
|
?.ownText()
|
|
|
|
|
.orEmpty()
|
|
|
|
|
) {
|
|
|
|
|
in ongoing -> MangaState.ONGOING
|
|
|
|
|
in finished -> MangaState.FINISHED
|
|
|
|
|
in abandoned -> MangaState.ABANDONED
|
|
|
|
|
in paused -> MangaState.PAUSED
|
|
|
|
|
in upcoming -> MangaState.UPCOMING
|
|
|
|
|
else -> null
|
|
|
|
|
},
|
|
|
|
|
source = source,
|
|
|
|
|
isNsfw = isNsfwSource,
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|