[madtheme] add SearchWithFilters
[manga18] add SearchWithFilters [mangadventure] add SearchWithFilters [mangaworld] add POPULARITY_ASC, NEWEST_ASC, SearchWithFilters, Year, ContentTypes, Multiple states Remove type on fetch tags [mmrcms] add SearchWithFilters [TrWebtoon] add SearchWithFilters [Truyenqq] add TagsExclusion, ContentTypes, NEWEST_ASC, UPDATED_ASC, POPULARITY_ASC [Baozimh] add ContentTypes [zmanga] add SearchWithFilters, Year, ContentTypes
This commit is contained in:
@@ -35,21 +35,6 @@ internal abstract class MadaraParser(
|
|||||||
// Change these values only if the site does not support manga listings via ajax
|
// Change these values only if the site does not support manga listings via ajax
|
||||||
protected open val withoutAjax = false
|
protected open val withoutAjax = false
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
|
||||||
get() = MangaListFilterCapabilities(
|
|
||||||
isMultipleTagsSupported = true,
|
|
||||||
isTagsExclusionSupported = !withoutAjax,
|
|
||||||
isSearchSupported = true,
|
|
||||||
isSearchWithFiltersSupported = true,
|
|
||||||
isYearSupported = true,
|
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
|
||||||
availableTags = fetchAvailableTags(),
|
|
||||||
availableStates = EnumSet.allOf(MangaState::class.java),
|
|
||||||
availableContentRating = EnumSet.of(ContentRating.SAFE, ContentRating.ADULT),
|
|
||||||
)
|
|
||||||
|
|
||||||
override val availableSortOrders: Set<SortOrder> = setupAvailableSortOrders()
|
override val availableSortOrders: Set<SortOrder> = setupAvailableSortOrders()
|
||||||
|
|
||||||
private fun setupAvailableSortOrders(): Set<SortOrder> {
|
private fun setupAvailableSortOrders(): Set<SortOrder> {
|
||||||
@@ -79,6 +64,21 @@ internal abstract class MadaraParser(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
|
get() = MangaListFilterCapabilities(
|
||||||
|
isMultipleTagsSupported = true,
|
||||||
|
isTagsExclusionSupported = !withoutAjax,
|
||||||
|
isSearchSupported = true,
|
||||||
|
isSearchWithFiltersSupported = true,
|
||||||
|
isYearSupported = true,
|
||||||
|
)
|
||||||
|
|
||||||
|
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||||
|
availableTags = fetchAvailableTags(),
|
||||||
|
availableStates = EnumSet.allOf(MangaState::class.java),
|
||||||
|
availableContentRating = EnumSet.of(ContentRating.SAFE, ContentRating.ADULT),
|
||||||
|
)
|
||||||
|
|
||||||
override val authUrl: String
|
override val authUrl: String
|
||||||
get() = "https://${domain}"
|
get() = "https://${domain}"
|
||||||
|
|
||||||
|
|||||||
@@ -34,9 +34,17 @@ internal abstract class MadthemeParser(
|
|||||||
SortOrder.RATING,
|
SortOrder.RATING,
|
||||||
)
|
)
|
||||||
|
|
||||||
protected open val listUrl = "search/"
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
protected open val datePattern = "MMM dd, yyyy"
|
get() = MangaListFilterCapabilities(
|
||||||
|
isMultipleTagsSupported = true,
|
||||||
|
isSearchSupported = true,
|
||||||
|
isSearchWithFiltersSupported = true,
|
||||||
|
)
|
||||||
|
|
||||||
|
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||||
|
availableTags = fetchAvailableTags(),
|
||||||
|
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED),
|
||||||
|
)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
paginator.firstPage = 1
|
paginator.firstPage = 1
|
||||||
@@ -46,27 +54,17 @@ internal abstract class MadthemeParser(
|
|||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
protected val ongoing: Set<String> = setOf(
|
protected val ongoing: Set<String> = setOf(
|
||||||
"On Going",
|
"on going",
|
||||||
"Ongoing",
|
"ongoing",
|
||||||
"ONGOING",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
protected val finished: Set<String> = setOf(
|
protected val finished: Set<String> = setOf(
|
||||||
"Completed",
|
"completed",
|
||||||
"COMPLETED",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
protected open val listUrl = "search/"
|
||||||
get() = MangaListFilterCapabilities(
|
protected open val datePattern = "MMM dd, yyyy"
|
||||||
isMultipleTagsSupported = true,
|
|
||||||
isSearchSupported = true,
|
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
|
||||||
availableTags = fetchAvailableTags(),
|
|
||||||
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED),
|
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
val url = buildString {
|
val url = buildString {
|
||||||
@@ -74,49 +72,43 @@ internal abstract class MadthemeParser(
|
|||||||
append(domain)
|
append(domain)
|
||||||
append('/')
|
append('/')
|
||||||
append(listUrl)
|
append(listUrl)
|
||||||
when {
|
|
||||||
|
|
||||||
!filter.query.isNullOrEmpty() -> {
|
append("?page=")
|
||||||
append("?sort=updated_at&q=")
|
append(page.toString())
|
||||||
append(filter.query.urlEncoded())
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> {
|
filter.query?.let {
|
||||||
|
append("&q=")
|
||||||
append("?sort=")
|
append(filter.query.urlEncoded())
|
||||||
when (order) {
|
}
|
||||||
SortOrder.POPULARITY -> append("views")
|
|
||||||
SortOrder.UPDATED -> append("updated_at")
|
|
||||||
SortOrder.ALPHABETICAL -> append("name") // On some sites without tags or searches, the alphabetical option is empty.
|
|
||||||
SortOrder.NEWEST -> append("created_at")
|
|
||||||
SortOrder.RATING -> append("rating")
|
|
||||||
else -> append("updated_at")
|
|
||||||
}
|
|
||||||
if (filter.tags.isNotEmpty()) {
|
|
||||||
filter.tags.forEach {
|
|
||||||
append("&")
|
|
||||||
append("genre[]".urlEncoded())
|
|
||||||
append("=")
|
|
||||||
append(it.key)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
filter.states.oneOrThrowIfMany()?.let {
|
|
||||||
append("&status=")
|
|
||||||
append(
|
|
||||||
when (it) {
|
|
||||||
MangaState.ONGOING -> "ongoing"
|
|
||||||
MangaState.FINISHED -> "completed"
|
|
||||||
else -> "all"
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
append("&sort=")
|
||||||
|
when (order) {
|
||||||
|
SortOrder.POPULARITY -> append("views")
|
||||||
|
SortOrder.UPDATED -> append("updated_at")
|
||||||
|
SortOrder.ALPHABETICAL -> append("name") // On some sites without tags or searches, the alphabetical option is empty.
|
||||||
|
SortOrder.NEWEST -> append("created_at")
|
||||||
|
SortOrder.RATING -> append("rating")
|
||||||
|
else -> append("updated_at")
|
||||||
|
}
|
||||||
|
if (filter.tags.isNotEmpty()) {
|
||||||
|
filter.tags.forEach {
|
||||||
|
append("&")
|
||||||
|
append("genre[]".urlEncoded())
|
||||||
|
append("=")
|
||||||
|
append(it.key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
append("&page=")
|
filter.states.oneOrThrowIfMany()?.let {
|
||||||
append(page.toString())
|
append("&status=")
|
||||||
|
append(
|
||||||
|
when (it) {
|
||||||
|
MangaState.ONGOING -> "ongoing"
|
||||||
|
MangaState.FINISHED -> "completed"
|
||||||
|
else -> "all"
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val doc = webClient.httpGet(url).parseHtml()
|
val doc = webClient.httpGet(url).parseHtml()
|
||||||
@@ -128,10 +120,9 @@ internal abstract class MadthemeParser(
|
|||||||
url = href,
|
url = href,
|
||||||
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
||||||
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
||||||
title = div.selectFirstOrThrow("div.meta").selectFirst("div.title")?.text().orEmpty(),
|
title = div.selectFirst("div.meta")?.selectFirst("div.title")?.text().orEmpty(),
|
||||||
altTitle = null,
|
altTitle = null,
|
||||||
rating = div.selectFirstOrThrow("div.meta span.score").ownText().toFloatOrNull()?.div(5f)
|
rating = div.selectFirst("div.meta span.score")?.ownText()?.toFloatOrNull()?.div(5f) ?: RATING_UNKNOWN,
|
||||||
?: RATING_UNKNOWN,
|
|
||||||
tags = doc.body().select("div.meta div.genres span").mapNotNullToSet { span ->
|
tags = doc.body().select("div.meta div.genres span").mapNotNullToSet { span ->
|
||||||
MangaTag(
|
MangaTag(
|
||||||
key = span.attr("class"),
|
key = span.attr("class"),
|
||||||
@@ -151,7 +142,7 @@ internal abstract class MadthemeParser(
|
|||||||
val doc = webClient.httpGet("https://$domain/$listUrl").parseHtml()
|
val doc = webClient.httpGet("https://$domain/$listUrl").parseHtml()
|
||||||
return doc.select("div.genres .checkbox").mapNotNullToSet { checkbox ->
|
return doc.select("div.genres .checkbox").mapNotNullToSet { checkbox ->
|
||||||
val key = checkbox.selectFirstOrThrow("input").attr("value") ?: return@mapNotNullToSet null
|
val key = checkbox.selectFirstOrThrow("input").attr("value") ?: return@mapNotNullToSet null
|
||||||
val name = checkbox.selectFirstOrThrow("span.radio__label").text()
|
val name = checkbox.selectFirst("span.radio__label")?.text() ?: key
|
||||||
MangaTag(
|
MangaTag(
|
||||||
key = key,
|
key = key,
|
||||||
title = name,
|
title = name,
|
||||||
@@ -171,12 +162,12 @@ internal abstract class MadthemeParser(
|
|||||||
|
|
||||||
val chaptersDeferred = async { getChapters(doc) }
|
val chaptersDeferred = async { getChapters(doc) }
|
||||||
|
|
||||||
val desc = doc.selectFirstOrThrow(selectDesc).html()
|
val desc = doc.selectFirst(selectDesc)?.html()
|
||||||
|
|
||||||
val stateDiv = doc.selectFirst(selectState)
|
val stateDiv = doc.selectFirst(selectState)
|
||||||
|
|
||||||
val state = stateDiv?.let {
|
val state = stateDiv?.let {
|
||||||
when (it.text()) {
|
when (it.text().lowercase()) {
|
||||||
in ongoing -> MangaState.ONGOING
|
in ongoing -> MangaState.ONGOING
|
||||||
in finished -> MangaState.FINISHED
|
in finished -> MangaState.FINISHED
|
||||||
else -> null
|
else -> null
|
||||||
@@ -195,8 +186,8 @@ internal abstract class MadthemeParser(
|
|||||||
source = source,
|
source = source,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
description = desc,
|
description = desc.orEmpty(),
|
||||||
altTitle = alt,
|
altTitle = alt.orEmpty(),
|
||||||
state = state,
|
state = state,
|
||||||
chapters = chaptersDeferred.await(),
|
chapters = chaptersDeferred.await(),
|
||||||
isNsfw = nsfw || manga.isNsfw,
|
isNsfw = nsfw || manga.isNsfw,
|
||||||
@@ -218,7 +209,7 @@ internal abstract class MadthemeParser(
|
|||||||
val dateText = li.selectFirst(selectDate)?.text()
|
val dateText = li.selectFirst(selectDate)?.text()
|
||||||
MangaChapter(
|
MangaChapter(
|
||||||
id = generateUid(href),
|
id = generateUid(href),
|
||||||
name = li.selectFirstOrThrow(".chapter-title").text(),
|
name = li.selectFirst(".chapter-title")?.text() ?: "Chapters : ${i + 1f}",
|
||||||
number = i + 1f,
|
number = i + 1f,
|
||||||
volume = 0,
|
volume = 0,
|
||||||
url = href,
|
url = href,
|
||||||
|
|||||||
@@ -1,124 +1,12 @@
|
|||||||
package org.koitharu.kotatsu.parsers.site.madtheme.en
|
package org.koitharu.kotatsu.parsers.site.madtheme.en
|
||||||
|
|
||||||
import org.jsoup.nodes.Document
|
|
||||||
import org.koitharu.kotatsu.parsers.Broken
|
import org.koitharu.kotatsu.parsers.Broken
|
||||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||||
import org.koitharu.kotatsu.parsers.model.*
|
import org.koitharu.kotatsu.parsers.model.*
|
||||||
import org.koitharu.kotatsu.parsers.site.madtheme.MadthemeParser
|
import org.koitharu.kotatsu.parsers.site.madtheme.MadthemeParser
|
||||||
import org.koitharu.kotatsu.parsers.util.*
|
|
||||||
import java.text.SimpleDateFormat
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
@Broken
|
@Broken
|
||||||
@MangaSourceParser("MANHUASCAN", "kaliscan.io", "en")
|
@MangaSourceParser("MANHUASCAN", "kaliscan.io", "en")
|
||||||
internal class ManhuaScan(context: MangaLoaderContext) :
|
internal class ManhuaScan(context: MangaLoaderContext) :
|
||||||
MadthemeParser(context, MangaParserSource.MANHUASCAN, "manhuascan.io") {
|
MadthemeParser(context, MangaParserSource.MANHUASCAN, "manhuascan.io")
|
||||||
override val sourceLocale: Locale = Locale.ENGLISH
|
|
||||||
override val listUrl = "search"
|
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
|
||||||
val url = buildString {
|
|
||||||
append("https://")
|
|
||||||
append(domain)
|
|
||||||
append('/')
|
|
||||||
append(listUrl)
|
|
||||||
when {
|
|
||||||
|
|
||||||
!filter.query.isNullOrEmpty() -> {
|
|
||||||
append("?sort=updated_at&q=")
|
|
||||||
append(filter.query.urlEncoded())
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> {
|
|
||||||
|
|
||||||
append("?sort=")
|
|
||||||
when (order) {
|
|
||||||
SortOrder.POPULARITY -> append("views")
|
|
||||||
SortOrder.UPDATED -> append("updated_at")
|
|
||||||
SortOrder.ALPHABETICAL -> append("name")
|
|
||||||
SortOrder.NEWEST -> append("created_at")
|
|
||||||
SortOrder.RATING -> append("rating")
|
|
||||||
else -> append("updated_at")
|
|
||||||
}
|
|
||||||
if (filter.tags.isNotEmpty()) {
|
|
||||||
filter.tags.forEach {
|
|
||||||
append("&")
|
|
||||||
append("include[]".urlEncoded())
|
|
||||||
append("=")
|
|
||||||
append(it.key)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
filter.states.oneOrThrowIfMany()?.let {
|
|
||||||
append("&status=")
|
|
||||||
append(
|
|
||||||
when (it) {
|
|
||||||
MangaState.ONGOING -> "ongoing"
|
|
||||||
MangaState.FINISHED -> "completed"
|
|
||||||
else -> "all"
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
append("&page=")
|
|
||||||
append(page.toString())
|
|
||||||
}
|
|
||||||
|
|
||||||
val doc = webClient.httpGet(url).parseHtml()
|
|
||||||
|
|
||||||
return doc.select("div.book-item").map { div ->
|
|
||||||
val href = div.selectFirstOrThrow("a").attrAsRelativeUrl("href")
|
|
||||||
Manga(
|
|
||||||
id = generateUid(href),
|
|
||||||
url = href,
|
|
||||||
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
|
||||||
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
|
||||||
title = div.selectFirstOrThrow("div.meta").selectFirst("div.title")?.text().orEmpty(),
|
|
||||||
altTitle = null,
|
|
||||||
rating = div.selectFirstOrThrow("div.meta span.score").ownText().toFloatOrNull()?.div(5f)
|
|
||||||
?: RATING_UNKNOWN,
|
|
||||||
tags = doc.body().select("div.meta div.genres span").mapNotNullToSet { span ->
|
|
||||||
MangaTag(
|
|
||||||
key = span.attr("class"),
|
|
||||||
title = span.text().toTitleCase(),
|
|
||||||
source = source,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
author = null,
|
|
||||||
state = null,
|
|
||||||
source = source,
|
|
||||||
isNsfw = isNsfwSource,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun getChapters(doc: Document): List<MangaChapter> {
|
|
||||||
val dateFormat = SimpleDateFormat(datePattern, sourceLocale)
|
|
||||||
val id = doc.selectFirstOrThrow("script:containsData(bookId)").data().substringAfter("bookId = ")
|
|
||||||
.substringBefore(";")
|
|
||||||
val docChapter = webClient.httpGet("https://$domain/service/backend/chaplist/?manga_id=$id").parseHtml()
|
|
||||||
return docChapter.select(selectChapter).mapChapters(reversed = true) { i, li ->
|
|
||||||
val a = li.selectFirstOrThrow("a")
|
|
||||||
val href = a.attrAsRelativeUrl("href")
|
|
||||||
val dateText = li.selectFirst(selectDate)?.text()
|
|
||||||
MangaChapter(
|
|
||||||
id = generateUid(href),
|
|
||||||
name = li.selectFirstOrThrow(".chapter-title").text(),
|
|
||||||
number = i + 1f,
|
|
||||||
volume = 0,
|
|
||||||
url = href,
|
|
||||||
uploadDate = parseChapterDate(
|
|
||||||
dateFormat,
|
|
||||||
dateText,
|
|
||||||
),
|
|
||||||
source = source,
|
|
||||||
scanlator = null,
|
|
||||||
branch = null,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -31,10 +31,15 @@ internal abstract class Manga18Parser(
|
|||||||
SortOrder.ALPHABETICAL,
|
SortOrder.ALPHABETICAL,
|
||||||
)
|
)
|
||||||
|
|
||||||
protected open val listUrl = "list-manga/"
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
protected open val tagUrl = "manga-list/"
|
get() = MangaListFilterCapabilities(
|
||||||
protected open val datePattern = "dd-MM-yyyy"
|
isSearchSupported = true,
|
||||||
|
isSearchWithFiltersSupported = true,
|
||||||
|
)
|
||||||
|
|
||||||
|
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||||
|
availableTags = fetchAvailableTags(),
|
||||||
|
)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
paginator.firstPage = 1
|
paginator.firstPage = 1
|
||||||
@@ -52,52 +57,48 @@ internal abstract class Manga18Parser(
|
|||||||
"Completed",
|
"Completed",
|
||||||
)
|
)
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
protected open val listUrl = "list-manga/"
|
||||||
get() = MangaListFilterCapabilities(
|
protected open val tagUrl = "manga-list/"
|
||||||
isSearchSupported = true,
|
protected open val datePattern = "dd-MM-yyyy"
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
|
||||||
availableTags = fetchAvailableTags(),
|
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
val url = buildString {
|
val url = buildString {
|
||||||
append("https://")
|
append("https://")
|
||||||
append(domain)
|
append(domain)
|
||||||
append('/')
|
append('/')
|
||||||
when {
|
|
||||||
|
|
||||||
!filter.query.isNullOrEmpty() -> {
|
if (filter.tags.isNotEmpty() && filter.query != null) {
|
||||||
|
throw IllegalArgumentException("Search is not supported with tags")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filter.tags.isNotEmpty()) {
|
||||||
|
filter.tags.oneOrThrowIfMany()?.let {
|
||||||
|
append(tagUrl)
|
||||||
|
append(it.key)
|
||||||
|
append('/')
|
||||||
|
append(page.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filter.query != null) {
|
||||||
|
filter.query.let {
|
||||||
append(listUrl)
|
append(listUrl)
|
||||||
append(page.toString())
|
append(page.toString())
|
||||||
append("?search=")
|
append("?search=")
|
||||||
append(filter.query.urlEncoded())
|
append(filter.query.urlEncoded())
|
||||||
append("&order_by=latest")
|
append("&order_by=latest")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else -> {
|
append("?order_by=")
|
||||||
if (filter.tags.isNotEmpty()) {
|
when (order) {
|
||||||
filter.tags.oneOrThrowIfMany()?.let {
|
SortOrder.POPULARITY -> append("views")
|
||||||
append(tagUrl)
|
SortOrder.UPDATED -> append("lastest")
|
||||||
append(it.key)
|
SortOrder.ALPHABETICAL -> append("name")
|
||||||
append("/")
|
else -> append("latest")
|
||||||
}
|
|
||||||
} else {
|
|
||||||
append(listUrl)
|
|
||||||
}
|
|
||||||
|
|
||||||
append(page.toString())
|
|
||||||
append("?order_by=")
|
|
||||||
when (order) {
|
|
||||||
SortOrder.POPULARITY -> append("views")
|
|
||||||
SortOrder.UPDATED -> append("lastest")
|
|
||||||
SortOrder.ALPHABETICAL -> append("name")
|
|
||||||
else -> append("latest")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return parseMangaList(webClient.httpGet(url).parseHtml())
|
return parseMangaList(webClient.httpGet(url).parseHtml())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +110,7 @@ internal abstract class Manga18Parser(
|
|||||||
url = href,
|
url = href,
|
||||||
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
||||||
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
||||||
title = div.selectFirstOrThrow("div.mg_info").selectFirst("div.mg_name a")?.text().orEmpty(),
|
title = div.selectFirst("div.mg_info")?.selectFirst("div.mg_name a")?.text().orEmpty(),
|
||||||
altTitle = null,
|
altTitle = null,
|
||||||
rating = RATING_UNKNOWN,
|
rating = RATING_UNKNOWN,
|
||||||
tags = emptySet(),
|
tags = emptySet(),
|
||||||
@@ -145,13 +146,9 @@ internal abstract class Manga18Parser(
|
|||||||
val fullUrl = manga.url.toAbsoluteUrl(domain)
|
val fullUrl = manga.url.toAbsoluteUrl(domain)
|
||||||
val doc = webClient.httpGet(fullUrl).parseHtml()
|
val doc = webClient.httpGet(fullUrl).parseHtml()
|
||||||
val body = doc.body().selectFirstOrThrow("div.detail_listInfo")
|
val body = doc.body().selectFirstOrThrow("div.detail_listInfo")
|
||||||
|
|
||||||
val chaptersDeferred = async { getChapters(doc) }
|
val chaptersDeferred = async { getChapters(doc) }
|
||||||
|
val desc = doc.selectFirst(selectDesc)?.html()
|
||||||
val desc = doc.selectFirstOrThrow(selectDesc).html()
|
|
||||||
|
|
||||||
val stateDiv = body.selectFirst(selectState)
|
val stateDiv = body.selectFirst(selectState)
|
||||||
|
|
||||||
val state = stateDiv?.let {
|
val state = stateDiv?.let {
|
||||||
when (it.text()) {
|
when (it.text()) {
|
||||||
in ongoing -> MangaState.ONGOING
|
in ongoing -> MangaState.ONGOING
|
||||||
@@ -159,10 +156,8 @@ internal abstract class Manga18Parser(
|
|||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val alt = body.selectFirst(selectAlt)?.text().takeIf { it != "Updating" || it.isNotEmpty() }
|
val alt = body.selectFirst(selectAlt)?.text().takeIf { it != "Updating" || it.isNotEmpty() }
|
||||||
val author = body.selectFirst(selectAuthor)?.text().takeIf { it != "Updating" }
|
val author = body.selectFirst(selectAuthor)?.text().takeIf { it != "Updating" }
|
||||||
|
|
||||||
manga.copy(
|
manga.copy(
|
||||||
tags = doc.body().select(selectTag).mapNotNullToSet { a ->
|
tags = doc.body().select(selectTag).mapNotNullToSet { a ->
|
||||||
MangaTag(
|
MangaTag(
|
||||||
@@ -171,7 +166,7 @@ internal abstract class Manga18Parser(
|
|||||||
source = source,
|
source = source,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
description = desc,
|
description = desc.orEmpty(),
|
||||||
altTitle = alt,
|
altTitle = alt,
|
||||||
author = author,
|
author = author,
|
||||||
state = state,
|
state = state,
|
||||||
@@ -206,12 +201,10 @@ internal abstract class Manga18Parser(
|
|||||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||||
val fullUrl = chapter.url.toAbsoluteUrl(domain)
|
val fullUrl = chapter.url.toAbsoluteUrl(domain)
|
||||||
val doc = webClient.httpGet(fullUrl).parseHtml()
|
val doc = webClient.httpGet(fullUrl).parseHtml()
|
||||||
|
|
||||||
val script = doc.selectFirstOrThrow("script:containsData(slides_p_path)")
|
val script = doc.selectFirstOrThrow("script:containsData(slides_p_path)")
|
||||||
val urlencoed = script.data().substringAfter('[').substringBefore(",]").replace("\"", "").split(",")
|
val urlEncoded = script.data().substringAfter('[').substringBefore(",]").replace("\"", "").split(",")
|
||||||
return urlencoed.map { url ->
|
return urlEncoded.map { url ->
|
||||||
val img = context.decodeBase64(url).toString(Charsets.UTF_8)
|
val img = context.decodeBase64(url).toString(Charsets.UTF_8)
|
||||||
|
|
||||||
MangaPage(
|
MangaPage(
|
||||||
id = generateUid(img),
|
id = generateUid(img),
|
||||||
url = img,
|
url = img,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ internal class Hentai3zCc(context: MangaLoaderContext) :
|
|||||||
?.replace("cover_thumb_2.webp", "cover_250x350.jpg")
|
?.replace("cover_thumb_2.webp", "cover_250x350.jpg")
|
||||||
?.replace("admin.manga18.us", "bk.18porncomic.com")
|
?.replace("admin.manga18.us", "bk.18porncomic.com")
|
||||||
.orEmpty(),
|
.orEmpty(),
|
||||||
title = div.selectFirstOrThrow("div.mg_info").selectFirst("div.mg_name a")?.text().orEmpty(),
|
title = div.selectFirst("div.mg_info")?.selectFirst("div.mg_name a")?.text().orEmpty(),
|
||||||
altTitle = null,
|
altTitle = null,
|
||||||
rating = RATING_UNKNOWN,
|
rating = RATING_UNKNOWN,
|
||||||
tags = emptySet(),
|
tags = emptySet(),
|
||||||
|
|||||||
@@ -30,10 +30,18 @@ internal abstract class MangaboxParser(
|
|||||||
SortOrder.ALPHABETICAL,
|
SortOrder.ALPHABETICAL,
|
||||||
)
|
)
|
||||||
|
|
||||||
protected open val listUrl = "/advanced_search"
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
protected open val searchUrl = "/search/story/"
|
get() = MangaListFilterCapabilities(
|
||||||
protected open val datePattern = "MMM dd,yy"
|
isMultipleTagsSupported = true,
|
||||||
|
isTagsExclusionSupported = true,
|
||||||
|
isSearchSupported = true,
|
||||||
|
isSearchWithFiltersSupported = true,
|
||||||
|
)
|
||||||
|
|
||||||
|
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||||
|
availableTags = fetchAvailableTags(),
|
||||||
|
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED),
|
||||||
|
)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
paginator.firstPage = 1
|
paginator.firstPage = 1
|
||||||
@@ -50,17 +58,9 @@ internal abstract class MangaboxParser(
|
|||||||
"completed",
|
"completed",
|
||||||
)
|
)
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
protected open val listUrl = "/advanced_search"
|
||||||
get() = MangaListFilterCapabilities(
|
protected open val searchUrl = "/search/story/"
|
||||||
isMultipleTagsSupported = true,
|
protected open val datePattern = "MMM dd,yy"
|
||||||
isTagsExclusionSupported = true,
|
|
||||||
isSearchSupported = true,
|
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
|
||||||
availableTags = fetchAvailableTags(),
|
|
||||||
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED),
|
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
val url = buildString {
|
val url = buildString {
|
||||||
@@ -68,55 +68,50 @@ internal abstract class MangaboxParser(
|
|||||||
append(domain)
|
append(domain)
|
||||||
append(listUrl)
|
append(listUrl)
|
||||||
append("/?s=all")
|
append("/?s=all")
|
||||||
when {
|
|
||||||
|
|
||||||
!filter.query.isNullOrEmpty() -> {
|
filter.query?.let {
|
||||||
append("&keyw=")
|
append("&keyw=")
|
||||||
append(filter.query.replace(" ", "_").urlEncoded())
|
append(filter.query.replace(" ", "_").urlEncoded())
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filter.tags.isNotEmpty()) {
|
||||||
|
append("&g_i=")
|
||||||
|
filter.tags.forEach {
|
||||||
|
append("_")
|
||||||
|
append(it.key)
|
||||||
|
append("_")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else -> {
|
if (filter.tagsExclude.isNotEmpty()) {
|
||||||
|
append("&g_e=")
|
||||||
if (filter.tags.isNotEmpty()) {
|
filter.tagsExclude.forEach {
|
||||||
append("&g_i=")
|
append("_")
|
||||||
filter.tags.forEach {
|
append(it.key)
|
||||||
append("_")
|
append("_")
|
||||||
append(it.key)
|
|
||||||
append("_")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filter.tagsExclude.isNotEmpty()) {
|
|
||||||
append("&g_e=")
|
|
||||||
filter.tagsExclude.forEach {
|
|
||||||
append("_")
|
|
||||||
append(it.key)
|
|
||||||
append("_")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
filter.states.oneOrThrowIfMany()?.let {
|
|
||||||
append("&sts=")
|
|
||||||
append(
|
|
||||||
when (it) {
|
|
||||||
MangaState.ONGOING -> "ongoing"
|
|
||||||
MangaState.FINISHED -> "completed"
|
|
||||||
else -> ""
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
append("&orby=")
|
|
||||||
when (order) {
|
|
||||||
SortOrder.POPULARITY -> append("topview")
|
|
||||||
SortOrder.UPDATED -> append("")
|
|
||||||
SortOrder.NEWEST -> append("newest")
|
|
||||||
SortOrder.ALPHABETICAL -> append("az")
|
|
||||||
else -> append("")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filter.states.oneOrThrowIfMany()?.let {
|
||||||
|
append("&sts=")
|
||||||
|
append(
|
||||||
|
when (it) {
|
||||||
|
MangaState.ONGOING -> "ongoing"
|
||||||
|
MangaState.FINISHED -> "completed"
|
||||||
|
else -> ""
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
append("&orby=")
|
||||||
|
when (order) {
|
||||||
|
SortOrder.POPULARITY -> append("topview")
|
||||||
|
SortOrder.UPDATED -> append("")
|
||||||
|
SortOrder.NEWEST -> append("newest")
|
||||||
|
SortOrder.ALPHABETICAL -> append("az")
|
||||||
|
else -> append("")
|
||||||
|
}
|
||||||
|
|
||||||
append("&page=")
|
append("&page=")
|
||||||
append(page.toString())
|
append(page.toString())
|
||||||
}
|
}
|
||||||
@@ -132,7 +127,7 @@ internal abstract class MangaboxParser(
|
|||||||
url = href,
|
url = href,
|
||||||
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
||||||
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
||||||
title = div.selectFirstOrThrow("h3").text().orEmpty(),
|
title = div.selectFirst("h3")?.text().orEmpty(),
|
||||||
altTitle = null,
|
altTitle = null,
|
||||||
rating = RATING_UNKNOWN,
|
rating = RATING_UNKNOWN,
|
||||||
tags = emptySet(),
|
tags = emptySet(),
|
||||||
@@ -170,7 +165,7 @@ internal abstract class MangaboxParser(
|
|||||||
val fullUrl = manga.url.toAbsoluteUrl(domain)
|
val fullUrl = manga.url.toAbsoluteUrl(domain)
|
||||||
val doc = webClient.httpGet(fullUrl).parseHtml()
|
val doc = webClient.httpGet(fullUrl).parseHtml()
|
||||||
val chaptersDeferred = async { getChapters(doc) }
|
val chaptersDeferred = async { getChapters(doc) }
|
||||||
val desc = doc.selectFirstOrThrow(selectDesc).html()
|
val desc = doc.selectFirst(selectDesc)?.html()
|
||||||
val stateDiv = doc.select(selectState).text()
|
val stateDiv = doc.select(selectState).text()
|
||||||
val state = stateDiv.let {
|
val state = stateDiv.let {
|
||||||
when (it.lowercase()) {
|
when (it.lowercase()) {
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ internal class Mangairo(context: MangaLoaderContext) :
|
|||||||
get() = super.filterCapabilities.copy(
|
get() = super.filterCapabilities.copy(
|
||||||
isTagsExclusionSupported = false,
|
isTagsExclusionSupported = false,
|
||||||
isMultipleTagsSupported = false,
|
isMultipleTagsSupported = false,
|
||||||
|
isSearchWithFiltersSupported = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
@@ -125,7 +126,7 @@ internal class Mangairo(context: MangaLoaderContext) :
|
|||||||
val fullUrl = manga.url.toAbsoluteUrl(domain)
|
val fullUrl = manga.url.toAbsoluteUrl(domain)
|
||||||
val doc = webClient.httpGet(fullUrl).parseHtml()
|
val doc = webClient.httpGet(fullUrl).parseHtml()
|
||||||
val chaptersDeferred = async { getChapters(doc) }
|
val chaptersDeferred = async { getChapters(doc) }
|
||||||
val desc = doc.selectFirstOrThrow(selectDesc).html()
|
val desc = doc.selectFirst(selectDesc)?.html()
|
||||||
val stateDiv = doc.select(selectState).text()
|
val stateDiv = doc.select(selectState).text()
|
||||||
val state = stateDiv.let {
|
val state = stateDiv.let {
|
||||||
when (it) {
|
when (it) {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ internal class Mangakakalot(context: MangaLoaderContext) :
|
|||||||
get() = super.filterCapabilities.copy(
|
get() = super.filterCapabilities.copy(
|
||||||
isTagsExclusionSupported = false,
|
isTagsExclusionSupported = false,
|
||||||
isMultipleTagsSupported = false,
|
isMultipleTagsSupported = false,
|
||||||
|
isSearchWithFiltersSupported = false,
|
||||||
)
|
)
|
||||||
override val otherDomain = "chapmanganato.com"
|
override val otherDomain = "chapmanganato.com"
|
||||||
override val listUrl = "/manga_list"
|
override val listUrl = "/manga_list"
|
||||||
@@ -85,7 +86,7 @@ internal class Mangakakalot(context: MangaLoaderContext) :
|
|||||||
url = href,
|
url = href,
|
||||||
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
||||||
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
||||||
title = div.selectFirstOrThrow("h3").text().orEmpty(),
|
title = div.selectFirst("h3")?.text().orEmpty(),
|
||||||
altTitle = null,
|
altTitle = null,
|
||||||
rating = RATING_UNKNOWN,
|
rating = RATING_UNKNOWN,
|
||||||
tags = emptySet(),
|
tags = emptySet(),
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ internal class MangakakalotTv(context: MangaLoaderContext) :
|
|||||||
get() = super.filterCapabilities.copy(
|
get() = super.filterCapabilities.copy(
|
||||||
isTagsExclusionSupported = false,
|
isTagsExclusionSupported = false,
|
||||||
isMultipleTagsSupported = false,
|
isMultipleTagsSupported = false,
|
||||||
|
isSearchWithFiltersSupported = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ internal abstract class MangAdventureParser(
|
|||||||
domain: String,
|
domain: String,
|
||||||
pageSize: Int = 25,
|
pageSize: Int = 25,
|
||||||
) : PagedMangaParser(context, source, pageSize) {
|
) : PagedMangaParser(context, source, pageSize) {
|
||||||
|
|
||||||
override val configKeyDomain = ConfigKey.Domain(domain)
|
override val configKeyDomain = ConfigKey.Domain(domain)
|
||||||
|
|
||||||
override val userAgentKey = ConfigKey.UserAgent(UserAgents.KOTATSU)
|
override val userAgentKey = ConfigKey.UserAgent(UserAgents.KOTATSU)
|
||||||
@@ -41,6 +42,7 @@ internal abstract class MangAdventureParser(
|
|||||||
isMultipleTagsSupported = true,
|
isMultipleTagsSupported = true,
|
||||||
isTagsExclusionSupported = true,
|
isTagsExclusionSupported = true,
|
||||||
isSearchSupported = true,
|
isSearchSupported = true,
|
||||||
|
isSearchWithFiltersSupported = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||||
@@ -62,42 +64,37 @@ internal abstract class MangAdventureParser(
|
|||||||
val url = apiUrl.addEncodedPathSegment("series")
|
val url = apiUrl.addEncodedPathSegment("series")
|
||||||
.addEncodedQueryParameter("limit", pageSize.toString())
|
.addEncodedQueryParameter("limit", pageSize.toString())
|
||||||
.addEncodedQueryParameter("page", page.toString())
|
.addEncodedQueryParameter("page", page.toString())
|
||||||
when {
|
|
||||||
!filter.query.isNullOrEmpty() -> {
|
|
||||||
url.addQueryParameter("title", filter.query)
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> {
|
filter.query?.let {
|
||||||
url.addQueryParameter(
|
url.addQueryParameter("title", filter.query)
|
||||||
"categories",
|
}
|
||||||
buildString {
|
|
||||||
if (filter.tags.isNotEmpty() && filter.tagsExclude.isNotEmpty()) {
|
url.addQueryParameter(
|
||||||
filter.tags.joinTo(this, ",", postfix = ",") { it.key }
|
"categories",
|
||||||
filter.tagsExclude.joinTo(this, ",") { "-" + it.key }
|
buildString {
|
||||||
} else if (filter.tags.isNotEmpty()) {
|
filter.tags.joinTo(this, ",", postfix = ",") { it.key }
|
||||||
filter.tags.joinTo(this, ",") { it.key }
|
filter.tagsExclude.joinTo(this, ",") { "-" + it.key }
|
||||||
} else if (filter.tagsExclude.isNotEmpty()) {
|
},
|
||||||
filter.tagsExclude.joinTo(this, ",") { "-" + it.key }
|
)
|
||||||
}
|
|
||||||
},
|
filter.states.oneOrThrowIfMany()?.let {
|
||||||
)
|
when (it) {
|
||||||
when (filter.states.oneOrThrowIfMany()) {
|
MangaState.ONGOING -> url.addEncodedQueryParameter("status", "ongoing")
|
||||||
null -> url.addEncodedQueryParameter("status", "any")
|
MangaState.FINISHED -> url.addEncodedQueryParameter("status", "completed")
|
||||||
MangaState.ONGOING -> url.addEncodedQueryParameter("status", "ongoing")
|
MangaState.ABANDONED -> url.addEncodedQueryParameter("status", "canceled")
|
||||||
MangaState.FINISHED -> url.addEncodedQueryParameter("status", "completed")
|
MangaState.PAUSED -> url.addEncodedQueryParameter("status", "hiatus")
|
||||||
MangaState.ABANDONED -> url.addEncodedQueryParameter("status", "canceled")
|
else -> url.addEncodedQueryParameter("status", "any")
|
||||||
MangaState.PAUSED -> url.addEncodedQueryParameter("status", "hiatus")
|
|
||||||
else -> throw IllegalArgumentException(ERROR_UNSUPPORTED_STATE)
|
|
||||||
}
|
|
||||||
when (order) {
|
|
||||||
SortOrder.ALPHABETICAL -> url.addEncodedQueryParameter("sort", "title")
|
|
||||||
SortOrder.ALPHABETICAL_DESC -> url.addEncodedQueryParameter("sort", "-title")
|
|
||||||
SortOrder.UPDATED -> url.addEncodedQueryParameter("sort", "-latest_upload")
|
|
||||||
SortOrder.POPULARITY -> url.addEncodedQueryParameter("sort", "-views")
|
|
||||||
else -> throw IllegalArgumentException(ERROR_UNSUPPORTED_SORT_ORDER)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
when (order) {
|
||||||
|
SortOrder.ALPHABETICAL -> url.addEncodedQueryParameter("sort", "title")
|
||||||
|
SortOrder.ALPHABETICAL_DESC -> url.addEncodedQueryParameter("sort", "-title")
|
||||||
|
SortOrder.UPDATED -> url.addEncodedQueryParameter("sort", "-latest_upload")
|
||||||
|
SortOrder.POPULARITY -> url.addEncodedQueryParameter("sort", "-views")
|
||||||
|
else -> url.addEncodedQueryParameter("sort", "-latest_upload")
|
||||||
|
}
|
||||||
|
|
||||||
return runCatchingCancellable { getManga(url.get()) }.getOrElse {
|
return runCatchingCancellable { getManga(url.get()) }.getOrElse {
|
||||||
if (it is NotFoundException) emptyList() else throw it
|
if (it is NotFoundException) emptyList() else throw it
|
||||||
}
|
}
|
||||||
@@ -213,12 +210,4 @@ internal abstract class MangAdventureParser(
|
|||||||
|
|
||||||
protected suspend fun HttpUrl.Builder.get() =
|
protected suspend fun HttpUrl.Builder.get() =
|
||||||
webClient.httpGet(build()).body?.string()?.let(::JSONObject)
|
webClient.httpGet(build()).body?.string()?.let(::JSONObject)
|
||||||
|
|
||||||
private companion object {
|
|
||||||
private const val ERROR_UNSUPPORTED_STATE =
|
|
||||||
"The selected state is not supported by this source"
|
|
||||||
|
|
||||||
private const val ERROR_UNSUPPORTED_SORT_ORDER =
|
|
||||||
"The selected sort order is not supported by this source"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,10 @@ internal abstract class MangaWorldParser(
|
|||||||
|
|
||||||
override val availableSortOrders: Set<SortOrder> = EnumSet.of(
|
override val availableSortOrders: Set<SortOrder> = EnumSet.of(
|
||||||
SortOrder.POPULARITY,
|
SortOrder.POPULARITY,
|
||||||
|
SortOrder.POPULARITY_ASC,
|
||||||
SortOrder.ALPHABETICAL,
|
SortOrder.ALPHABETICAL,
|
||||||
SortOrder.NEWEST,
|
SortOrder.NEWEST,
|
||||||
|
SortOrder.NEWEST_ASC,
|
||||||
SortOrder.ALPHABETICAL_DESC,
|
SortOrder.ALPHABETICAL_DESC,
|
||||||
SortOrder.UPDATED,
|
SortOrder.UPDATED,
|
||||||
)
|
)
|
||||||
@@ -33,11 +35,20 @@ internal abstract class MangaWorldParser(
|
|||||||
get() = MangaListFilterCapabilities(
|
get() = MangaListFilterCapabilities(
|
||||||
isMultipleTagsSupported = true,
|
isMultipleTagsSupported = true,
|
||||||
isSearchSupported = true,
|
isSearchSupported = true,
|
||||||
|
isSearchWithFiltersSupported = true,
|
||||||
|
isYearSupported = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||||
availableTags = fetchAvailableTags(),
|
availableTags = fetchAvailableTags(),
|
||||||
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED, MangaState.ABANDONED, MangaState.PAUSED),
|
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED, MangaState.ABANDONED, MangaState.PAUSED),
|
||||||
|
availableContentTypes = EnumSet.of(
|
||||||
|
ContentType.MANGA,
|
||||||
|
ContentType.MANHUA,
|
||||||
|
ContentType.MANHWA,
|
||||||
|
ContentType.ONE_SHOT,
|
||||||
|
ContentType.OTHER,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||||
@@ -46,43 +57,83 @@ internal abstract class MangaWorldParser(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
|
|
||||||
|
if (order == SortOrder.UPDATED) {
|
||||||
|
if (filter.query != null || filter.tags.isNotEmpty() || filter.states.isNotEmpty() || filter.types.isNotEmpty() || filter.year != 0) {
|
||||||
|
throw IllegalArgumentException("Sorting by update with filters is not supported by this source.")
|
||||||
|
|
||||||
|
}
|
||||||
|
return parseMangaList(webClient.httpGet("https://$domain/?page=$page").parseHtml())
|
||||||
|
}
|
||||||
|
|
||||||
val url =
|
val url =
|
||||||
buildString {
|
buildString {
|
||||||
append("https://")
|
append("https://")
|
||||||
append(domain)
|
append(domain)
|
||||||
append("/archive?")
|
append("/archive?&page=")
|
||||||
when {
|
append(page.toString())
|
||||||
!filter.query.isNullOrEmpty() -> {
|
|
||||||
append("keyword=")
|
|
||||||
append(filter.query.urlEncoded())
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> {
|
filter.query?.let {
|
||||||
if (filter.tags.isEmpty() && filter.states.isEmpty() && order == SortOrder.UPDATED) return parseMangaList(
|
append("&keyword=")
|
||||||
webClient.httpGet("https://$domain/?page=$page").parseHtml(),
|
append(filter.query.urlEncoded())
|
||||||
)
|
}
|
||||||
|
|
||||||
if (filter.tags.isNotEmpty()) {
|
filter.tags.forEach {
|
||||||
filter.tags.joinTo(this, "&") { it.key.substringAfter("archive?") }
|
append("&genre=")
|
||||||
}
|
append(it.key)
|
||||||
|
}
|
||||||
|
|
||||||
when (order) {
|
when (order) {
|
||||||
SortOrder.POPULARITY -> append("&sort=most_read")
|
SortOrder.POPULARITY -> append("&sort=most_read")
|
||||||
SortOrder.ALPHABETICAL -> append("&sort=a-z")
|
SortOrder.POPULARITY_ASC -> append("&sort=less_read")
|
||||||
SortOrder.NEWEST -> append("&sort=newest")
|
SortOrder.ALPHABETICAL -> append("&sort=a-z")
|
||||||
SortOrder.ALPHABETICAL_DESC -> append("&sort=z-a")
|
SortOrder.NEWEST -> append("&sort=newest")
|
||||||
else -> append("&sort=a-z")
|
SortOrder.NEWEST_ASC -> append("&sort=oldest")
|
||||||
}
|
SortOrder.ALPHABETICAL_DESC -> append("&sort=z-a")
|
||||||
when (filter.states.oneOrThrowIfMany()) {
|
else -> append("&sort=a-z")
|
||||||
MangaState.ONGOING -> append("&status=ongoing")
|
}
|
||||||
MangaState.FINISHED -> append("&status=completed")
|
|
||||||
MangaState.ABANDONED -> append("&status=dropped")
|
filter.states.forEach {
|
||||||
MangaState.PAUSED -> append("&status=paused")
|
when (it) {
|
||||||
else -> Unit
|
MangaState.ONGOING -> append("&status=ongoing")
|
||||||
}
|
MangaState.FINISHED -> append("&status=completed")
|
||||||
|
MangaState.ABANDONED -> append("&status=dropped")
|
||||||
|
MangaState.PAUSED -> append("&status=paused")
|
||||||
|
else -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
append("&page=$page")
|
|
||||||
|
filter.types.forEach {
|
||||||
|
append("&type=")
|
||||||
|
append(
|
||||||
|
when (it) {
|
||||||
|
ContentType.MANGA -> "manga"
|
||||||
|
ContentType.MANHUA -> "manhua"
|
||||||
|
ContentType.MANHWA -> "manhwa"
|
||||||
|
ContentType.ONE_SHOT -> "oneshot"
|
||||||
|
ContentType.OTHER -> "thai&type=vietnamese"
|
||||||
|
else -> ""
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filter.year != 0) {
|
||||||
|
append("&year=")
|
||||||
|
append(filter.year)
|
||||||
|
}
|
||||||
|
|
||||||
|
// author ( not query but same to tags )
|
||||||
|
// filter.author.forEach {
|
||||||
|
// append("&author=")
|
||||||
|
// append(it.key)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// artist ( not query but same to tags )
|
||||||
|
// filter.artist.forEach {
|
||||||
|
// append("&artist=")
|
||||||
|
// append(it.key)
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
val doc = webClient.httpGet(url).parseHtml()
|
val doc = webClient.httpGet(url).parseHtml()
|
||||||
return parseMangaList(doc)
|
return parseMangaList(doc)
|
||||||
@@ -104,11 +155,11 @@ internal abstract class MangaWorldParser(
|
|||||||
tags = tags,
|
tags = tags,
|
||||||
author = div.selectFirst(".author a")?.text(),
|
author = div.selectFirst(".author a")?.text(),
|
||||||
state =
|
state =
|
||||||
when (div.selectFirst(".status a")?.text()) {
|
when (div.selectFirst(".status a")?.text()?.lowercase()) {
|
||||||
"In corso" -> MangaState.ONGOING
|
"in corso" -> MangaState.ONGOING
|
||||||
"Finito" -> MangaState.FINISHED
|
"finito" -> MangaState.FINISHED
|
||||||
"Droppato" -> MangaState.ABANDONED
|
"droppato" -> MangaState.ABANDONED
|
||||||
"In pausa" -> MangaState.PAUSED
|
"in pausa" -> MangaState.PAUSED
|
||||||
else -> null
|
else -> null
|
||||||
},
|
},
|
||||||
source = source,
|
source = source,
|
||||||
@@ -120,23 +171,13 @@ internal abstract class MangaWorldParser(
|
|||||||
|
|
||||||
private suspend fun fetchAvailableTags(): Set<MangaTag> {
|
private suspend fun fetchAvailableTags(): Set<MangaTag> {
|
||||||
val doc = webClient.httpGet("https://$domain/").parseHtml()
|
val doc = webClient.httpGet("https://$domain/").parseHtml()
|
||||||
val genres = doc.select("div[aria-labelledby=genresDropdown] a").mapNotNullToSet {
|
return doc.select("div[aria-labelledby=genresDropdown] a").mapNotNullToSet {
|
||||||
MangaTag(
|
MangaTag(
|
||||||
key = it.attr("href"),
|
key = it.attr("href").substringAfterLast('='),
|
||||||
title = it.text().toTitleCase(sourceLocale),
|
title = it.text().toTitleCase(sourceLocale),
|
||||||
source = source,
|
source = source,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val types = doc.select("div[aria-labelledby=typesDropdown] a").mapNotNullToSet {
|
|
||||||
MangaTag(
|
|
||||||
key = it.attr("href"),
|
|
||||||
title = it.text().toTitleCase(sourceLocale),
|
|
||||||
source = source,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return genres + types
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getDetails(manga: Manga): Manga {
|
override suspend fun getDetails(manga: Manga): Manga {
|
||||||
@@ -154,7 +195,7 @@ internal abstract class MangaWorldParser(
|
|||||||
val url = a.attrAsRelativeUrl("href").toAbsoluteUrl(domain)
|
val url = a.attrAsRelativeUrl("href").toAbsoluteUrl(domain)
|
||||||
MangaChapter(
|
MangaChapter(
|
||||||
id = generateUid(url),
|
id = generateUid(url),
|
||||||
name = a.selectFirstOrThrow("span.d-inline-block").text(),
|
name = a.selectFirst("span.d-inline-block")?.text() ?: "Chapter : ${i + 1f}",
|
||||||
number = i + 1f,
|
number = i + 1f,
|
||||||
volume = 0,
|
volume = 0,
|
||||||
url = "$url?style=list",
|
url = "$url?style=list",
|
||||||
|
|||||||
@@ -33,9 +33,15 @@ internal abstract class MmrcmsParser(
|
|||||||
SortOrder.ALPHABETICAL_DESC,
|
SortOrder.ALPHABETICAL_DESC,
|
||||||
)
|
)
|
||||||
|
|
||||||
protected open val listUrl = "filterList"
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
protected open val tagUrl = "manga-list"
|
get() = MangaListFilterCapabilities(
|
||||||
protected open val datePattern = "dd MMM. yyyy"
|
isSearchSupported = true,
|
||||||
|
isSearchWithFiltersSupported = true,
|
||||||
|
)
|
||||||
|
|
||||||
|
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||||
|
availableTags = fetchAvailableTags(),
|
||||||
|
)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
paginator.firstPage = 1
|
paginator.firstPage = 1
|
||||||
@@ -63,69 +69,54 @@ internal abstract class MmrcmsParser(
|
|||||||
)
|
)
|
||||||
|
|
||||||
protected open val imgUpdated = "/cover/cover_250x350.jpg"
|
protected open val imgUpdated = "/cover/cover_250x350.jpg"
|
||||||
|
protected open val listUrl = "filterList"
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
protected open val tagUrl = "manga-list"
|
||||||
get() = MangaListFilterCapabilities(
|
protected open val datePattern = "dd MMM. yyyy"
|
||||||
isSearchSupported = true,
|
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
|
||||||
availableTags = fetchAvailableTags(),
|
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
when {
|
|
||||||
!filter.query.isNullOrEmpty() -> {
|
if (order == SortOrder.UPDATED) {
|
||||||
val url = buildString {
|
if (filter.query != null || filter.tags.isNotEmpty()) {
|
||||||
append("https://")
|
throw IllegalArgumentException("Sorting by update with filters is not supported by this source.")
|
||||||
append(domain)
|
|
||||||
append('/')
|
}
|
||||||
append(listUrl)
|
val url = buildString {
|
||||||
append("/?page=")
|
append("https://")
|
||||||
append(page.toString())
|
append(domain)
|
||||||
append("&asc=true&author=&tag=&alpha=")
|
append("/latest-release?page=")
|
||||||
append(filter.query.urlEncoded())
|
append(page.toString())
|
||||||
append("&cat=&sortBy=views")
|
}
|
||||||
}
|
return parseMangaListUpdated(webClient.httpGet(url).parseHtml())
|
||||||
return parseMangaList(webClient.httpGet(url).parseHtml())
|
}
|
||||||
|
|
||||||
|
val url = buildString {
|
||||||
|
append("https://")
|
||||||
|
append(domain)
|
||||||
|
append('/')
|
||||||
|
append(listUrl)
|
||||||
|
append("/?page=")
|
||||||
|
append(page.toString())
|
||||||
|
|
||||||
|
append("&author=&tag=&alpha=")
|
||||||
|
filter.query?.let {
|
||||||
|
append(filter.query.urlEncoded())
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
append("&cat=")
|
||||||
|
filter.tags.oneOrThrowIfMany()?.let {
|
||||||
|
append(it.key)
|
||||||
|
}
|
||||||
|
|
||||||
if (order == SortOrder.UPDATED) {
|
append("&sortBy=")
|
||||||
val url = buildString {
|
when (order) {
|
||||||
append("https://")
|
SortOrder.POPULARITY -> append("views&asc=false")
|
||||||
append(domain)
|
SortOrder.POPULARITY_ASC -> append("views&asc=true")
|
||||||
append("/latest-release?page=")
|
SortOrder.ALPHABETICAL -> append("name&asc=true")
|
||||||
append(page.toString())
|
SortOrder.ALPHABETICAL_DESC -> append("name&asc=false")
|
||||||
}
|
else -> append("name&asc=true")
|
||||||
return parseMangaListUpdated(webClient.httpGet(url).parseHtml())
|
|
||||||
|
|
||||||
} else {
|
|
||||||
val url = buildString {
|
|
||||||
append("https://")
|
|
||||||
append(domain)
|
|
||||||
append('/')
|
|
||||||
append(listUrl)
|
|
||||||
append("/?page=")
|
|
||||||
append(page.toString())
|
|
||||||
append("&author=&tag=&alpha=&cat=")
|
|
||||||
filter.tags.oneOrThrowIfMany()?.let {
|
|
||||||
append(it.key)
|
|
||||||
}
|
|
||||||
append("&sortBy=")
|
|
||||||
when (order) {
|
|
||||||
SortOrder.POPULARITY -> append("views&asc=false")
|
|
||||||
SortOrder.POPULARITY_ASC -> append("views&asc=true")
|
|
||||||
SortOrder.ALPHABETICAL -> append("name&asc=true")
|
|
||||||
SortOrder.ALPHABETICAL_DESC -> append("name&asc=false")
|
|
||||||
else -> append("name")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return parseMangaList(webClient.httpGet(url).parseHtml())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return parseMangaList(webClient.httpGet(url).parseHtml())
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun parseMangaList(doc: Document): List<Manga> {
|
protected open fun parseMangaList(doc: Document): List<Manga> {
|
||||||
@@ -136,9 +127,9 @@ internal abstract class MmrcmsParser(
|
|||||||
url = href,
|
url = href,
|
||||||
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
||||||
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
||||||
title = div.selectFirstOrThrow("div.media-body h5").text().orEmpty(),
|
title = div.selectFirst("div.media-body h5")?.text().orEmpty(),
|
||||||
altTitle = null,
|
altTitle = null,
|
||||||
rating = div.selectFirstOrThrow("span").ownText().toFloatOrNull()?.div(5f) ?: RATING_UNKNOWN,
|
rating = div.selectFirst("span")?.ownText()?.toFloat()?.div(5f) ?: RATING_UNKNOWN,
|
||||||
tags = emptySet(),
|
tags = emptySet(),
|
||||||
author = null,
|
author = null,
|
||||||
state = null,
|
state = null,
|
||||||
@@ -157,7 +148,7 @@ internal abstract class MmrcmsParser(
|
|||||||
url = href,
|
url = href,
|
||||||
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
||||||
coverUrl = "https://$domain/uploads/manga/$deeplink$imgUpdated",
|
coverUrl = "https://$domain/uploads/manga/$deeplink$imgUpdated",
|
||||||
title = div.selectFirstOrThrow("h3 a").text().orEmpty(),
|
title = div.selectFirst("h3 a")?.text().orEmpty(),
|
||||||
altTitle = null,
|
altTitle = null,
|
||||||
rating = RATING_UNKNOWN,
|
rating = RATING_UNKNOWN,
|
||||||
tags = emptySet(),
|
tags = emptySet(),
|
||||||
@@ -233,7 +224,7 @@ internal abstract class MmrcmsParser(
|
|||||||
val dateText = li.selectFirst(selectDate)?.text()
|
val dateText = li.selectFirst(selectDate)?.text()
|
||||||
MangaChapter(
|
MangaChapter(
|
||||||
id = generateUid(href),
|
id = generateUid(href),
|
||||||
name = li.selectFirstOrThrow("h5").text(),
|
name = li.selectFirst("h5")?.text() ?: "Chapter : ${i + 1f}",
|
||||||
number = i + 1f,
|
number = i + 1f,
|
||||||
volume = 0,
|
volume = 0,
|
||||||
url = href,
|
url = href,
|
||||||
|
|||||||
@@ -20,15 +20,6 @@ internal abstract class OtakuSanctuaryParser(
|
|||||||
|
|
||||||
override val configKeyDomain = ConfigKey.Domain(domain)
|
override val configKeyDomain = ConfigKey.Domain(domain)
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
|
||||||
get() = MangaListFilterCapabilities(
|
|
||||||
isSearchSupported = true,
|
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
|
||||||
availableTags = fetchAvailableTags(),
|
|
||||||
)
|
|
||||||
|
|
||||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||||
super.onCreateConfig(keys)
|
super.onCreateConfig(keys)
|
||||||
keys.add(userAgentKey)
|
keys.add(userAgentKey)
|
||||||
@@ -39,6 +30,15 @@ internal abstract class OtakuSanctuaryParser(
|
|||||||
SortOrder.NEWEST,
|
SortOrder.NEWEST,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
|
get() = MangaListFilterCapabilities(
|
||||||
|
isSearchSupported = true,
|
||||||
|
)
|
||||||
|
|
||||||
|
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||||
|
availableTags = fetchAvailableTags(),
|
||||||
|
)
|
||||||
|
|
||||||
protected open val listUrl = "Manga/Newest"
|
protected open val listUrl = "Manga/Newest"
|
||||||
protected open val datePattern = "dd/MM/yyyy"
|
protected open val datePattern = "dd/MM/yyyy"
|
||||||
protected open val lang = ""
|
protected open val lang = ""
|
||||||
@@ -110,10 +110,10 @@ internal abstract class OtakuSanctuaryParser(
|
|||||||
id = generateUid(href),
|
id = generateUid(href),
|
||||||
url = href,
|
url = href,
|
||||||
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
||||||
coverUrl = div.selectFirstOrThrow("img").src().orEmpty(),
|
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
||||||
title = div.selectFirstOrThrow("h4").text().orEmpty(),
|
title = div.selectFirst("h4")?.text().orEmpty(),
|
||||||
altTitle = null,
|
altTitle = null,
|
||||||
rating = div.selectFirst(".rating")?.ownText()?.toFloatOrNull()?.div(10f) ?: RATING_UNKNOWN,
|
rating = div.selectFirst(".rating")?.ownText()?.toFloat()?.div(10f) ?: RATING_UNKNOWN,
|
||||||
tags = emptySet(),
|
tags = emptySet(),
|
||||||
author = null,
|
author = null,
|
||||||
state = null,
|
state = null,
|
||||||
@@ -147,7 +147,7 @@ internal abstract class OtakuSanctuaryParser(
|
|||||||
val fullUrl = manga.url.toAbsoluteUrl(domain)
|
val fullUrl = manga.url.toAbsoluteUrl(domain)
|
||||||
val doc = webClient.httpGet(fullUrl).parseHtml()
|
val doc = webClient.httpGet(fullUrl).parseHtml()
|
||||||
|
|
||||||
val desc = doc.selectFirstOrThrow(selectDesc).html()
|
val desc = doc.selectFirst(selectDesc)?.html()
|
||||||
|
|
||||||
val stateDiv = doc.selectFirst(selectState)
|
val stateDiv = doc.selectFirst(selectState)
|
||||||
|
|
||||||
|
|||||||
@@ -14,12 +14,17 @@ import java.util.*
|
|||||||
@MangaSourceParser("BRMANGAS", "BrMangas", "pt")
|
@MangaSourceParser("BRMANGAS", "BrMangas", "pt")
|
||||||
internal class BrMangas(context: MangaLoaderContext) : PagedMangaParser(context, MangaParserSource.BRMANGAS, 25) {
|
internal class BrMangas(context: MangaLoaderContext) : PagedMangaParser(context, MangaParserSource.BRMANGAS, 25) {
|
||||||
|
|
||||||
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.POPULARITY, SortOrder.UPDATED)
|
|
||||||
|
|
||||||
override val configKeyDomain = ConfigKey.Domain("www.brmangas.net")
|
override val configKeyDomain = ConfigKey.Domain("www.brmangas.net")
|
||||||
|
|
||||||
override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP)
|
override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP)
|
||||||
|
|
||||||
|
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||||
|
super.onCreateConfig(keys)
|
||||||
|
keys.add(userAgentKey)
|
||||||
|
}
|
||||||
|
|
||||||
|
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.POPULARITY, SortOrder.UPDATED)
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
get() = MangaListFilterCapabilities(
|
get() = MangaListFilterCapabilities(
|
||||||
isSearchSupported = true,
|
isSearchSupported = true,
|
||||||
@@ -29,11 +34,6 @@ internal class BrMangas(context: MangaLoaderContext) : PagedMangaParser(context,
|
|||||||
availableTags = fetchAvailableTags(),
|
availableTags = fetchAvailableTags(),
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
|
||||||
super.onCreateConfig(keys)
|
|
||||||
keys.add(userAgentKey)
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
val url = buildString {
|
val url = buildString {
|
||||||
append("https://")
|
append("https://")
|
||||||
|
|||||||
@@ -11,6 +11,13 @@ import java.util.*
|
|||||||
@MangaSourceParser("LERMANGA", "LerManga", "pt")
|
@MangaSourceParser("LERMANGA", "LerManga", "pt")
|
||||||
internal class LerManga(context: MangaLoaderContext) : PagedMangaParser(context, MangaParserSource.LERMANGA, 24) {
|
internal class LerManga(context: MangaLoaderContext) : PagedMangaParser(context, MangaParserSource.LERMANGA, 24) {
|
||||||
|
|
||||||
|
override val configKeyDomain = ConfigKey.Domain("lermanga.org")
|
||||||
|
|
||||||
|
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||||
|
super.onCreateConfig(keys)
|
||||||
|
keys.add(userAgentKey)
|
||||||
|
}
|
||||||
|
|
||||||
override val availableSortOrders: Set<SortOrder> =
|
override val availableSortOrders: Set<SortOrder> =
|
||||||
EnumSet.of(
|
EnumSet.of(
|
||||||
SortOrder.UPDATED,
|
SortOrder.UPDATED,
|
||||||
@@ -23,8 +30,6 @@ internal class LerManga(context: MangaLoaderContext) : PagedMangaParser(context,
|
|||||||
SortOrder.RATING_ASC,
|
SortOrder.RATING_ASC,
|
||||||
)
|
)
|
||||||
|
|
||||||
override val configKeyDomain = ConfigKey.Domain("lermanga.org")
|
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
get() = MangaListFilterCapabilities()
|
get() = MangaListFilterCapabilities()
|
||||||
|
|
||||||
@@ -32,11 +37,6 @@ internal class LerManga(context: MangaLoaderContext) : PagedMangaParser(context,
|
|||||||
availableTags = fetchAvailableTags(),
|
availableTags = fetchAvailableTags(),
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
|
||||||
super.onCreateConfig(keys)
|
|
||||||
keys.add(userAgentKey)
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
val url = buildString {
|
val url = buildString {
|
||||||
append("https://")
|
append("https://")
|
||||||
|
|||||||
@@ -16,8 +16,6 @@ import java.util.*
|
|||||||
internal class LerMangaOnline(context: MangaLoaderContext) :
|
internal class LerMangaOnline(context: MangaLoaderContext) :
|
||||||
PagedMangaParser(context, MangaParserSource.LERMANGAONLINE, 20) {
|
PagedMangaParser(context, MangaParserSource.LERMANGAONLINE, 20) {
|
||||||
|
|
||||||
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.UPDATED)
|
|
||||||
|
|
||||||
override val configKeyDomain = ConfigKey.Domain("lermangaonline.com.br")
|
override val configKeyDomain = ConfigKey.Domain("lermangaonline.com.br")
|
||||||
|
|
||||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||||
@@ -25,6 +23,8 @@ internal class LerMangaOnline(context: MangaLoaderContext) :
|
|||||||
keys.add(userAgentKey)
|
keys.add(userAgentKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.UPDATED)
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
get() = MangaListFilterCapabilities(
|
get() = MangaListFilterCapabilities(
|
||||||
isSearchSupported = true,
|
isSearchSupported = true,
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ internal class LuratoonScansParser(context: MangaLoaderContext) :
|
|||||||
SinglePageMangaParser(context, MangaParserSource.RANDOMSCANS),
|
SinglePageMangaParser(context, MangaParserSource.RANDOMSCANS),
|
||||||
Interceptor {
|
Interceptor {
|
||||||
|
|
||||||
override val availableSortOrders = setOf(SortOrder.ALPHABETICAL)
|
|
||||||
|
|
||||||
override val configKeyDomain = ConfigKey.Domain("luratoons.com")
|
override val configKeyDomain = ConfigKey.Domain("luratoons.com")
|
||||||
|
|
||||||
override fun getRequestHeaders(): Headers = Headers.Builder().add("User-Agent", config[userAgentKey]).build()
|
override fun getRequestHeaders(): Headers = Headers.Builder().add("User-Agent", config[userAgentKey]).build()
|
||||||
|
|
||||||
|
override val availableSortOrders = setOf(SortOrder.ALPHABETICAL)
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
get() = MangaListFilterCapabilities()
|
get() = MangaListFilterCapabilities()
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import java.util.*
|
|||||||
@MangaSourceParser("MANGAONLINE", "MangaOnline.biz", "pt")
|
@MangaSourceParser("MANGAONLINE", "MangaOnline.biz", "pt")
|
||||||
internal class MangaOnline(context: MangaLoaderContext) : PagedMangaParser(context, MangaParserSource.MANGAONLINE, 20) {
|
internal class MangaOnline(context: MangaLoaderContext) : PagedMangaParser(context, MangaParserSource.MANGAONLINE, 20) {
|
||||||
|
|
||||||
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.UPDATED)
|
|
||||||
|
|
||||||
override val configKeyDomain = ConfigKey.Domain("mangaonline.biz")
|
override val configKeyDomain = ConfigKey.Domain("mangaonline.biz")
|
||||||
|
|
||||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||||
@@ -21,6 +19,9 @@ internal class MangaOnline(context: MangaLoaderContext) : PagedMangaParser(conte
|
|||||||
keys.add(userAgentKey)
|
keys.add(userAgentKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.UPDATED)
|
||||||
|
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
get() = MangaListFilterCapabilities(
|
get() = MangaListFilterCapabilities(
|
||||||
isSearchSupported = true,
|
isSearchSupported = true,
|
||||||
@@ -39,7 +40,6 @@ internal class MangaOnline(context: MangaLoaderContext) : PagedMangaParser(conte
|
|||||||
!filter.query.isNullOrEmpty() -> {
|
!filter.query.isNullOrEmpty() -> {
|
||||||
append("/search/")
|
append("/search/")
|
||||||
append(filter.query.urlEncoded())
|
append(filter.query.urlEncoded())
|
||||||
append('/')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
@@ -47,16 +47,15 @@ internal class MangaOnline(context: MangaLoaderContext) : PagedMangaParser(conte
|
|||||||
filter.tags.oneOrThrowIfMany()?.let {
|
filter.tags.oneOrThrowIfMany()?.let {
|
||||||
append("/genero/")
|
append("/genero/")
|
||||||
append(it.key)
|
append(it.key)
|
||||||
append('/')
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
append("/manga/")
|
append("/manga")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (page > 1) {
|
if (page > 1) {
|
||||||
append("page/")
|
append("/page/")
|
||||||
append(page.toString())
|
append(page.toString())
|
||||||
append('/')
|
append('/')
|
||||||
}
|
}
|
||||||
@@ -69,10 +68,10 @@ internal class MangaOnline(context: MangaLoaderContext) : PagedMangaParser(conte
|
|||||||
id = generateUid(href),
|
id = generateUid(href),
|
||||||
url = href,
|
url = href,
|
||||||
publicUrl = a.attrAsAbsoluteUrl("href"),
|
publicUrl = a.attrAsAbsoluteUrl("href"),
|
||||||
title = div.selectLastOrThrow(".data h3").text(),
|
title = div.selectLast(".data h3")?.text().orEmpty(),
|
||||||
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
||||||
altTitle = null,
|
altTitle = null,
|
||||||
rating = div.selectFirst(".rating")?.ownText()?.toFloatOrNull()?.div(10f) ?: RATING_UNKNOWN,
|
rating = div.selectFirst(".rating")?.ownText()?.toFloat()?.div(10f) ?: RATING_UNKNOWN,
|
||||||
tags = emptySet(),
|
tags = emptySet(),
|
||||||
description = null,
|
description = null,
|
||||||
state = null,
|
state = null,
|
||||||
@@ -98,7 +97,7 @@ internal class MangaOnline(context: MangaLoaderContext) : PagedMangaParser(conte
|
|||||||
val doc = webClient.httpGet(manga.url.toAbsoluteUrl(domain)).parseHtml()
|
val doc = webClient.httpGet(manga.url.toAbsoluteUrl(domain)).parseHtml()
|
||||||
val dateFormat = SimpleDateFormat("dd/MM/yyyy", Locale.ROOT)
|
val dateFormat = SimpleDateFormat("dd/MM/yyyy", Locale.ROOT)
|
||||||
return manga.copy(
|
return manga.copy(
|
||||||
description = doc.selectLastOrThrow(".data p").html(),
|
description = doc.selectLast(".data p")?.html(),
|
||||||
tags = doc.selectFirst(".sgeneros")?.select("a")?.mapNotNullToSet { a ->
|
tags = doc.selectFirst(".sgeneros")?.select("a")?.mapNotNullToSet { a ->
|
||||||
MangaTag(
|
MangaTag(
|
||||||
key = a.attr("href").removeSuffix("/").substringAfterLast("/", ""),
|
key = a.attr("href").removeSuffix("/").substringAfterLast("/", ""),
|
||||||
@@ -109,7 +108,7 @@ internal class MangaOnline(context: MangaLoaderContext) : PagedMangaParser(conte
|
|||||||
chapters = doc.select(".episodios li a").mapChapters(reversed = true) { i, a ->
|
chapters = doc.select(".episodios li a").mapChapters(reversed = true) { i, a ->
|
||||||
val href = a.attrAsRelativeUrl("href")
|
val href = a.attrAsRelativeUrl("href")
|
||||||
val title = a.html().substringBeforeLast("<span")
|
val title = a.html().substringBeforeLast("<span")
|
||||||
val dateText = a.selectFirstOrThrow("span.date").text()
|
val dateText = a.selectFirst("span.date")?.text()
|
||||||
MangaChapter(
|
MangaChapter(
|
||||||
id = generateUid(href),
|
id = generateUid(href),
|
||||||
name = title,
|
name = title,
|
||||||
@@ -135,7 +134,7 @@ internal class MangaOnline(context: MangaLoaderContext) : PagedMangaParser(conte
|
|||||||
id = generateUid(href),
|
id = generateUid(href),
|
||||||
url = href,
|
url = href,
|
||||||
publicUrl = a.attrAsAbsoluteUrl("href"),
|
publicUrl = a.attrAsAbsoluteUrl("href"),
|
||||||
title = div.selectLastOrThrow(".reltitle h3").text(),
|
title = div.selectLast(".reltitle h3")?.text().orEmpty(),
|
||||||
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
||||||
altTitle = null,
|
altTitle = null,
|
||||||
rating = RATING_UNKNOWN,
|
rating = RATING_UNKNOWN,
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ import java.util.*
|
|||||||
@MangaSourceParser("MUITOHENTAI", "MuitoHentai", "pt", ContentType.HENTAI)
|
@MangaSourceParser("MUITOHENTAI", "MuitoHentai", "pt", ContentType.HENTAI)
|
||||||
internal class MuitoHentai(context: MangaLoaderContext) : PagedMangaParser(context, MangaParserSource.MUITOHENTAI, 24) {
|
internal class MuitoHentai(context: MangaLoaderContext) : PagedMangaParser(context, MangaParserSource.MUITOHENTAI, 24) {
|
||||||
|
|
||||||
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.POPULARITY)
|
|
||||||
|
|
||||||
override val configKeyDomain = ConfigKey.Domain("www.muitohentai.com")
|
override val configKeyDomain = ConfigKey.Domain("www.muitohentai.com")
|
||||||
|
|
||||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||||
@@ -20,6 +18,8 @@ internal class MuitoHentai(context: MangaLoaderContext) : PagedMangaParser(conte
|
|||||||
keys.add(userAgentKey)
|
keys.add(userAgentKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.POPULARITY)
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
get() = MangaListFilterCapabilities(
|
get() = MangaListFilterCapabilities(
|
||||||
isSearchSupported = true,
|
isSearchSupported = true,
|
||||||
|
|||||||
@@ -13,20 +13,20 @@ import java.util.*
|
|||||||
@MangaSourceParser("ONEPIECEEX", "OnePieceEx", "pt")
|
@MangaSourceParser("ONEPIECEEX", "OnePieceEx", "pt")
|
||||||
internal class OnePieceEx(context: MangaLoaderContext) : SinglePageMangaParser(context, MangaParserSource.ONEPIECEEX) {
|
internal class OnePieceEx(context: MangaLoaderContext) : SinglePageMangaParser(context, MangaParserSource.ONEPIECEEX) {
|
||||||
|
|
||||||
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.UPDATED)
|
|
||||||
|
|
||||||
override val configKeyDomain = ConfigKey.Domain("onepieceex.net")
|
override val configKeyDomain = ConfigKey.Domain("onepieceex.net")
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
|
||||||
get() = MangaListFilterCapabilities()
|
|
||||||
|
|
||||||
override suspend fun getFilterOptions() = MangaListFilterOptions()
|
|
||||||
|
|
||||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||||
super.onCreateConfig(keys)
|
super.onCreateConfig(keys)
|
||||||
keys.add(userAgentKey)
|
keys.add(userAgentKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.UPDATED)
|
||||||
|
|
||||||
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
|
get() = MangaListFilterCapabilities()
|
||||||
|
|
||||||
|
override suspend fun getFilterOptions() = MangaListFilterOptions()
|
||||||
|
|
||||||
override suspend fun getList(order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getList(order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
return listOf(
|
return listOf(
|
||||||
Manga(
|
Manga(
|
||||||
|
|||||||
@@ -16,9 +16,15 @@ import java.util.*
|
|||||||
internal class YugenMangas(context: MangaLoaderContext) :
|
internal class YugenMangas(context: MangaLoaderContext) :
|
||||||
SinglePageMangaParser(context, MangaParserSource.YUGENMANGAS) {
|
SinglePageMangaParser(context, MangaParserSource.YUGENMANGAS) {
|
||||||
|
|
||||||
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.UPDATED, SortOrder.ALPHABETICAL)
|
|
||||||
override val configKeyDomain = ConfigKey.Domain("yugenmangasbr.voblog.xyz")
|
override val configKeyDomain = ConfigKey.Domain("yugenmangasbr.voblog.xyz")
|
||||||
|
|
||||||
|
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||||
|
super.onCreateConfig(keys)
|
||||||
|
keys.add(userAgentKey)
|
||||||
|
}
|
||||||
|
|
||||||
|
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.UPDATED, SortOrder.ALPHABETICAL)
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
get() = MangaListFilterCapabilities(
|
get() = MangaListFilterCapabilities(
|
||||||
isSearchSupported = true,
|
isSearchSupported = true,
|
||||||
@@ -26,11 +32,6 @@ internal class YugenMangas(context: MangaLoaderContext) :
|
|||||||
|
|
||||||
override suspend fun getFilterOptions() = MangaListFilterOptions()
|
override suspend fun getFilterOptions() = MangaListFilterOptions()
|
||||||
|
|
||||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
|
||||||
super.onCreateConfig(keys)
|
|
||||||
keys.add(userAgentKey)
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun getList(order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getList(order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
val json = when {
|
val json = when {
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ internal abstract class ScanParser(
|
|||||||
url = href,
|
url = href,
|
||||||
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
||||||
coverUrl = div.selectFirst("img")?.attr("data-src")?.replace("\t", "").orEmpty(),
|
coverUrl = div.selectFirst("img")?.attr("data-src")?.replace("\t", "").orEmpty(),
|
||||||
title = div.selectFirstOrThrow(".link-series h3, .item-title").text().orEmpty(),
|
title = div.selectFirst(".link-series h3, .item-title")?.text().orEmpty(),
|
||||||
altTitle = null,
|
altTitle = null,
|
||||||
rating = RATING_UNKNOWN,
|
rating = RATING_UNKNOWN,
|
||||||
tags = emptySet(),
|
tags = emptySet(),
|
||||||
@@ -154,12 +154,13 @@ internal abstract class ScanParser(
|
|||||||
val href = div.selectFirstOrThrow("a").attrAsRelativeUrl("href")
|
val href = div.selectFirstOrThrow("a").attrAsRelativeUrl("href")
|
||||||
MangaChapter(
|
MangaChapter(
|
||||||
id = generateUid(href),
|
id = generateUid(href),
|
||||||
name = div.selectFirstOrThrow("h5").html().substringBefore("<div").substringAfter("</span>"),
|
name = div.selectFirst("h5")?.html()?.substringBefore("<div")?.substringAfter("</span>")
|
||||||
|
.orEmpty(),
|
||||||
number = i + 1f,
|
number = i + 1f,
|
||||||
volume = 0,
|
volume = 0,
|
||||||
url = href,
|
url = href,
|
||||||
scanlator = null,
|
scanlator = null,
|
||||||
uploadDate = dateFormat.tryParse(doc.selectFirstOrThrow("h5 div").text()),
|
uploadDate = dateFormat.tryParse(doc.selectFirst("h5 div")?.text()),
|
||||||
branch = null,
|
branch = null,
|
||||||
source = source,
|
source = source,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -28,8 +28,15 @@ internal abstract class SinmhParser(
|
|||||||
SortOrder.POPULARITY,
|
SortOrder.POPULARITY,
|
||||||
)
|
)
|
||||||
|
|
||||||
protected open val searchUrl = "search/"
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
protected open val listUrl = "list/"
|
get() = MangaListFilterCapabilities(
|
||||||
|
isSearchSupported = true,
|
||||||
|
)
|
||||||
|
|
||||||
|
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||||
|
availableTags = fetchAvailableTags(),
|
||||||
|
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED),
|
||||||
|
)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
paginator.firstPage = 1
|
paginator.firstPage = 1
|
||||||
@@ -46,15 +53,8 @@ internal abstract class SinmhParser(
|
|||||||
"已完结",
|
"已完结",
|
||||||
)
|
)
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
protected open val searchUrl = "search/"
|
||||||
get() = MangaListFilterCapabilities(
|
protected open val listUrl = "list/"
|
||||||
isSearchSupported = true,
|
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
|
||||||
availableTags = fetchAvailableTags(),
|
|
||||||
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED),
|
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
val url = buildString {
|
val url = buildString {
|
||||||
@@ -93,7 +93,7 @@ internal abstract class SinmhParser(
|
|||||||
when (order) {
|
when (order) {
|
||||||
SortOrder.POPULARITY -> append("click/")
|
SortOrder.POPULARITY -> append("click/")
|
||||||
SortOrder.UPDATED -> append("update/")
|
SortOrder.UPDATED -> append("update/")
|
||||||
else -> append("/")
|
else -> append('/')
|
||||||
}
|
}
|
||||||
append(page.toString())
|
append(page.toString())
|
||||||
append('/')
|
append('/')
|
||||||
@@ -113,7 +113,7 @@ internal abstract class SinmhParser(
|
|||||||
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
||||||
title = div.selectFirst("p > a, h3 > a")?.text().orEmpty(),
|
title = div.selectFirst("p > a, h3 > a")?.text().orEmpty(),
|
||||||
altTitle = null,
|
altTitle = null,
|
||||||
rating = div.selectFirst("span.total_votes")?.ownText()?.toFloatOrNull()?.div(5f) ?: -1f,
|
rating = div.selectFirst("span.total_votes")?.ownText()?.toFloat()?.div(5f) ?: RATING_UNKNOWN,
|
||||||
tags = emptySet(),
|
tags = emptySet(),
|
||||||
author = null,
|
author = null,
|
||||||
state = null,
|
state = null,
|
||||||
@@ -142,13 +142,9 @@ internal abstract class SinmhParser(
|
|||||||
override suspend fun getDetails(manga: Manga): Manga = coroutineScope {
|
override suspend fun getDetails(manga: Manga): Manga = coroutineScope {
|
||||||
val fullUrl = manga.url.toAbsoluteUrl(domain)
|
val fullUrl = manga.url.toAbsoluteUrl(domain)
|
||||||
val doc = webClient.httpGet(fullUrl).parseHtml()
|
val doc = webClient.httpGet(fullUrl).parseHtml()
|
||||||
val body = doc.body()
|
|
||||||
|
|
||||||
val chapters = getChapters(doc)
|
val chapters = getChapters(doc)
|
||||||
|
val desc = doc.selectFirst(selectDesc)?.html()
|
||||||
val desc = body.selectFirst(selectDesc)?.html()
|
val state = doc.selectFirst(selectState)?.let {
|
||||||
|
|
||||||
val state = body.selectFirst(selectState)?.let {
|
|
||||||
when (it.text()) {
|
when (it.text()) {
|
||||||
in ongoing -> MangaState.ONGOING
|
in ongoing -> MangaState.ONGOING
|
||||||
in finished -> MangaState.FINISHED
|
in finished -> MangaState.FINISHED
|
||||||
@@ -174,11 +170,11 @@ internal abstract class SinmhParser(
|
|||||||
|
|
||||||
protected open suspend fun getChapters(doc: Document): List<MangaChapter> {
|
protected open suspend fun getChapters(doc: Document): List<MangaChapter> {
|
||||||
return doc.body().select(selectChapter).mapChapters { i, li ->
|
return doc.body().select(selectChapter).mapChapters { i, li ->
|
||||||
val href = li.selectFirstOrThrow("a").attrAsRelativeUrl("href")
|
val a = li.selectFirstOrThrow("a")
|
||||||
val name = li.selectFirstOrThrow("a").text()
|
val href = a.attrAsRelativeUrl("href")
|
||||||
MangaChapter(
|
MangaChapter(
|
||||||
id = generateUid(href),
|
id = generateUid(href),
|
||||||
name = name,
|
name = a.text(),
|
||||||
number = i + 1f,
|
number = i + 1f,
|
||||||
volume = 0,
|
volume = 0,
|
||||||
url = href,
|
url = href,
|
||||||
|
|||||||
@@ -16,8 +16,6 @@ import java.util.*
|
|||||||
@MangaSourceParser("MANGAAY", "MangaAy", "tr")
|
@MangaSourceParser("MANGAAY", "MangaAy", "tr")
|
||||||
internal class MangaAy(context: MangaLoaderContext) : PagedMangaParser(context, MangaParserSource.MANGAAY, 45) {
|
internal class MangaAy(context: MangaLoaderContext) : PagedMangaParser(context, MangaParserSource.MANGAAY, 45) {
|
||||||
|
|
||||||
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.UPDATED)
|
|
||||||
|
|
||||||
override val configKeyDomain = ConfigKey.Domain("manga-ay.com")
|
override val configKeyDomain = ConfigKey.Domain("manga-ay.com")
|
||||||
|
|
||||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||||
@@ -25,6 +23,8 @@ internal class MangaAy(context: MangaLoaderContext) : PagedMangaParser(context,
|
|||||||
keys.add(userAgentKey)
|
keys.add(userAgentKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.UPDATED)
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
get() = MangaListFilterCapabilities(
|
get() = MangaListFilterCapabilities(
|
||||||
isSearchSupported = true,
|
isSearchSupported = true,
|
||||||
@@ -68,7 +68,7 @@ internal class MangaAy(context: MangaLoaderContext) : PagedMangaParser(context,
|
|||||||
append(domain)
|
append(domain)
|
||||||
append("/seriler")
|
append("/seriler")
|
||||||
if (page > 1) {
|
if (page > 1) {
|
||||||
append("/")
|
append('/')
|
||||||
append(page)
|
append(page)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ internal class MangaAy(context: MangaLoaderContext) : PagedMangaParser(context,
|
|||||||
id = generateUid(href),
|
id = generateUid(href),
|
||||||
url = href,
|
url = href,
|
||||||
publicUrl = a.attrAsAbsoluteUrl("href"),
|
publicUrl = a.attrAsAbsoluteUrl("href"),
|
||||||
title = div.selectLastOrThrow(".item-name").text(),
|
title = div.selectLast(".item-name")?.text().orEmpty(),
|
||||||
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
||||||
altTitle = null,
|
altTitle = null,
|
||||||
rating = RATING_UNKNOWN,
|
rating = RATING_UNKNOWN,
|
||||||
|
|||||||
@@ -12,27 +12,29 @@ import java.util.*
|
|||||||
@MangaSourceParser("SADSCANS", "SadScans", "tr")
|
@MangaSourceParser("SADSCANS", "SadScans", "tr")
|
||||||
internal class SadScans(context: MangaLoaderContext) : SinglePageMangaParser(context, MangaParserSource.SADSCANS) {
|
internal class SadScans(context: MangaLoaderContext) : SinglePageMangaParser(context, MangaParserSource.SADSCANS) {
|
||||||
|
|
||||||
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.ALPHABETICAL)
|
|
||||||
override val configKeyDomain = ConfigKey.Domain("sadscans.com")
|
override val configKeyDomain = ConfigKey.Domain("sadscans.com")
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
|
||||||
get() = MangaListFilterCapabilities(
|
|
||||||
isSearchSupported = true,
|
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getFilterOptions() = MangaListFilterOptions()
|
|
||||||
|
|
||||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||||
super.onCreateConfig(keys)
|
super.onCreateConfig(keys)
|
||||||
keys.add(userAgentKey)
|
keys.add(userAgentKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.ALPHABETICAL)
|
||||||
|
|
||||||
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
|
get() = MangaListFilterCapabilities(
|
||||||
|
isSearchSupported = true,
|
||||||
|
isSearchWithFiltersSupported = true,
|
||||||
|
)
|
||||||
|
|
||||||
|
override suspend fun getFilterOptions() = MangaListFilterOptions()
|
||||||
|
|
||||||
override suspend fun getList(order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getList(order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
val url = buildString {
|
val url = buildString {
|
||||||
append("https://")
|
append("https://")
|
||||||
append(domain)
|
append(domain)
|
||||||
append("/series")
|
append("/series")
|
||||||
if (!filter.query.isNullOrEmpty()) {
|
filter.query?.let {
|
||||||
append("?search=")
|
append("?search=")
|
||||||
append(filter.query.urlEncoded())
|
append(filter.query.urlEncoded())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ internal class TrWebtoon(context: MangaLoaderContext) :
|
|||||||
override val filterCapabilities: MangaListFilterCapabilities
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
get() = MangaListFilterCapabilities(
|
get() = MangaListFilterCapabilities(
|
||||||
isSearchSupported = true,
|
isSearchSupported = true,
|
||||||
|
isSearchWithFiltersSupported = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||||
@@ -42,67 +43,56 @@ internal class TrWebtoon(context: MangaLoaderContext) :
|
|||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
when {
|
if (order == SortOrder.UPDATED) {
|
||||||
!filter.query.isNullOrEmpty() -> {
|
if (filter.tags.isNotEmpty() || filter.states.isNotEmpty() || filter.query != null) {
|
||||||
val url = buildString {
|
throw IllegalArgumentException("Sorting by update with filters is not supported by this source.")
|
||||||
append("https://")
|
}
|
||||||
append(domain)
|
val url = buildString {
|
||||||
append("/webtoon-listesi?page=")
|
append("https://")
|
||||||
append(page.toString())
|
append(domain)
|
||||||
|
append("/son-eklenenler?page=")
|
||||||
|
append(page.toString())
|
||||||
|
}
|
||||||
|
return parseMangaListUpdated(webClient.httpGet(url).parseHtml())
|
||||||
|
} else {
|
||||||
|
val url = buildString {
|
||||||
|
append("https://")
|
||||||
|
append(domain)
|
||||||
|
append("/webtoon-listesi?page=")
|
||||||
|
append(page.toString())
|
||||||
|
|
||||||
|
filter.query?.let {
|
||||||
append("&q=")
|
append("&q=")
|
||||||
append(filter.query.urlEncoded())
|
append(filter.query.urlEncoded())
|
||||||
append("&sort=views&short_type=DESC")
|
|
||||||
}
|
|
||||||
return parseMangaList(webClient.httpGet(url).parseHtml())
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> {
|
|
||||||
|
|
||||||
if (order == SortOrder.UPDATED) {
|
|
||||||
if (filter.tags.isNotEmpty()) {
|
|
||||||
throw IllegalArgumentException("Sort order updated + Tags or States is not supported by this source")
|
|
||||||
}
|
|
||||||
val url = buildString {
|
|
||||||
append("https://")
|
|
||||||
append(domain)
|
|
||||||
append("/son-eklenenler?page=")
|
|
||||||
append(page.toString())
|
|
||||||
}
|
|
||||||
return parseMangaListUpdated(webClient.httpGet(url).parseHtml())
|
|
||||||
} else {
|
|
||||||
val url = buildString {
|
|
||||||
append("https://")
|
|
||||||
append(domain)
|
|
||||||
append("/webtoon-listesi?page=")
|
|
||||||
append(page.toString())
|
|
||||||
filter.tags.oneOrThrowIfMany()?.let {
|
|
||||||
append("&genre=")
|
|
||||||
append(it.key)
|
|
||||||
}
|
|
||||||
filter.states.oneOrThrowIfMany()?.let {
|
|
||||||
append("&status=")
|
|
||||||
append(
|
|
||||||
when (it) {
|
|
||||||
MangaState.ONGOING -> "continues"
|
|
||||||
MangaState.FINISHED -> "complated"
|
|
||||||
else -> ""
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
append("&sort=")
|
|
||||||
when (order) {
|
|
||||||
SortOrder.POPULARITY -> append("views&short_type=DESC")
|
|
||||||
SortOrder.POPULARITY_ASC -> append("views&short_type=ASC")
|
|
||||||
SortOrder.ALPHABETICAL -> append("name&short_type=ASC")
|
|
||||||
SortOrder.ALPHABETICAL_DESC -> append("name&short_type=DESC")
|
|
||||||
else -> append("views&short_type=DESC")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return parseMangaList(webClient.httpGet(url).parseHtml())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filter.tags.oneOrThrowIfMany()?.let {
|
||||||
|
append("&genre=")
|
||||||
|
append(it.key)
|
||||||
|
}
|
||||||
|
|
||||||
|
filter.states.oneOrThrowIfMany()?.let {
|
||||||
|
append("&status=")
|
||||||
|
append(
|
||||||
|
when (it) {
|
||||||
|
MangaState.ONGOING -> "continues"
|
||||||
|
MangaState.FINISHED -> "complated"
|
||||||
|
else -> ""
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
append("&sort=")
|
||||||
|
when (order) {
|
||||||
|
SortOrder.POPULARITY -> append("views&short_type=DESC")
|
||||||
|
SortOrder.POPULARITY_ASC -> append("views&short_type=ASC")
|
||||||
|
SortOrder.ALPHABETICAL -> append("name&short_type=ASC")
|
||||||
|
SortOrder.ALPHABETICAL_DESC -> append("name&short_type=DESC")
|
||||||
|
else -> append("views&short_type=DESC")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return parseMangaList(webClient.httpGet(url).parseHtml())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +170,7 @@ internal class TrWebtoon(context: MangaLoaderContext) :
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
description = doc.select("p.movie__plot").html(),
|
description = doc.select("p.movie__plot").html(),
|
||||||
state = when (doc.selectFirstOrThrow(".movie__credits span.rounded-pill").text()) {
|
state = when (doc.selectFirst(".movie__credits span.rounded-pill")?.text()) {
|
||||||
"Devam Ediyor", "Güncel" -> MangaState.ONGOING
|
"Devam Ediyor", "Güncel" -> MangaState.ONGOING
|
||||||
"Tamamlandı" -> MangaState.FINISHED
|
"Tamamlandı" -> MangaState.FINISHED
|
||||||
else -> null
|
else -> null
|
||||||
@@ -189,14 +179,14 @@ internal class TrWebtoon(context: MangaLoaderContext) :
|
|||||||
val url = tr.selectFirstOrThrow("a").attrAsRelativeUrl("href")
|
val url = tr.selectFirstOrThrow("a").attrAsRelativeUrl("href")
|
||||||
MangaChapter(
|
MangaChapter(
|
||||||
id = generateUid(url),
|
id = generateUid(url),
|
||||||
name = tr.selectFirstOrThrow("a").text(),
|
name = tr.selectFirst("a")?.text() ?: "Chapter : ${i + 1f}",
|
||||||
number = i + 1f,
|
number = i + 1f,
|
||||||
volume = 0,
|
volume = 0,
|
||||||
url = url,
|
url = url,
|
||||||
scanlator = null,
|
scanlator = null,
|
||||||
uploadDate = parseChapterDate(
|
uploadDate = parseChapterDate(
|
||||||
SimpleDateFormat("dd/MM/yyyy", sourceLocale),
|
SimpleDateFormat("dd/MM/yyyy", sourceLocale),
|
||||||
tr.selectLastOrThrow("td").selectFirstOrThrow("span").text(),
|
tr.selectLast("td")?.selectFirst("span")?.text(),
|
||||||
),
|
),
|
||||||
branch = null,
|
branch = null,
|
||||||
source = source,
|
source = source,
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import java.util.*
|
|||||||
@MangaSourceParser("YAOIFLIX", "YaoiFlix", "tr", ContentType.HENTAI)
|
@MangaSourceParser("YAOIFLIX", "YaoiFlix", "tr", ContentType.HENTAI)
|
||||||
internal class YaoiFlix(context: MangaLoaderContext) : PagedMangaParser(context, MangaParserSource.YAOIFLIX, 8) {
|
internal class YaoiFlix(context: MangaLoaderContext) : PagedMangaParser(context, MangaParserSource.YAOIFLIX, 8) {
|
||||||
|
|
||||||
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.UPDATED)
|
|
||||||
|
|
||||||
override val configKeyDomain = ConfigKey.Domain("www.yaoiflix.dev")
|
override val configKeyDomain = ConfigKey.Domain("www.yaoiflix.dev")
|
||||||
|
|
||||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||||
@@ -21,6 +19,8 @@ internal class YaoiFlix(context: MangaLoaderContext) : PagedMangaParser(context,
|
|||||||
keys.add(userAgentKey)
|
keys.add(userAgentKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.UPDATED)
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
get() = MangaListFilterCapabilities(
|
get() = MangaListFilterCapabilities(
|
||||||
isSearchSupported = true,
|
isSearchSupported = true,
|
||||||
@@ -75,7 +75,7 @@ internal class YaoiFlix(context: MangaLoaderContext) : PagedMangaParser(context,
|
|||||||
id = generateUid(href),
|
id = generateUid(href),
|
||||||
url = href,
|
url = href,
|
||||||
publicUrl = a.attrAsAbsoluteUrl("href"),
|
publicUrl = a.attrAsAbsoluteUrl("href"),
|
||||||
title = div.selectLastOrThrow(".name").text(),
|
title = div.selectLast(".name")?.text().orEmpty(),
|
||||||
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
||||||
altTitle = null,
|
altTitle = null,
|
||||||
rating = RATING_UNKNOWN,
|
rating = RATING_UNKNOWN,
|
||||||
@@ -118,7 +118,7 @@ internal class YaoiFlix(context: MangaLoaderContext) : PagedMangaParser(context,
|
|||||||
val href = a.attrAsRelativeUrl("href")
|
val href = a.attrAsRelativeUrl("href")
|
||||||
MangaChapter(
|
MangaChapter(
|
||||||
id = generateUid(href),
|
id = generateUid(href),
|
||||||
name = div.selectFirstOrThrow(".name").text(),
|
name = div.selectFirst(".name")?.text() ?: "Chapter : ${i + 1f}",
|
||||||
number = i + 1f,
|
number = i + 1f,
|
||||||
volume = 0,
|
volume = 0,
|
||||||
url = href,
|
url = href,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package org.koitharu.kotatsu.parsers.site.uk
|
package org.koitharu.kotatsu.parsers.site.uk
|
||||||
|
|
||||||
import org.koitharu.kotatsu.parsers.ErrorMessages
|
|
||||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||||
import org.koitharu.kotatsu.parsers.PagedMangaParser
|
import org.koitharu.kotatsu.parsers.PagedMangaParser
|
||||||
@@ -43,16 +42,28 @@ internal class MangaInUaParser(context: MangaLoaderContext) : PagedMangaParser(
|
|||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
val url = when {
|
val url = buildString {
|
||||||
!filter.query.isNullOrEmpty() -> ("/index.php?do=search&subaction=search&search_start=$page&full_search=1&story=${filter.query}&titleonly=3").toAbsoluteUrl(
|
append("https://")
|
||||||
domain,
|
append(domain)
|
||||||
)
|
when {
|
||||||
|
|
||||||
filter.tags.isEmpty() -> "/mangas/page/$page".toAbsoluteUrl(domain)
|
!filter.query.isNullOrEmpty() -> {
|
||||||
filter.tags.size == 1 -> "${filter.tags.first().key}/page/$page"
|
append("/index.php?do=search&subaction=search&search_start=$page&full_search=1&story=${filter.query}&titleonly=3")
|
||||||
filter.tags.size > 1 -> throw IllegalArgumentException(ErrorMessages.FILTER_MULTIPLE_GENRES_NOT_SUPPORTED)
|
}
|
||||||
else -> "/mangas/page/$page".toAbsoluteUrl(domain)
|
|
||||||
|
else -> {
|
||||||
|
|
||||||
|
if (filter.tags.isNotEmpty()) {
|
||||||
|
filter.tags.oneOrThrowIfMany()?.let {
|
||||||
|
append("${it.key}/page/$page")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
append("/mangas/page/$page")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val doc = webClient.httpGet(url).parseHtml()
|
val doc = webClient.httpGet(url).parseHtml()
|
||||||
val container = doc.body().requireElementById("site-content")
|
val container = doc.body().requireElementById("site-content")
|
||||||
val items = container.select("div.col-6")
|
val items = container.select("div.col-6")
|
||||||
|
|||||||
@@ -21,9 +21,6 @@ internal class BlogTruyenParser(context: MangaLoaderContext) :
|
|||||||
override val configKeyDomain: ConfigKey.Domain
|
override val configKeyDomain: ConfigKey.Domain
|
||||||
get() = ConfigKey.Domain("blogtruyenmoi.com")
|
get() = ConfigKey.Domain("blogtruyenmoi.com")
|
||||||
|
|
||||||
override val availableSortOrders: Set<SortOrder>
|
|
||||||
get() = EnumSet.of(SortOrder.UPDATED)
|
|
||||||
|
|
||||||
override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP)
|
override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP)
|
||||||
|
|
||||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||||
@@ -31,8 +28,8 @@ internal class BlogTruyenParser(context: MangaLoaderContext) :
|
|||||||
keys.add(userAgentKey)
|
keys.add(userAgentKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val dateFormat = SimpleDateFormat("dd/MM/yyyy HH:mm", Locale.US)
|
override val availableSortOrders: Set<SortOrder>
|
||||||
private var cacheTags = SuspendLazy(::fetchTags)
|
get() = EnumSet.of(SortOrder.UPDATED)
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
get() = MangaListFilterCapabilities(
|
get() = MangaListFilterCapabilities(
|
||||||
@@ -43,6 +40,9 @@ internal class BlogTruyenParser(context: MangaLoaderContext) :
|
|||||||
availableTags = cacheTags.get().values.toSet(),
|
availableTags = cacheTags.get().values.toSet(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private val dateFormat = SimpleDateFormat("dd/MM/yyyy HH:mm", Locale.US)
|
||||||
|
private var cacheTags = SuspendLazy(::fetchTags)
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
return when {
|
return when {
|
||||||
!filter.query.isNullOrEmpty() -> {
|
!filter.query.isNullOrEmpty() -> {
|
||||||
|
|||||||
@@ -21,9 +21,6 @@ internal class BlogTruyenVNParser(context: MangaLoaderContext) :
|
|||||||
override val configKeyDomain: ConfigKey.Domain
|
override val configKeyDomain: ConfigKey.Domain
|
||||||
get() = ConfigKey.Domain("blogtruyen.vn")
|
get() = ConfigKey.Domain("blogtruyen.vn")
|
||||||
|
|
||||||
override val availableSortOrders: Set<SortOrder>
|
|
||||||
get() = EnumSet.of(SortOrder.UPDATED)
|
|
||||||
|
|
||||||
override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP)
|
override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP)
|
||||||
|
|
||||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||||
@@ -31,8 +28,8 @@ internal class BlogTruyenVNParser(context: MangaLoaderContext) :
|
|||||||
keys.add(userAgentKey)
|
keys.add(userAgentKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val dateFormat = SimpleDateFormat("dd/MM/yyyy HH:mm", Locale.US)
|
override val availableSortOrders: Set<SortOrder>
|
||||||
private var cacheTags = SuspendLazy(::fetchTags)
|
get() = EnumSet.of(SortOrder.UPDATED)
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
get() = MangaListFilterCapabilities(
|
get() = MangaListFilterCapabilities(
|
||||||
@@ -43,6 +40,9 @@ internal class BlogTruyenVNParser(context: MangaLoaderContext) :
|
|||||||
availableTags = cacheTags.get().values.toSet(),
|
availableTags = cacheTags.get().values.toSet(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private val dateFormat = SimpleDateFormat("dd/MM/yyyy HH:mm", Locale.US)
|
||||||
|
private var cacheTags = SuspendLazy(::fetchTags)
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
return when {
|
return when {
|
||||||
!filter.query.isNullOrEmpty() -> {
|
!filter.query.isNullOrEmpty() -> {
|
||||||
|
|||||||
@@ -13,6 +13,15 @@ import java.util.*
|
|||||||
@MangaSourceParser("LXMANGA", "LxManga", "vi")
|
@MangaSourceParser("LXMANGA", "LxManga", "vi")
|
||||||
internal class LxManga(context: MangaLoaderContext) : PagedMangaParser(context, MangaParserSource.LXMANGA, 60) {
|
internal class LxManga(context: MangaLoaderContext) : PagedMangaParser(context, MangaParserSource.LXMANGA, 60) {
|
||||||
|
|
||||||
|
override val configKeyDomain = ConfigKey.Domain("lxmanga.click")
|
||||||
|
|
||||||
|
override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP)
|
||||||
|
|
||||||
|
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||||
|
super.onCreateConfig(keys)
|
||||||
|
keys.add(userAgentKey)
|
||||||
|
}
|
||||||
|
|
||||||
override val availableSortOrders: Set<SortOrder> = EnumSet.of(
|
override val availableSortOrders: Set<SortOrder> = EnumSet.of(
|
||||||
SortOrder.ALPHABETICAL,
|
SortOrder.ALPHABETICAL,
|
||||||
SortOrder.ALPHABETICAL_DESC,
|
SortOrder.ALPHABETICAL_DESC,
|
||||||
@@ -21,9 +30,6 @@ internal class LxManga(context: MangaLoaderContext) : PagedMangaParser(context,
|
|||||||
SortOrder.POPULARITY,
|
SortOrder.POPULARITY,
|
||||||
)
|
)
|
||||||
|
|
||||||
override val configKeyDomain = ConfigKey.Domain("lxmanga.click")
|
|
||||||
|
|
||||||
override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP)
|
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
get() = MangaListFilterCapabilities(
|
get() = MangaListFilterCapabilities(
|
||||||
@@ -35,11 +41,6 @@ internal class LxManga(context: MangaLoaderContext) : PagedMangaParser(context,
|
|||||||
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED),
|
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED),
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
|
||||||
super.onCreateConfig(keys)
|
|
||||||
keys.add(userAgentKey)
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
val url = buildString {
|
val url = buildString {
|
||||||
append("https://")
|
append("https://")
|
||||||
|
|||||||
@@ -13,29 +13,44 @@ import java.util.*
|
|||||||
@MangaSourceParser("TRUYENQQ", "Truyenqq", "vi")
|
@MangaSourceParser("TRUYENQQ", "Truyenqq", "vi")
|
||||||
internal class Truyenqq(context: MangaLoaderContext) : PagedMangaParser(context, MangaParserSource.TRUYENQQ, 42) {
|
internal class Truyenqq(context: MangaLoaderContext) : PagedMangaParser(context, MangaParserSource.TRUYENQQ, 42) {
|
||||||
|
|
||||||
override val availableSortOrders: Set<SortOrder> =
|
|
||||||
EnumSet.of(SortOrder.UPDATED, SortOrder.POPULARITY, SortOrder.NEWEST)
|
|
||||||
|
|
||||||
override val configKeyDomain = ConfigKey.Domain("truyenqqto.com")
|
override val configKeyDomain = ConfigKey.Domain("truyenqqto.com")
|
||||||
|
|
||||||
|
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||||
|
super.onCreateConfig(keys)
|
||||||
|
keys.add(userAgentKey)
|
||||||
|
}
|
||||||
|
|
||||||
|
override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP)
|
||||||
|
|
||||||
|
override val availableSortOrders: Set<SortOrder> =
|
||||||
|
EnumSet.of(
|
||||||
|
SortOrder.UPDATED,
|
||||||
|
SortOrder.UPDATED_ASC,
|
||||||
|
SortOrder.POPULARITY,
|
||||||
|
SortOrder.POPULARITY_ASC,
|
||||||
|
SortOrder.NEWEST,
|
||||||
|
SortOrder.NEWEST_ASC,
|
||||||
|
)
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
get() = MangaListFilterCapabilities(
|
get() = MangaListFilterCapabilities(
|
||||||
isMultipleTagsSupported = true,
|
isMultipleTagsSupported = true,
|
||||||
|
isTagsExclusionSupported = true,
|
||||||
isSearchSupported = true,
|
isSearchSupported = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||||
availableTags = fetchAvailableTags(),
|
availableTags = fetchAvailableTags(),
|
||||||
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED),
|
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED),
|
||||||
|
availableContentTypes = EnumSet.of(
|
||||||
|
ContentType.MANGA,
|
||||||
|
ContentType.MANHWA,
|
||||||
|
ContentType.MANHUA,
|
||||||
|
ContentType.COMICS,
|
||||||
|
ContentType.OTHER,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
override val userAgentKey = ConfigKey.UserAgent(UserAgents.CHROME_DESKTOP)
|
|
||||||
|
|
||||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
|
||||||
super.onCreateConfig(keys)
|
|
||||||
keys.add(userAgentKey)
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
val url = when {
|
val url = when {
|
||||||
!filter.query.isNullOrEmpty() -> {
|
!filter.query.isNullOrEmpty() -> {
|
||||||
@@ -54,31 +69,58 @@ internal class Truyenqq(context: MangaLoaderContext) : PagedMangaParser(context,
|
|||||||
append(domain)
|
append(domain)
|
||||||
append("/tim-kiem-nang-cao/trang-")
|
append("/tim-kiem-nang-cao/trang-")
|
||||||
append(page.toString())
|
append(page.toString())
|
||||||
append(".html?country=0&sort=")
|
append(".html?country=")
|
||||||
when (order) {
|
|
||||||
SortOrder.POPULARITY -> append("4")
|
if (filter.types.isNotEmpty()) {
|
||||||
SortOrder.UPDATED -> append("2")
|
filter.types.oneOrThrowIfMany()?.let {
|
||||||
SortOrder.NEWEST -> append("0")
|
|
||||||
else -> append("2")
|
|
||||||
}
|
|
||||||
if (filter.states.isNotEmpty()) {
|
|
||||||
filter.states.oneOrThrowIfMany()?.let {
|
|
||||||
append("&status=")
|
|
||||||
append(
|
append(
|
||||||
when (it) {
|
when (it) {
|
||||||
MangaState.ONGOING -> "0"
|
ContentType.MANHUA -> '1'
|
||||||
MangaState.FINISHED -> "1"
|
ContentType.OTHER -> '2' // Việt Nam
|
||||||
|
ContentType.MANHWA -> '3'
|
||||||
|
ContentType.MANGA -> '4'
|
||||||
|
ContentType.COMICS -> '5'
|
||||||
|
else -> '0' // all
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else append('0')
|
||||||
|
|
||||||
|
|
||||||
|
append("&sort=")
|
||||||
|
when (order) {
|
||||||
|
SortOrder.NEWEST -> append('0')
|
||||||
|
SortOrder.NEWEST_ASC -> append('1')
|
||||||
|
SortOrder.UPDATED -> append('2')
|
||||||
|
SortOrder.UPDATED_ASC -> append('3')
|
||||||
|
SortOrder.POPULARITY -> append('4')
|
||||||
|
SortOrder.POPULARITY_ASC -> append('5')
|
||||||
|
else -> append('2')
|
||||||
|
}
|
||||||
|
|
||||||
|
append("&status=")
|
||||||
|
if (filter.states.isNotEmpty()) {
|
||||||
|
filter.states.oneOrThrowIfMany()?.let {
|
||||||
|
|
||||||
|
append(
|
||||||
|
when (it) {
|
||||||
|
MangaState.ONGOING -> '0'
|
||||||
|
MangaState.FINISHED -> '1'
|
||||||
else -> "-1"
|
else -> "-1"
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
append("&status=-1")
|
append("-1")
|
||||||
}
|
}
|
||||||
|
|
||||||
append("&category=")
|
append("&category=")
|
||||||
append(filter.tags.joinToString(separator = ",") { it.key })
|
append(filter.tags.joinToString(separator = ",") { it.key })
|
||||||
append("¬category=&minchapter=0")
|
|
||||||
|
append("¬category=")
|
||||||
|
append(filter.tagsExclude.joinToString(separator = ",") { it.key })
|
||||||
|
|
||||||
|
append("&minchapter=0")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,13 +129,13 @@ internal class Truyenqq(context: MangaLoaderContext) : PagedMangaParser(context,
|
|||||||
val href = li.selectFirstOrThrow("a").attrAsRelativeUrl("href")
|
val href = li.selectFirstOrThrow("a").attrAsRelativeUrl("href")
|
||||||
Manga(
|
Manga(
|
||||||
id = generateUid(href),
|
id = generateUid(href),
|
||||||
title = li.selectFirstOrThrow(".book_name").text(),
|
title = li.selectFirst(".book_name")?.text().orEmpty(),
|
||||||
altTitle = null,
|
altTitle = null,
|
||||||
url = href,
|
url = href,
|
||||||
publicUrl = href.toAbsoluteUrl(domain),
|
publicUrl = href.toAbsoluteUrl(domain),
|
||||||
rating = RATING_UNKNOWN,
|
rating = RATING_UNKNOWN,
|
||||||
isNsfw = isNsfwSource,
|
isNsfw = isNsfwSource,
|
||||||
coverUrl = li.selectFirstOrThrow("img").src().orEmpty(),
|
coverUrl = li.selectFirst("img")?.src().orEmpty(),
|
||||||
tags = emptySet(),
|
tags = emptySet(),
|
||||||
state = null,
|
state = null,
|
||||||
author = null,
|
author = null,
|
||||||
@@ -126,7 +168,7 @@ internal class Truyenqq(context: MangaLoaderContext) : PagedMangaParser(context,
|
|||||||
source = source,
|
source = source,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
state = when (doc.selectFirstOrThrow(".status p.col-xs-9").text()) {
|
state = when (doc.selectFirst(".status p.col-xs-9")?.text()) {
|
||||||
"Đang Cập Nhật" -> MangaState.ONGOING
|
"Đang Cập Nhật" -> MangaState.ONGOING
|
||||||
"Hoàn Thành" -> MangaState.FINISHED
|
"Hoàn Thành" -> MangaState.FINISHED
|
||||||
else -> null
|
else -> null
|
||||||
@@ -137,7 +179,7 @@ internal class Truyenqq(context: MangaLoaderContext) : PagedMangaParser(context,
|
|||||||
val a = div.selectFirstOrThrow("a")
|
val a = div.selectFirstOrThrow("a")
|
||||||
val href = a.attrAsRelativeUrl("href")
|
val href = a.attrAsRelativeUrl("href")
|
||||||
val name = a.text()
|
val name = a.text()
|
||||||
val dateText = div.selectFirstOrThrow(".time-chap").text()
|
val dateText = div.selectFirst(".time-chap")?.text()
|
||||||
MangaChapter(
|
MangaChapter(
|
||||||
id = generateUid(href),
|
id = generateUid(href),
|
||||||
name = name,
|
name = name,
|
||||||
|
|||||||
@@ -24,9 +24,6 @@ internal abstract class VmpParser(
|
|||||||
|
|
||||||
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.UPDATED)
|
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.UPDATED)
|
||||||
|
|
||||||
protected open val listUrl = "xxx/"
|
|
||||||
protected open val geneUrl = "genero/"
|
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
get() = MangaListFilterCapabilities(
|
get() = MangaListFilterCapabilities(
|
||||||
isSearchSupported = true,
|
isSearchSupported = true,
|
||||||
@@ -41,6 +38,9 @@ internal abstract class VmpParser(
|
|||||||
searchPaginator.firstPage = 1
|
searchPaginator.firstPage = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected open val listUrl = "xxx/"
|
||||||
|
protected open val geneUrl = "genero/"
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
val url = buildString {
|
val url = buildString {
|
||||||
append("https://")
|
append("https://")
|
||||||
@@ -83,7 +83,7 @@ internal abstract class VmpParser(
|
|||||||
url = href,
|
url = href,
|
||||||
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
publicUrl = href.toAbsoluteUrl(div.host ?: domain),
|
||||||
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
coverUrl = div.selectFirst("img")?.src().orEmpty(),
|
||||||
title = div.selectFirstOrThrow("h2").text().orEmpty(),
|
title = div.selectFirst("h2")?.text().orEmpty(),
|
||||||
altTitle = null,
|
altTitle = null,
|
||||||
rating = RATING_UNKNOWN,
|
rating = RATING_UNKNOWN,
|
||||||
tags = emptySet(),
|
tags = emptySet(),
|
||||||
|
|||||||
@@ -38,8 +38,15 @@ internal abstract class WpComicsParser(
|
|||||||
SortOrder.RATING,
|
SortOrder.RATING,
|
||||||
)
|
)
|
||||||
|
|
||||||
protected open val listUrl = "/tim-truyen"
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
protected open val datePattern = "dd/MM/yy"
|
get() = MangaListFilterCapabilities(
|
||||||
|
isSearchSupported = true,
|
||||||
|
)
|
||||||
|
|
||||||
|
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||||
|
availableTags = fetchAvailableTags(),
|
||||||
|
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED),
|
||||||
|
)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
paginator.firstPage = 1
|
paginator.firstPage = 1
|
||||||
@@ -62,15 +69,8 @@ internal abstract class WpComicsParser(
|
|||||||
"完結済み",
|
"完結済み",
|
||||||
)
|
)
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
protected open val listUrl = "/tim-truyen"
|
||||||
get() = MangaListFilterCapabilities(
|
protected open val datePattern = "dd/MM/yy"
|
||||||
isSearchSupported = true,
|
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
|
||||||
availableTags = fetchAvailableTags(),
|
|
||||||
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED),
|
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
val response =
|
val response =
|
||||||
|
|||||||
@@ -32,13 +32,16 @@ internal abstract class ZeistMangaParser(
|
|||||||
|
|
||||||
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.UPDATED)
|
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.UPDATED)
|
||||||
|
|
||||||
protected open val datePattern = "yyyy-MM-dd"
|
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
get() = MangaListFilterCapabilities(
|
get() = MangaListFilterCapabilities(
|
||||||
isSearchSupported = true,
|
isSearchSupported = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||||
|
availableTags = fetchAvailableTags(),
|
||||||
|
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED, MangaState.ABANDONED),
|
||||||
|
)
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
protected val ongoing: Set<String> = hashSetOf(
|
protected val ongoing: Set<String> = hashSetOf(
|
||||||
"ongoing",
|
"ongoing",
|
||||||
@@ -82,10 +85,7 @@ internal abstract class ZeistMangaParser(
|
|||||||
|
|
||||||
protected open val mangaCategory: String = "Series"
|
protected open val mangaCategory: String = "Series"
|
||||||
|
|
||||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
protected open val datePattern = "yyyy-MM-dd"
|
||||||
availableTags = fetchAvailableTags(),
|
|
||||||
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED, MangaState.ABANDONED),
|
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
val startIndex = maxMangaResults * (page - 1) + 1
|
val startIndex = maxMangaResults * (page - 1) + 1
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ import java.util.*
|
|||||||
internal class Baozimh(context: MangaLoaderContext) :
|
internal class Baozimh(context: MangaLoaderContext) :
|
||||||
PagedMangaParser(context, MangaParserSource.BAOZIMH, pageSize = 36) {
|
PagedMangaParser(context, MangaParserSource.BAOZIMH, pageSize = 36) {
|
||||||
|
|
||||||
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.POPULARITY)
|
|
||||||
|
|
||||||
override val configKeyDomain = ConfigKey.Domain("www.baozimh.com")
|
override val configKeyDomain = ConfigKey.Domain("www.baozimh.com")
|
||||||
|
|
||||||
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
override fun onCreateConfig(keys: MutableCollection<ConfigKey<*>>) {
|
||||||
@@ -26,7 +24,7 @@ internal class Baozimh(context: MangaLoaderContext) :
|
|||||||
keys.add(userAgentKey)
|
keys.add(userAgentKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val tagsMap = SuspendLazy(::parseTags)
|
override val availableSortOrders: Set<SortOrder> = EnumSet.of(SortOrder.POPULARITY)
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
get() = MangaListFilterCapabilities(
|
get() = MangaListFilterCapabilities(
|
||||||
@@ -36,8 +34,16 @@ internal class Baozimh(context: MangaLoaderContext) :
|
|||||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||||
availableTags = tagsMap.get().values.toSet(),
|
availableTags = tagsMap.get().values.toSet(),
|
||||||
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED),
|
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED),
|
||||||
|
availableContentTypes = EnumSet.of(
|
||||||
|
ContentType.MANGA,
|
||||||
|
ContentType.MANHWA,
|
||||||
|
ContentType.MANHUA,
|
||||||
|
ContentType.COMICS,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private val tagsMap = SuspendLazy(::parseTags)
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
when {
|
when {
|
||||||
!filter.query.isNullOrEmpty() -> {
|
!filter.query.isNullOrEmpty() -> {
|
||||||
@@ -55,20 +61,33 @@ internal class Baozimh(context: MangaLoaderContext) :
|
|||||||
val url = buildString {
|
val url = buildString {
|
||||||
append("https://")
|
append("https://")
|
||||||
append(domain)
|
append(domain)
|
||||||
append("/api/bzmhq/amp_comic_list?filter=*®ion=all")
|
append("/api/bzmhq/amp_comic_list?filter=*®ion=")
|
||||||
|
|
||||||
|
if (filter.types.isNotEmpty()) {
|
||||||
|
filter.types.oneOrThrowIfMany().let {
|
||||||
|
append(
|
||||||
|
when (it) {
|
||||||
|
ContentType.MANGA -> "jp"
|
||||||
|
ContentType.MANHWA -> "kr"
|
||||||
|
ContentType.MANHUA -> "cn"
|
||||||
|
ContentType.COMICS -> "en"
|
||||||
|
else -> "all"
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else append("all")
|
||||||
|
|
||||||
|
|
||||||
|
append("&type=")
|
||||||
if (filter.tags.isNotEmpty()) {
|
if (filter.tags.isNotEmpty()) {
|
||||||
filter.tags.oneOrThrowIfMany()?.let {
|
filter.tags.oneOrThrowIfMany()?.let {
|
||||||
append("&type=")
|
|
||||||
append(it.key)
|
append(it.key)
|
||||||
}
|
}
|
||||||
} else {
|
} else append("all")
|
||||||
append("&type=all")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
append("&state=")
|
||||||
if (filter.states.isNotEmpty()) {
|
if (filter.states.isNotEmpty()) {
|
||||||
filter.states.oneOrThrowIfMany()?.let {
|
filter.states.oneOrThrowIfMany()?.let {
|
||||||
append("&state=")
|
|
||||||
append(
|
append(
|
||||||
when (it) {
|
when (it) {
|
||||||
MangaState.ONGOING -> "serial"
|
MangaState.ONGOING -> "serial"
|
||||||
@@ -77,9 +96,7 @@ internal class Baozimh(context: MangaLoaderContext) :
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else append("all")
|
||||||
append("&state=all")
|
|
||||||
}
|
|
||||||
|
|
||||||
append("&limit=36&page=")
|
append("&limit=36&page=")
|
||||||
append(page.toString())
|
append(page.toString())
|
||||||
@@ -118,7 +135,7 @@ internal class Baozimh(context: MangaLoaderContext) :
|
|||||||
url = href,
|
url = href,
|
||||||
publicUrl = href,
|
publicUrl = href,
|
||||||
coverUrl = div.selectFirst("amp-img")?.src().orEmpty(),
|
coverUrl = div.selectFirst("amp-img")?.src().orEmpty(),
|
||||||
title = div.selectFirstOrThrow(".comics-card__title h3").text(),
|
title = div.selectFirst(".comics-card__title h3")?.text().orEmpty(),
|
||||||
altTitle = null,
|
altTitle = null,
|
||||||
rating = RATING_UNKNOWN,
|
rating = RATING_UNKNOWN,
|
||||||
tags = emptySet(),
|
tags = emptySet(),
|
||||||
@@ -148,7 +165,7 @@ internal class Baozimh(context: MangaLoaderContext) :
|
|||||||
|
|
||||||
override suspend fun getDetails(manga: Manga): Manga {
|
override suspend fun getDetails(manga: Manga): Manga {
|
||||||
val doc = webClient.httpGet(manga.url.toAbsoluteUrl(domain)).parseHtml()
|
val doc = webClient.httpGet(manga.url.toAbsoluteUrl(domain)).parseHtml()
|
||||||
val state = doc.selectFirstOrThrow(".tag-list span.tag").text()
|
val state = doc.selectFirst(".tag-list span.tag")?.text()
|
||||||
val tagMap = tagsMap.get()
|
val tagMap = tagsMap.get()
|
||||||
val selectTag = doc.select(".tag-list span.tag").drop(1)
|
val selectTag = doc.select(".tag-list span.tag").drop(1)
|
||||||
val tags = selectTag.mapNotNullToSet { tagMap[it.text()] }
|
val tags = selectTag.mapNotNullToSet { tagMap[it.text()] }
|
||||||
@@ -174,7 +191,7 @@ internal class Baozimh(context: MangaLoaderContext) :
|
|||||||
val url = a.attrAsRelativeUrl("href").toAbsoluteUrl(domain)
|
val url = a.attrAsRelativeUrl("href").toAbsoluteUrl(domain)
|
||||||
MangaChapter(
|
MangaChapter(
|
||||||
id = generateUid(url),
|
id = generateUid(url),
|
||||||
name = a.selectFirstOrThrow("span").text(),
|
name = a.selectFirst("span")?.text() ?: "Chapter ${i + 1f}",
|
||||||
number = i + 1f,
|
number = i + 1f,
|
||||||
volume = 0,
|
volume = 0,
|
||||||
url = url,
|
url = url,
|
||||||
|
|||||||
@@ -35,18 +35,24 @@ internal abstract class ZMangaParser(
|
|||||||
SortOrder.ALPHABETICAL_DESC,
|
SortOrder.ALPHABETICAL_DESC,
|
||||||
)
|
)
|
||||||
|
|
||||||
protected open val listUrl = "advanced-search/"
|
|
||||||
protected open val datePattern = "MMMM d, yyyy"
|
|
||||||
|
|
||||||
override val filterCapabilities: MangaListFilterCapabilities
|
override val filterCapabilities: MangaListFilterCapabilities
|
||||||
get() = MangaListFilterCapabilities(
|
get() = MangaListFilterCapabilities(
|
||||||
isMultipleTagsSupported = true,
|
isMultipleTagsSupported = true,
|
||||||
isSearchSupported = true,
|
isSearchSupported = true,
|
||||||
|
isSearchWithFiltersSupported = true,
|
||||||
|
isYearSupported = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
override suspend fun getFilterOptions() = MangaListFilterOptions(
|
||||||
availableTags = fetchAvailableTags(),
|
availableTags = fetchAvailableTags(),
|
||||||
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED),
|
availableStates = EnumSet.of(MangaState.ONGOING, MangaState.FINISHED),
|
||||||
|
availableContentTypes = EnumSet.of(
|
||||||
|
ContentType.MANGA,
|
||||||
|
ContentType.MANHWA,
|
||||||
|
ContentType.MANHUA,
|
||||||
|
ContentType.ONE_SHOT,
|
||||||
|
ContentType.DOUJINSHI,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@@ -66,6 +72,11 @@ internal abstract class ZMangaParser(
|
|||||||
"Completed",
|
"Completed",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
protected open val listUrl = "advanced-search/"
|
||||||
|
protected open val datePattern = "MMMM d, yyyy"
|
||||||
|
|
||||||
|
// https://komikindo.info/advanced-search/?title=the&author=the&artist=the&yearx=2020&status=ongoing&type=Manga&order=update
|
||||||
|
|
||||||
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
|
||||||
val url = buildString {
|
val url = buildString {
|
||||||
append("https://")
|
append("https://")
|
||||||
@@ -78,44 +89,69 @@ internal abstract class ZMangaParser(
|
|||||||
append('/')
|
append('/')
|
||||||
}
|
}
|
||||||
|
|
||||||
when {
|
append("?order=")
|
||||||
|
when (order) {
|
||||||
|
SortOrder.POPULARITY -> append("popular")
|
||||||
|
SortOrder.UPDATED -> append("update")
|
||||||
|
SortOrder.ALPHABETICAL -> append("title")
|
||||||
|
SortOrder.ALPHABETICAL_DESC -> append("titlereverse")
|
||||||
|
SortOrder.NEWEST -> append("latest")
|
||||||
|
SortOrder.RATING -> append("rating")
|
||||||
|
else -> append("update")
|
||||||
|
}
|
||||||
|
|
||||||
!filter.query.isNullOrEmpty() -> {
|
filter.query?.let {
|
||||||
append("&title=")
|
append("&title=")
|
||||||
append(filter.query.urlEncoded())
|
append(filter.query.urlEncoded())
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
// author
|
||||||
|
// filter.author?.let {
|
||||||
|
// append("&author=")
|
||||||
|
// append(filter.author.urlEncoded())
|
||||||
|
// }
|
||||||
|
|
||||||
append("?order=")
|
// artist
|
||||||
when (order) {
|
// filter.artist?.let {
|
||||||
SortOrder.POPULARITY -> append("popular")
|
// append("&artist=")
|
||||||
SortOrder.UPDATED -> append("update")
|
// append(filter.artist.urlEncoded())
|
||||||
SortOrder.ALPHABETICAL -> append("title")
|
// }
|
||||||
SortOrder.ALPHABETICAL_DESC -> append("titlereverse")
|
|
||||||
SortOrder.NEWEST -> append("latest")
|
|
||||||
SortOrder.RATING -> append("rating")
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
|
|
||||||
filter.tags.forEach {
|
if (filter.year != 0) {
|
||||||
append("&")
|
append("&yearx=")
|
||||||
append("genre[]".urlEncoded())
|
append(filter.year)
|
||||||
append("=")
|
}
|
||||||
append(it.key)
|
|
||||||
}
|
|
||||||
|
|
||||||
filter.states.oneOrThrowIfMany()?.let {
|
filter.types.oneOrThrowIfMany()?.let {
|
||||||
append("&status=")
|
append("&type=")
|
||||||
append(
|
append(
|
||||||
when (it) {
|
when (it) {
|
||||||
MangaState.ONGOING -> "ongoing"
|
ContentType.MANGA -> "Manga"
|
||||||
MangaState.FINISHED -> "completed"
|
ContentType.MANHWA -> "Manhwa"
|
||||||
else -> ""
|
ContentType.MANHUA -> "Manhua"
|
||||||
},
|
ContentType.ONE_SHOT -> "One-shot"
|
||||||
)
|
ContentType.DOUJINSHI -> "Doujinshi"
|
||||||
}
|
else -> ""
|
||||||
}
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
filter.tags.forEach {
|
||||||
|
append("&")
|
||||||
|
append("genre[]".urlEncoded())
|
||||||
|
append("=")
|
||||||
|
append(it.key)
|
||||||
|
}
|
||||||
|
|
||||||
|
filter.states.oneOrThrowIfMany()?.let {
|
||||||
|
append("&status=")
|
||||||
|
append(
|
||||||
|
when (it) {
|
||||||
|
MangaState.ONGOING -> "ongoing"
|
||||||
|
MangaState.FINISHED -> "completed"
|
||||||
|
else -> ""
|
||||||
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user