copymanga: fix search problems (#6369)

(cherry picked from commit f2f9ef927ccdde28465f2d156e0d7712a06838d3)
This commit is contained in:
sunbeams001 2021-03-31 22:42:04 +08:00 committed by GitHub
parent 80cdcdcb28
commit 05131e92ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'CopyManga' extName = 'CopyManga'
pkgNameSuffix = 'zh.copymanga' pkgNameSuffix = 'zh.copymanga'
extClass = '.CopyManga' extClass = '.CopyManga'
extVersionCode = 6 extVersionCode = 7
libVersion = '1.2' libVersion = '1.2'
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -50,7 +50,7 @@ class CopyManga : ConfigurableSource, HttpSource() {
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
// when perform html search, sort by popular // when perform html search, sort by popular
var apiUrlString = "$baseUrl/api/kb/web/search/count?format=json&limit=$searchPageSize&offset=${(page - 1) * searchPageSize}&platform=2&q=$query" var apiUrlString = "$baseUrl/api/kb/web/search/comics?limit=$searchPageSize&offset=${(page - 1) * searchPageSize}&platform=2&q=$query&q_type="
var htmlUrlString = "$baseUrl/comics?offset=${(page - 1) * popularLatestPageSize}&limit=$popularLatestPageSize" var htmlUrlString = "$baseUrl/comics?offset=${(page - 1) * popularLatestPageSize}&limit=$popularLatestPageSize"
var requestUrlString: String var requestUrlString: String
@ -288,7 +288,7 @@ class CopyManga : ConfigurableSource, HttpSource() {
val body = response.body()!!.string() val body = response.body()!!.string()
// results > comic > list [] // results > comic > list []
val res = JSONObject(body) val res = JSONObject(body)
val comicArray = res.optJSONObject("results")?.optJSONObject("comic")?.optJSONArray("list") val comicArray = res.optJSONObject("results")?.optJSONArray("list")
if (comicArray == null) { if (comicArray == null) {
return MangasPage(listOf(), false) return MangasPage(listOf(), false)
} }