|
|
|
@ -1,20 +1,25 @@
|
|
|
|
package org.koitharu.kotatsu.parsers.site.en
|
|
|
|
package org.koitharu.kotatsu.parsers.site.en
|
|
|
|
|
|
|
|
|
|
|
|
import kotlinx.coroutines.*
|
|
|
|
import kotlinx.coroutines.async
|
|
|
|
|
|
|
|
import kotlinx.coroutines.coroutineScope
|
|
|
|
import okhttp3.HttpUrl
|
|
|
|
import okhttp3.HttpUrl
|
|
|
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
|
|
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
|
|
|
import org.jsoup.nodes.*
|
|
|
|
import org.jsoup.nodes.Document
|
|
|
|
import org.koitharu.kotatsu.parsers.*
|
|
|
|
import org.jsoup.nodes.Element
|
|
|
|
|
|
|
|
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
|
|
|
|
|
|
|
import org.koitharu.kotatsu.parsers.MangaParser
|
|
|
|
|
|
|
|
import org.koitharu.kotatsu.parsers.MangaParserAuthProvider
|
|
|
|
|
|
|
|
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
|
|
|
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
|
|
|
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
|
|
|
import org.koitharu.kotatsu.parsers.model.*
|
|
|
|
import org.koitharu.kotatsu.parsers.model.*
|
|
|
|
import org.koitharu.kotatsu.parsers.model.MangaState.*
|
|
|
|
import org.koitharu.kotatsu.parsers.model.ContentRating.SAFE
|
|
|
|
|
|
|
|
import org.koitharu.kotatsu.parsers.model.ContentRating.SUGGESTIVE
|
|
|
|
import org.koitharu.kotatsu.parsers.model.ContentType.*
|
|
|
|
import org.koitharu.kotatsu.parsers.model.ContentType.*
|
|
|
|
|
|
|
|
import org.koitharu.kotatsu.parsers.model.MangaState.*
|
|
|
|
import org.koitharu.kotatsu.parsers.model.SortOrder.*
|
|
|
|
import org.koitharu.kotatsu.parsers.model.SortOrder.*
|
|
|
|
import org.koitharu.kotatsu.parsers.model.ContentRating.*
|
|
|
|
|
|
|
|
import org.koitharu.kotatsu.parsers.util.*
|
|
|
|
import org.koitharu.kotatsu.parsers.util.*
|
|
|
|
import java.text.SimpleDateFormat
|
|
|
|
import java.text.SimpleDateFormat
|
|
|
|
import java.util.EnumSet
|
|
|
|
import java.util.*
|
|
|
|
import java.util.Locale
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@MangaSourceParser("WEEBCENTRAL", "Weeb Central", "en")
|
|
|
|
@MangaSourceParser("WEEBCENTRAL", "Weeb Central", "en")
|
|
|
|
internal class WeebCentral(context: MangaLoaderContext) : MangaParser(context, MangaParserSource.WEEBCENTRAL),
|
|
|
|
internal class WeebCentral(context: MangaLoaderContext) : MangaParser(context, MangaParserSource.WEEBCENTRAL),
|
|
|
|
@ -65,27 +70,27 @@ internal class WeebCentral(context: MangaLoaderContext) : MangaParser(context, M
|
|
|
|
MangaTag(
|
|
|
|
MangaTag(
|
|
|
|
title = it.selectFirstOrThrow(".label-text").text(),
|
|
|
|
title = it.selectFirstOrThrow(".label-text").text(),
|
|
|
|
key = it.selectFirstOrThrow("input[id$=value]").attr("value"),
|
|
|
|
key = it.selectFirstOrThrow("input[id$=value]").attr("value"),
|
|
|
|
source = source
|
|
|
|
source = source,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
val states = EnumSet.of(
|
|
|
|
val states = EnumSet.of(
|
|
|
|
ONGOING, FINISHED, ABANDONED, PAUSED
|
|
|
|
ONGOING, FINISHED, ABANDONED, PAUSED,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
val types = EnumSet.of(
|
|
|
|
val types = EnumSet.of(
|
|
|
|
MANGA, MANHWA, MANHUA, COMICS
|
|
|
|
MANGA, MANHWA, MANHUA, COMICS,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
val rating = EnumSet.of(
|
|
|
|
val rating = EnumSet.of(
|
|
|
|
SAFE, SUGGESTIVE
|
|
|
|
SAFE, SUGGESTIVE,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
return MangaListFilterOptions(
|
|
|
|
return MangaListFilterOptions(
|
|
|
|
availableTags = tags,
|
|
|
|
availableTags = tags,
|
|
|
|
availableStates = states,
|
|
|
|
availableStates = states,
|
|
|
|
availableContentTypes = types,
|
|
|
|
availableContentTypes = types,
|
|
|
|
availableContentRating = rating
|
|
|
|
availableContentRating = rating,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -110,7 +115,7 @@ internal class WeebCentral(context: MangaLoaderContext) : MangaParser(context, M
|
|
|
|
ADDED, ADDED_ASC -> "Recently Added"
|
|
|
|
ADDED, ADDED_ASC -> "Recently Added"
|
|
|
|
UPDATED, UPDATED_ASC -> "Latest Updates"
|
|
|
|
UPDATED, UPDATED_ASC -> "Latest Updates"
|
|
|
|
else -> throw UnsupportedOperationException("unsupported order: $order")
|
|
|
|
else -> throw UnsupportedOperationException("unsupported order: $order")
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
addQueryParameter(
|
|
|
|
addQueryParameter(
|
|
|
|
name = "order",
|
|
|
|
name = "order",
|
|
|
|
@ -118,11 +123,11 @@ internal class WeebCentral(context: MangaLoaderContext) : MangaParser(context, M
|
|
|
|
RELEVANCE, ALPHABETICAL, POPULARITY_ASC, RATING_ASC, ADDED_ASC, UPDATED_ASC -> "Ascending"
|
|
|
|
RELEVANCE, ALPHABETICAL, POPULARITY_ASC, RATING_ASC, ADDED_ASC, UPDATED_ASC -> "Ascending"
|
|
|
|
ALPHABETICAL_DESC, POPULARITY, RATING, ADDED, UPDATED -> "Descending"
|
|
|
|
ALPHABETICAL_DESC, POPULARITY, RATING, ADDED, UPDATED -> "Descending"
|
|
|
|
else -> throw UnsupportedOperationException("unsupported order: $order")
|
|
|
|
else -> throw UnsupportedOperationException("unsupported order: $order")
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
addQueryParameter("official", "Any")
|
|
|
|
addQueryParameter("official", "Any")
|
|
|
|
addQueryParameter("anime", "Any")
|
|
|
|
addQueryParameter("anime", "Any")
|
|
|
|
with (filter.contentRating) {
|
|
|
|
with(filter.contentRating) {
|
|
|
|
addQueryParameter(
|
|
|
|
addQueryParameter(
|
|
|
|
name = "adult",
|
|
|
|
name = "adult",
|
|
|
|
value = when {
|
|
|
|
value = when {
|
|
|
|
@ -131,7 +136,7 @@ internal class WeebCentral(context: MangaLoaderContext) : MangaParser(context, M
|
|
|
|
SAFE in this -> "False"
|
|
|
|
SAFE in this -> "False"
|
|
|
|
SUGGESTIVE in this -> "True"
|
|
|
|
SUGGESTIVE in this -> "True"
|
|
|
|
else -> throw UnsupportedOperationException("unsupported content rating: $this")
|
|
|
|
else -> throw UnsupportedOperationException("unsupported content rating: $this")
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
filter.states.forEach { state ->
|
|
|
|
filter.states.forEach { state ->
|
|
|
|
@ -143,7 +148,7 @@ internal class WeebCentral(context: MangaLoaderContext) : MangaParser(context, M
|
|
|
|
ABANDONED -> "Canceled"
|
|
|
|
ABANDONED -> "Canceled"
|
|
|
|
PAUSED -> "Hiatus"
|
|
|
|
PAUSED -> "Hiatus"
|
|
|
|
else -> throw UnsupportedOperationException("unsupported state: $state")
|
|
|
|
else -> throw UnsupportedOperationException("unsupported state: $state")
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
filter.types.forEach { type ->
|
|
|
|
filter.types.forEach { type ->
|
|
|
|
@ -155,7 +160,7 @@ internal class WeebCentral(context: MangaLoaderContext) : MangaParser(context, M
|
|
|
|
MANHUA -> "Manhua"
|
|
|
|
MANHUA -> "Manhua"
|
|
|
|
COMICS -> "OEL"
|
|
|
|
COMICS -> "OEL"
|
|
|
|
else -> throw UnsupportedOperationException("unsupported type: $type")
|
|
|
|
else -> throw UnsupportedOperationException("unsupported type: $type")
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
filter.tags.forEach { tag ->
|
|
|
|
filter.tags.forEach { tag ->
|
|
|
|
@ -194,21 +199,21 @@ internal class WeebCentral(context: MangaLoaderContext) : MangaParser(context, M
|
|
|
|
MangaTag(
|
|
|
|
MangaTag(
|
|
|
|
title = it,
|
|
|
|
title = it,
|
|
|
|
key = it,
|
|
|
|
key = it,
|
|
|
|
source = source
|
|
|
|
source = source,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.orEmpty(),
|
|
|
|
.orEmpty(),
|
|
|
|
state = when(document.selectFirst("div:contains(status) span")?.text()) {
|
|
|
|
state = when (document.selectFirst("div:contains(status) span")?.text()) {
|
|
|
|
"Ongoing" -> ONGOING
|
|
|
|
"Ongoing" -> ONGOING
|
|
|
|
"Complete" -> FINISHED
|
|
|
|
"Complete" -> FINISHED
|
|
|
|
"Canceled" -> ABANDONED
|
|
|
|
"Canceled" -> ABANDONED
|
|
|
|
"Hiatus" -> PAUSED
|
|
|
|
"Hiatus" -> PAUSED
|
|
|
|
else -> null
|
|
|
|
else -> null
|
|
|
|
},
|
|
|
|
},
|
|
|
|
author = document.select("div:contains(author) a").eachText().joinToString(),
|
|
|
|
author = document.select("div:contains(author) a").eachText().joinToString().nullIfEmpty(),
|
|
|
|
largeCoverUrl = null,
|
|
|
|
largeCoverUrl = null,
|
|
|
|
chapters = null,
|
|
|
|
chapters = null,
|
|
|
|
source = source
|
|
|
|
source = source,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -238,7 +243,7 @@ internal class WeebCentral(context: MangaLoaderContext) : MangaParser(context, M
|
|
|
|
MangaTag(
|
|
|
|
MangaTag(
|
|
|
|
title = it.text(),
|
|
|
|
title = it.text(),
|
|
|
|
key = it.text(),
|
|
|
|
key = it.text(),
|
|
|
|
source = source
|
|
|
|
source = source,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
state = when (sectionLeft.selectFirst("ul > li:has(strong:contains(Status)) > a")?.text()) {
|
|
|
|
state = when (sectionLeft.selectFirst("ul > li:has(strong:contains(Status)) > a")?.text()) {
|
|
|
|
@ -260,12 +265,12 @@ internal class WeebCentral(context: MangaLoaderContext) : MangaParser(context, M
|
|
|
|
abbr.selectFirst("a")?.attr("href")?.let { url ->
|
|
|
|
abbr.selectFirst("a")?.attr("href")?.let { url ->
|
|
|
|
val a = Element("a")
|
|
|
|
val a = Element("a")
|
|
|
|
.text(
|
|
|
|
.text(
|
|
|
|
abbr.attr("title")
|
|
|
|
abbr.attr("title"),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.attr("href", url)
|
|
|
|
.attr("href", url)
|
|
|
|
|
|
|
|
|
|
|
|
ul.appendChild(
|
|
|
|
ul.appendChild(
|
|
|
|
Element("li").appendChild(a)
|
|
|
|
Element("li").appendChild(a),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -276,7 +281,7 @@ internal class WeebCentral(context: MangaLoaderContext) : MangaParser(context, M
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}.outerHtml(),
|
|
|
|
}.outerHtml(),
|
|
|
|
chapters = chapters.await(),
|
|
|
|
chapters = chapters.await(),
|
|
|
|
source = source
|
|
|
|
source = source,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -308,10 +313,10 @@ internal class WeebCentral(context: MangaLoaderContext) : MangaParser(context, M
|
|
|
|
else -> null
|
|
|
|
else -> null
|
|
|
|
},
|
|
|
|
},
|
|
|
|
uploadDate = dateFormat.tryParse(
|
|
|
|
uploadDate = dateFormat.tryParse(
|
|
|
|
element.selectFirst("time[datetime]")?.attr("datetime")
|
|
|
|
element.selectFirst("time[datetime]")?.attr("datetime"),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
branch = null,
|
|
|
|
branch = null,
|
|
|
|
source = source
|
|
|
|
source = source,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -336,7 +341,7 @@ internal class WeebCentral(context: MangaLoaderContext) : MangaParser(context, M
|
|
|
|
id = generateUid(pageUrl),
|
|
|
|
id = generateUid(pageUrl),
|
|
|
|
url = pageUrl,
|
|
|
|
url = pageUrl,
|
|
|
|
preview = null,
|
|
|
|
preview = null,
|
|
|
|
source = source
|
|
|
|
source = source,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|