NetTruyen/NhatTruyen: avoid return un-relevant searching results (#1338)
* NetTruyen/NhatTruyen: avoid return catalog page when searching return empty They redirect back to catalog page if searching query is not found. That makes both sites always return un-relevant results when searching should have returned empty. * fix overrideVersion
This commit is contained in:
parent
bf1fc04a2e
commit
9ab07589ad
|
@ -72,6 +72,7 @@ abstract class WPComics(
|
||||||
// Search
|
// Search
|
||||||
|
|
||||||
protected open val searchPath = "tim-truyen"
|
protected open val searchPath = "tim-truyen"
|
||||||
|
protected open val queryParam = "keyword"
|
||||||
|
|
||||||
protected open fun String.replaceSearchPath() = this
|
protected open fun String.replaceSearchPath() = this
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@ abstract class WPComics(
|
||||||
}
|
}
|
||||||
|
|
||||||
url.apply {
|
url.apply {
|
||||||
addQueryParameter("keyword", query)
|
addQueryParameter(queryParam, query)
|
||||||
addQueryParameter("page", page.toString())
|
addQueryParameter("page", page.toString())
|
||||||
addQueryParameter("sort", "0")
|
addQueryParameter("sort", "0")
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ ext {
|
||||||
extClass = '.NetTruyen'
|
extClass = '.NetTruyen'
|
||||||
themePkg = 'wpcomics'
|
themePkg = 'wpcomics'
|
||||||
baseUrl = 'https://www.nettruyenss.com'
|
baseUrl = 'https://www.nettruyenss.com'
|
||||||
overrideVersionCode = 22
|
overrideVersionCode = 23
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -1,12 +1,25 @@
|
||||||
package eu.kanade.tachiyomi.extension.vi.nettruyen
|
package eu.kanade.tachiyomi.extension.vi.nettruyen
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.multisrc.wpcomics.WPComics
|
import eu.kanade.tachiyomi.multisrc.wpcomics.WPComics
|
||||||
|
import eu.kanade.tachiyomi.source.model.MangasPage
|
||||||
|
import okhttp3.Response
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
class NetTruyen : WPComics("NetTruyen", "https://www.nettruyenss.com", "vi", SimpleDateFormat("dd/MM/yy", Locale.getDefault()), null) {
|
class NetTruyen : WPComics("NetTruyen", "https://www.nettruyenss.com", "vi", SimpleDateFormat("dd/MM/yy", Locale.getDefault()), null) {
|
||||||
override fun String.replaceSearchPath() = replace("/$searchPath?status=2&", "/truyen-full?")
|
override fun String.replaceSearchPath() = replace("/$searchPath?status=2&", "/truyen-full?")
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NetTruyen/NhatTruyen redirect back to catalog page if searching query is not found.
|
||||||
|
* That makes both sites always return un-relevant results when searching should return empty.
|
||||||
|
*/
|
||||||
|
override fun searchMangaParse(response: Response): MangasPage {
|
||||||
|
if (response.request.url.queryParameter(name = queryParam) == null) {
|
||||||
|
return MangasPage(mangas = listOf(), hasNextPage = false)
|
||||||
|
}
|
||||||
|
return super.searchMangaParse(response)
|
||||||
|
}
|
||||||
|
|
||||||
override fun getGenreList(): Array<Pair<String?, String>> = arrayOf(
|
override fun getGenreList(): Array<Pair<String?, String>> = arrayOf(
|
||||||
null to "Tất cả",
|
null to "Tất cả",
|
||||||
"action-95" to "Action",
|
"action-95" to "Action",
|
||||||
|
|
|
@ -3,7 +3,7 @@ ext {
|
||||||
extClass = '.NhatTruyen'
|
extClass = '.NhatTruyen'
|
||||||
themePkg = 'wpcomics'
|
themePkg = 'wpcomics'
|
||||||
baseUrl = 'https://nhattruyento.com'
|
baseUrl = 'https://nhattruyento.com'
|
||||||
overrideVersionCode = 14
|
overrideVersionCode = 15
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -1,12 +1,25 @@
|
||||||
package eu.kanade.tachiyomi.extension.vi.nhattruyen
|
package eu.kanade.tachiyomi.extension.vi.nhattruyen
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.multisrc.wpcomics.WPComics
|
import eu.kanade.tachiyomi.multisrc.wpcomics.WPComics
|
||||||
|
import eu.kanade.tachiyomi.source.model.MangasPage
|
||||||
|
import okhttp3.Response
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
class NhatTruyen : WPComics("NhatTruyen", "https://nhattruyento.com", "vi", SimpleDateFormat("dd/MM/yy", Locale.getDefault()), null) {
|
class NhatTruyen : WPComics("NhatTruyen", "https://nhattruyento.com", "vi", SimpleDateFormat("dd/MM/yy", Locale.getDefault()), null) {
|
||||||
override val searchPath = "the-loai"
|
override val searchPath = "the-loai"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NetTruyen/NhatTruyen redirect back to catalog page if searching query is not found.
|
||||||
|
* That makes both sites always return un-relevant results when searching should return empty.
|
||||||
|
*/
|
||||||
|
override fun searchMangaParse(response: Response): MangasPage {
|
||||||
|
if (response.request.url.queryParameter(name = queryParam) == null) {
|
||||||
|
return MangasPage(mangas = listOf(), hasNextPage = false)
|
||||||
|
}
|
||||||
|
return super.searchMangaParse(response)
|
||||||
|
}
|
||||||
|
|
||||||
override fun getGenreList(): Array<Pair<String?, String>> = arrayOf(
|
override fun getGenreList(): Array<Pair<String?, String>> = arrayOf(
|
||||||
null to "Tất cả",
|
null to "Tất cả",
|
||||||
"action" to "Action",
|
"action" to "Action",
|
||||||
|
|
Loading…
Reference in New Issue