MangaSwat: fix search (#17239)

* MangaSwat: fix search

* Update multisrc/overrides/mangathemesia/mangaswat/src/MangaSwat.kt

Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com>

* Simplify control flow

* use .isBlank() instead of isEmpty(). fix next page selector

---------

Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com>
This commit is contained in:
Vetle Ledaal 2023-07-24 22:51:43 +02:00 committed by GitHub
parent e34a5b4c70
commit cd259ffb43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -7,12 +7,14 @@ import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.extension.BuildConfig import eu.kanade.tachiyomi.extension.BuildConfig
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SChapter
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.decodeFromString import kotlinx.serialization.decodeFromString
import okhttp3.Headers import okhttp3.Headers
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.Request
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
@ -41,6 +43,23 @@ class MangaSwat : MangaThemesia(
override fun headersBuilder(): Headers.Builder = super.headersBuilder() override fun headersBuilder(): Headers.Builder = super.headersBuilder()
.add("Referer", "$baseUrl/") .add("Referer", "$baseUrl/")
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val request = super.searchMangaRequest(page, query, filters)
if (query.isBlank()) return request
val url = request.url.newBuilder()
.removePathSegment(0)
.removeAllQueryParameters("title")
.addQueryParameter("s", query)
.build()
return request.newBuilder()
.url(url)
.build()
}
override fun searchMangaNextPageSelector() = "a[rel=next]"
override val seriesArtistSelector = "span:contains(الناشر) i" override val seriesArtistSelector = "span:contains(الناشر) i"
override val seriesAuthorSelector = "span:contains(المؤلف) i" override val seriesAuthorSelector = "span:contains(المؤلف) i"
override val seriesGenreSelector = "span:contains(التصنيف) a, .mgen a" override val seriesGenreSelector = "span:contains(التصنيف) a, .mgen a"

View File

@ -72,7 +72,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
SingleLang("MangaWT", "https://mangawt.com", "tr", overrideVersionCode = 5), SingleLang("MangaWT", "https://mangawt.com", "tr", overrideVersionCode = 5),
SingleLang("Mangayaro", "https://mangayaro.net", "id"), SingleLang("Mangayaro", "https://mangayaro.net", "id"),
SingleLang("Manhwa Lover", "https://manhwalover.com", "en", isNsfw = true, overrideVersionCode = 1), SingleLang("Manhwa Lover", "https://manhwalover.com", "en", isNsfw = true, overrideVersionCode = 1),
SingleLang("MangaSwat", "https://swatop.club", "ar", overrideVersionCode = 10), SingleLang("MangaSwat", "https://swatop.club", "ar", overrideVersionCode = 11),
SingleLang("MangKomik", "https://mangkomik.net", "id", overrideVersionCode = 1), SingleLang("MangKomik", "https://mangkomik.net", "id", overrideVersionCode = 1),
SingleLang("Mangás Chan", "https://mangaschan.com", "pt-BR", className = "MangasChan"), SingleLang("Mangás Chan", "https://mangaschan.com", "pt-BR", className = "MangasChan"),
SingleLang("Manhwa Freak", "https://manhwafreak.com", "en", overrideVersionCode = 1), SingleLang("Manhwa Freak", "https://manhwafreak.com", "en", overrideVersionCode = 1),