|
|
|
|
@ -1,7 +1,5 @@
|
|
|
|
|
package org.koitharu.kotatsu.parsers.site.madara.vi
|
|
|
|
|
|
|
|
|
|
import kotlinx.coroutines.async
|
|
|
|
|
import kotlinx.coroutines.coroutineScope
|
|
|
|
|
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
|
|
|
|
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
|
|
|
|
import org.koitharu.kotatsu.parsers.exception.ParseException
|
|
|
|
|
@ -13,7 +11,6 @@ import org.koitharu.kotatsu.parsers.model.MangaListFilterOptions
|
|
|
|
|
import org.koitharu.kotatsu.parsers.model.MangaParserSource
|
|
|
|
|
import org.koitharu.kotatsu.parsers.site.madara.MadaraParser
|
|
|
|
|
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
|
|
|
|
import org.koitharu.kotatsu.parsers.model.*
|
|
|
|
|
import org.koitharu.kotatsu.parsers.util.*
|
|
|
|
|
import java.util.*
|
|
|
|
|
|
|
|
|
|
@ -21,7 +18,7 @@ import java.util.*
|
|
|
|
|
internal class HentaiCube(context: MangaLoaderContext) :
|
|
|
|
|
MadaraParser(context, MangaParserSource.HENTAICUBE, "hentaicube.xyz") {
|
|
|
|
|
|
|
|
|
|
override val configKeyDomain = ConfigKey.Domain("hentaicube.xyz", "hentaicb.love") // hentaicb.love broken
|
|
|
|
|
override val configKeyDomain = ConfigKey.Domain("hentaicube.xyz")
|
|
|
|
|
|
|
|
|
|
override val datePattern = "dd/MM/yyyy"
|
|
|
|
|
override val postReq = true
|
|
|
|
|
@ -30,53 +27,6 @@ internal class HentaiCube(context: MangaLoaderContext) :
|
|
|
|
|
availableTags = fetchTags(),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
override suspend fun getDetails(manga: Manga): Manga = coroutineScope {
|
|
|
|
|
val fullUrl = manga.url.toAbsoluteUrl(domain)
|
|
|
|
|
val doc = webClient.httpGet(fullUrl).parseHtml()
|
|
|
|
|
|
|
|
|
|
val href = doc.selectFirst("head meta[property='og:url']")?.attr("content")?.toRelativeUrl(domain) ?: manga.url
|
|
|
|
|
val testCheckAsync = doc.select(selectTestAsync)
|
|
|
|
|
val chaptersDeferred = if (testCheckAsync.isNullOrEmpty()) {
|
|
|
|
|
async { loadChapters(href, doc) }
|
|
|
|
|
} else {
|
|
|
|
|
async { getChapters(manga, doc) }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
val desc = doc.select(selectDesc).html()
|
|
|
|
|
|
|
|
|
|
val stateDiv = doc.selectFirst(selectState)?.selectLast("div.summary-content")
|
|
|
|
|
|
|
|
|
|
val state = stateDiv?.let {
|
|
|
|
|
when (it.text().lowercase()) {
|
|
|
|
|
in ongoing -> MangaState.ONGOING
|
|
|
|
|
in finished -> MangaState.FINISHED
|
|
|
|
|
in abandoned -> MangaState.ABANDONED
|
|
|
|
|
in paused -> MangaState.PAUSED
|
|
|
|
|
else -> null
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
val alt = doc.body().select(selectAlt).firstOrNull()?.tableValue()?.textOrNull()
|
|
|
|
|
|
|
|
|
|
manga.copy(
|
|
|
|
|
title = doc.selectFirst("h1")?.textOrNull() ?: manga.title,
|
|
|
|
|
url = href,
|
|
|
|
|
publicUrl = href.toAbsoluteUrl(domain),
|
|
|
|
|
tags = doc.body().select(selectGenre).mapToSet { a ->
|
|
|
|
|
MangaTag(
|
|
|
|
|
key = a.attr("href").removeSuffix("/").substringAfterLast('/'),
|
|
|
|
|
title = a.text().toTitleCase(),
|
|
|
|
|
source = source,
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
description = desc,
|
|
|
|
|
altTitles = setOfNotNull(alt),
|
|
|
|
|
state = state,
|
|
|
|
|
chapters = chaptersDeferred.await(),
|
|
|
|
|
contentRating = ContentRating.ADULT,
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
|
|
|
|
val fullUrl = chapter.url.toAbsoluteUrl(domain)
|
|
|
|
|
val doc = webClient.httpGet(fullUrl).parseHtml()
|
|
|
|
|
|