Manga18fx: fix URL intent search (#13262)

This commit is contained in:
stevenyomi 2022-08-29 22:03:41 +08:00 committed by GitHub
parent 775cfaa97d
commit ba440a9792
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 7 deletions

View File

@ -30,6 +30,7 @@ class Manga18fx : Madara(
override val fetchGenres = false
override val sendViewCount = false
override val useLoadMoreSearch = false
override fun popularMangaRequest(page: Int) = GET(baseUrl, headers)
@ -60,20 +61,27 @@ class Manga18fx : Madara(
return MangasPage(mangas, hasNextPage)
}
override fun fetchSearchManga(page: Int, query: String, filters: FilterList) =
super.fetchSearchManga(page, query, filters).doOnNext {
for (manga in it.mangas)
manga.url = manga.url.removeSuffix("/")
}
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
if (query.isEmpty()) {
filters.forEach { filter ->
if (filter is GenreFilter)
return GET(filter.vals[filter.state].second, headers)
}
return latestUpdatesRequest(page)
}
val url = "$baseUrl/search".toHttpUrl().newBuilder()
.addQueryParameter("q", query)
.addQueryParameter("page", page.toString())
.toString()
.build()
return GET(url, headers)
return Request.Builder().url(url).headers(headers).build()
}
override fun searchMangaParse(response: Response) = latestUpdatesParse(response)
@ -109,11 +117,9 @@ class Manga18fx : Madara(
override fun getFilterList(): FilterList {
val filters = mutableListOf<Filter<*>>(
Filter.Header("Filters are ignored for text search!"),
)
val filters = buildList(2) {
add(Filter.Header("Filters are ignored for text search!"))
filters.apply {
if (genresList.isNotEmpty()) {
add(
GenreFilter(hardCodedTypes + genresList)

View File

@ -223,7 +223,7 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("Manga-Online.co", "https://www.manga-online.co", "th", className = "MangaOnlineCo"),
SingleLang("Manga-Scantrad", "https://manga-scantrad.net", "fr", className = "MangaScantrad", overrideVersionCode = 2),
SingleLang("Manga-TX", "https://manga-tx.com", "en", className = "Mangatxunoriginal"),
SingleLang("Manga18fx", "https://manga18fx.com", "en", isNsfw = true, overrideVersionCode = 3),
SingleLang("Manga18fx", "https://manga18fx.com", "en", isNsfw = true, overrideVersionCode = 4),
SingleLang("Manga1st", "https://manga1st.com", "en", overrideVersionCode = 2),
SingleLang("Manga1st.online", "https://manga1st.online", "en", className = "MangaFirstOnline", overrideVersionCode = 1),
SingleLang("Manga347", "https://manga347.com", "en", overrideVersionCode = 3),