WeebCentral: Exclude special characters (#7164)

exclude special characters for search
This commit is contained in:
dngonz 2025-01-15 13:48:01 +01:00 committed by Draff
parent c9af13410f
commit 03accf8717
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 4 additions and 3 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'Weeb Central'
extClass = '.WeebCentral'
extVersionCode = 7
extVersionCode = 8
isNsfw = true
}

View File

@ -35,6 +35,8 @@ class WeebCentral : ParsedHttpSource() {
private val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.ENGLISH)
private val excludedSearchCharacters = "[!#:()]".toRegex()
// ============================== Popular ===============================
override fun popularMangaRequest(page: Int): Request = searchMangaRequest(
@ -64,11 +66,10 @@ class WeebCentral : ParsedHttpSource() {
override fun latestUpdatesNextPageSelector(): String = searchMangaNextPageSelector()
// =============================== Search ===============================
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val filterList = filters.ifEmpty { getFilterList() }
val url = "$baseUrl/search/data".toHttpUrl().newBuilder().apply {
addQueryParameter("text", query)
addQueryParameter("text", query.replace(excludedSearchCharacters, " ").trim())
filterList.filterIsInstance<UriFilter>().forEach {
it.addToUri(this)
}