Fix search not working. (#4943)

This commit is contained in:
Alessandro Jean 2020-11-24 19:53:48 -03:00 committed by GitHub
parent 9d641dde29
commit 789d727e53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 4 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Super Mangás'
pkgNameSuffix = 'pt.supermangas'
extClass = '.SuperMangasFactory'
extVersionCode = 4
extVersionCode = 5
libVersion = '1.2'
containsNsfw = true
}

View File

@ -352,7 +352,8 @@ abstract class SuperMangasGeneric(
else -> SManga.UNKNOWN
}
protected fun Response.asJsonObject(): JsonObject = JSON_PARSER.parse(body()!!.string()).obj
protected fun Response.asJsonObject(): JsonObject =
JSON_PARSER.parse(body()!!.string().substringAfter("</b>")).obj
private fun Map<String, String>.toUrlQueryParams(): String =
map { (k, v) -> "$k=$v" }.joinToString("&")
@ -364,10 +365,12 @@ abstract class SuperMangasGeneric(
}
companion object {
private const val ACCEPT_COMMON = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
private const val ACCEPT_COMMON = "text/html,application/xhtml+xml,application/xml;q=0.9," +
"image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
private const val ACCEPT_JSON = "application/json, text/javascript, */*; q=0.01"
private const val ACCEPT_LANGUAGE = "pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7,es;q=0.6,gl;q=0.5"
private const val USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36"
private const val USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " +
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36"
private val JSON_PARSER by lazy { JsonParser() }

View File

@ -1,9 +1,12 @@
package eu.kanade.tachiyomi.extension.pt.supermangas.source
import eu.kanade.tachiyomi.extension.pt.supermangas.SuperMangasGeneric
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.Filter
import eu.kanade.tachiyomi.source.model.FilterList
import okhttp3.FormBody
import okhttp3.HttpUrl
import okhttp3.Request
class SuperMangas : SuperMangasGeneric(
"Super Mangás",
@ -17,6 +20,15 @@ class SuperMangas : SuperMangasGeneric(
Triple("10", "", "Manhua")
)
override fun searchMangaWithQueryRequest(query: String): Request {
val searchUrl = HttpUrl.parse("$baseUrl/busca")!!.newBuilder()
.addEncodedQueryParameter("parametro", query)
.addEncodedQueryParameter("search_type", "serie")
.toString()
return GET(searchUrl, headers)
}
override fun chapterListPaginatedBody(idCategory: Int, page: Int, totalPage: Int): FormBody.Builder =
super.chapterListPaginatedBody(idCategory, page, totalPage)
.add("order_audio", "pt-br")