|
|
|
|
@ -1,25 +1,21 @@
|
|
|
|
|
package org.koitharu.kotatsu.parsers.site.liliana
|
|
|
|
|
|
|
|
|
|
import kotlinx.coroutines.async
|
|
|
|
|
import kotlinx.coroutines.coroutineScope
|
|
|
|
|
import org.json.JSONObject
|
|
|
|
|
import org.jsoup.nodes.Document
|
|
|
|
|
import org.jsoup.nodes.Element
|
|
|
|
|
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
|
|
|
|
import org.koitharu.kotatsu.parsers.PagedMangaParser
|
|
|
|
|
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
|
|
|
|
import org.koitharu.kotatsu.parsers.model.*
|
|
|
|
|
import org.koitharu.kotatsu.parsers.util.*
|
|
|
|
|
import java.text.SimpleDateFormat
|
|
|
|
|
import org.jsoup.Jsoup
|
|
|
|
|
import java.util.*
|
|
|
|
|
|
|
|
|
|
internal abstract class LilianaParser(
|
|
|
|
|
package org.koitharu.kotatsu.parsers.site.liliana
|
|
|
|
|
|
|
|
|
|
import kotlinx.coroutines.coroutineScope
|
|
|
|
|
import org.jsoup.Jsoup
|
|
|
|
|
import org.jsoup.nodes.Element
|
|
|
|
|
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
|
|
|
|
import org.koitharu.kotatsu.parsers.PagedMangaParser
|
|
|
|
|
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
|
|
|
|
import org.koitharu.kotatsu.parsers.model.*
|
|
|
|
|
import org.koitharu.kotatsu.parsers.util.*
|
|
|
|
|
import java.util.*
|
|
|
|
|
|
|
|
|
|
internal abstract class LilianaParser(
|
|
|
|
|
context: MangaLoaderContext,
|
|
|
|
|
source: MangaParserSource,
|
|
|
|
|
domain: String,
|
|
|
|
|
pageSize: Int = 24
|
|
|
|
|
) : PagedMangaParser(context, source, pageSize) {
|
|
|
|
|
pageSize: Int = 24,
|
|
|
|
|
) : PagedMangaParser(context, source, pageSize) {
|
|
|
|
|
|
|
|
|
|
override val configKeyDomain = ConfigKey.Domain(domain)
|
|
|
|
|
|
|
|
|
|
@ -33,14 +29,14 @@
|
|
|
|
|
SortOrder.POPULARITY,
|
|
|
|
|
SortOrder.ALPHABETICAL,
|
|
|
|
|
SortOrder.NEWEST,
|
|
|
|
|
SortOrder.RATING_ASC
|
|
|
|
|
SortOrder.RATING_ASC,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
override val filterCapabilities: MangaListFilterCapabilities
|
|
|
|
|
get() = MangaListFilterCapabilities(
|
|
|
|
|
isMultipleTagsSupported = true,
|
|
|
|
|
isSearchSupported = true,
|
|
|
|
|
isSearchWithFiltersSupported = true
|
|
|
|
|
isSearchWithFiltersSupported = true,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
|
|
|
|
@ -53,6 +49,7 @@
|
|
|
|
|
append("?keyword=")
|
|
|
|
|
append(filter.query.urlEncoded())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else -> {
|
|
|
|
|
append("/filter")
|
|
|
|
|
}
|
|
|
|
|
@ -77,13 +74,15 @@
|
|
|
|
|
|
|
|
|
|
if (filter.states.isNotEmpty()) {
|
|
|
|
|
append("&status=")
|
|
|
|
|
append(when (filter.states.first()) {
|
|
|
|
|
append(
|
|
|
|
|
when (filter.states.first()) {
|
|
|
|
|
MangaState.ONGOING -> "on-going"
|
|
|
|
|
MangaState.FINISHED -> "completed"
|
|
|
|
|
MangaState.PAUSED -> "on-hold"
|
|
|
|
|
MangaState.ABANDONED -> "canceled"
|
|
|
|
|
else -> "all"
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -131,20 +130,21 @@
|
|
|
|
|
"canceled", "đã huỷ bỏ", "キャンセル" -> MangaState.ABANDONED
|
|
|
|
|
else -> null
|
|
|
|
|
},
|
|
|
|
|
chapters = doc.select("ul > li.chapter").mapChapters { i, element ->
|
|
|
|
|
chapters = doc.select("ul > li.chapter").mapChapters(reversed = true) { i, element ->
|
|
|
|
|
val href = element.selectFirstOrThrow("a").attrAsRelativeUrl("href")
|
|
|
|
|
MangaChapter(
|
|
|
|
|
id = generateUid(href),
|
|
|
|
|
name = element.selectFirst("a")?.text().orEmpty(),
|
|
|
|
|
number = doc.select("ul > li.chapter").size - i.toFloat(),
|
|
|
|
|
number = i + 1f,
|
|
|
|
|
url = href,
|
|
|
|
|
scanlator = null,
|
|
|
|
|
uploadDate = element.selectFirst("time[datetime]")?.attr("datetime")?.toLongOrNull()?.times(1000) ?: 0L,
|
|
|
|
|
uploadDate = element.selectFirst("time[datetime]")?.attr("datetime")?.toLongOrNull()?.times(1000)
|
|
|
|
|
?: 0L,
|
|
|
|
|
branch = null,
|
|
|
|
|
source = source,
|
|
|
|
|
volume = 0
|
|
|
|
|
volume = 0,
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -199,6 +199,6 @@
|
|
|
|
|
|
|
|
|
|
override suspend fun getFilterOptions(): MangaListFilterOptions = MangaListFilterOptions(
|
|
|
|
|
availableTags = getAvailableTags(),
|
|
|
|
|
availableStates = setOf(MangaState.ONGOING, MangaState.FINISHED, MangaState.PAUSED, MangaState.ABANDONED)
|
|
|
|
|
availableStates = setOf(MangaState.ONGOING, MangaState.FINISHED, MangaState.PAUSED, MangaState.ABANDONED),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|