Bato.to improved language filter (#6439)

* Update BatoToFactory.kt

* Update BatoTo.kt

* Update build.gradle
This commit is contained in:
Johannes Joens 2021-04-07 00:41:13 +12:00 committed by GitHub
parent e922cc6dba
commit 2c5179dd1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 5 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Bato.to'
pkgNameSuffix = 'all.batoto'
extClass = '.BatoToFactory'
extVersionCode = 6
extVersionCode = 7
libVersion = '1.2'
containsNsfw = true
}

View File

@ -37,7 +37,13 @@ open class BatoTo(
return GET("$baseUrl/browse?langs=$siteLang&sort=update&page=$page")
}
override fun latestUpdatesSelector() = "div#series-list div.col"
override fun latestUpdatesSelector(): String {
return when (siteLang) {
"" -> "div#series-list div.col"
"en" -> "div#series-list div.col.no-flag"
else -> "div#series-list div.col:has([data-lang=\"$siteLang\"])"
}
}
override fun latestUpdatesFromElement(element: Element): SManga {
val manga = SManga.create()
@ -60,12 +66,10 @@ open class BatoTo(
override fun popularMangaFromElement(element: Element) = latestUpdatesFromElement(element)
override fun popularMangaNextPageSelector() = latestUpdatesNextPageSelector()
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
return if (query.isNotBlank()) {
GET("$baseUrl/search?word=$query&page=$page")
} else {
var author: String? = null
val url = HttpUrl.parse("$baseUrl/browse")!!.newBuilder()
url.addQueryParameter("page", page.toString())
url.addQueryParameter("langs", siteLang)
@ -200,6 +204,9 @@ open class BatoTo(
val value = date.split(' ')[0].toInt()
return when {
"secs" in date -> Calendar.getInstance().apply {
add(Calendar.SECOND, value * -1)
}.timeInMillis
"mins" in date -> Calendar.getInstance().apply {
add(Calendar.MINUTE, value * -1)
}.timeInMillis
@ -218,6 +225,9 @@ open class BatoTo(
"years" in date -> Calendar.getInstance().apply {
add(Calendar.YEAR, value * -1)
}.timeInMillis
"sec" in date -> Calendar.getInstance().apply {
add(Calendar.SECOND, value * -1)
}.timeInMillis
"min" in date -> Calendar.getInstance().apply {
add(Calendar.MINUTE, value * -1)
}.timeInMillis

View File

@ -19,7 +19,7 @@ private val languages = listOf(
Pair("de", "de"),
Pair("el", "el"),
Pair("en", "en"),
Pair("en_us", "en_us"),
Pair("en-US", "en_us"),
Pair("es", "es"),
Pair("es-419", "es_419"),
Pair("eu", "eu"),