Skip to content

Commit

Permalink
Keep Epilogue and Side Story prefix for WeebCentral
Browse files Browse the repository at this point in the history
  • Loading branch information
nonproto committed Nov 26, 2024
1 parent a3a4189 commit b944297
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ class WeebCentral : ReducedHttpSource() {
val document = response.asJsoup()
response.closeQuietly()

val chapterPrefixes = arrayOf("Epilogue", "Side Story")
val volumePrefixes = arrayOf("Volume", "Special")

val chapters =
document.select("a").mapNotNull { element ->
val chapterText = element.selectFirst("span[class~=^\$]")?.text()
Expand All @@ -143,7 +146,7 @@ class WeebCentral : ReducedHttpSource() {

setUrlWithoutDomain(element.attr("href"))

if (chapterText.startsWith("Volume") || chapterText.startsWith("Special")) {
if (volumePrefixes.any { prefix -> chapterText.startsWith(prefix) }) {
this.vol = chapterText.substringAfter(" ")
val prefix =
when (chapterText.startsWith("Volume")) {
Expand Down Expand Up @@ -171,7 +174,15 @@ class WeebCentral : ReducedHttpSource() {
}

// get chapter
this.chapter_txt = "Ch.${chapterText.substringAfter(" ")}"

this.chapter_txt =
when {
chapterPrefixes.none { prefix ->
chapterText.startsWith(prefix)
} -> "Ch.${chapterText.substringAfter(" ")}"
else -> chapterText
}

chapterName.add(this.chapter_txt)
}

Expand Down

0 comments on commit b944297

Please sign in to comment.