mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 15:41:52 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
2afd068780
@ -84,10 +84,13 @@ class BangumiApi(private val client: OkHttpClient, interceptor: BangumiIntercept
|
|||||||
return authClient.newCall(request)
|
return authClient.newCall(request)
|
||||||
.asObservableSuccess()
|
.asObservableSuccess()
|
||||||
.map { netResponse ->
|
.map { netResponse ->
|
||||||
val responseBody = netResponse.body?.string().orEmpty()
|
var responseBody = netResponse.body?.string().orEmpty()
|
||||||
if (responseBody.isEmpty()) {
|
if (responseBody.isEmpty()) {
|
||||||
throw Exception("Null Response")
|
throw Exception("Null Response")
|
||||||
}
|
}
|
||||||
|
if(responseBody.contains("\"code\":404")){
|
||||||
|
responseBody = "{\"results\":0,\"list\":[]}"
|
||||||
|
}
|
||||||
val response = parser.parse(responseBody).obj["list"]?.array
|
val response = parser.parse(responseBody).obj["list"]?.array
|
||||||
response?.filter { it.obj["type"].asInt == 1 }?.map { jsonToSearch(it.obj) }
|
response?.filter { it.obj["type"].asInt == 1 }?.map { jsonToSearch(it.obj) }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user