Jable: Correct the language code and fix the issue of only one page loaded. (#481)

This commit is contained in:
AlphaBoom 2025-01-05 23:38:11 +08:00 committed by GitHub
parent 9b0e6b264c
commit 6853962f8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 7 deletions

View file

@ -1,7 +1,7 @@
ext {
extName = 'Jable'
extClass = '.JableFactory'
extVersionCode = 1
extVersionCode = 2
isNsfw = true
}

View file

@ -35,7 +35,7 @@ class Jable(override val lang: String) : AnimeHttpSource() {
private var tagsUpdated = false
override fun animeDetailsRequest(anime: SAnime): Request {
return GET("$baseUrl${anime.url}?lang=$lang", headers)
return GET("$baseUrl${anime.url}?lang=${lang.toRequestLang()}", headers)
}
override fun animeDetailsParse(response: Response): SAnime {
@ -88,7 +88,7 @@ class Jable(override val lang: String) : AnimeHttpSource() {
title = it.select(".detail .title").text()
}
},
doc.select(".container .pagination .page-item .page-link.disabled").isNullOrEmpty(),
true,
)
}
@ -125,7 +125,7 @@ class Jable(override val lang: String) : AnimeHttpSource() {
): Request {
val urlBuilder = baseUrl.toHttpUrl().newBuilder()
.addPathSegments("$path/")
.addQueryParameter("lang", lang)
.addQueryParameter("lang", lang.toRequestLang())
if (tagsUpdated) {
// load whole page for update filter tags info
urlBuilder.addQueryParameter("mode", "async")
@ -204,6 +204,11 @@ class Jable(override val lang: String) : AnimeHttpSource() {
return false
}
private fun String.toRequestLang(): String {
if (this == "ja") return "jp"
return this
}
private val intl by lazy {
JableIntl(lang)
}

View file

@ -8,7 +8,7 @@ class JableFactory : AnimeSourceFactory {
return listOf(
Jable("zh"),
Jable("en"),
Jable("jp"),
Jable("ja"),
)
}
}

View file

@ -20,7 +20,7 @@ internal class JableIntl private constructor(delegate: Intl) : Intl by delegate
constructor(lang: String) : this(
when (lang) {
"zh" -> ZH()
"jp" -> JP()
"ja" -> JA()
"en" -> EN()
else -> ZH()
},
@ -43,7 +43,7 @@ internal class ZH : Intl {
override val filterTagTitle: String = "標籤"
}
internal class JP : Intl {
internal class JA : Intl {
override val popular: String = "人気優先"
override val latestUpdate: String = "新作優先"
override val sortLatestUpdate: String = "最近更新"