pull/540/head
gedoor 4 years ago
parent e379db115f
commit 3e42e2c133
  1. 3
      app/src/main/java/io/legado/app/help/http/parser/StrResponseParser.kt
  2. 1
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt
  3. 1
      app/src/main/java/io/legado/app/ui/book/explore/ExploreShowViewModel.kt

@ -12,7 +12,8 @@ import java.nio.charset.Charset
class StrResponseParser(val encode: String? = null) : rxhttp.wrapper.parse.Parser<StrResponse> { class StrResponseParser(val encode: String? = null) : rxhttp.wrapper.parse.Parser<StrResponse> {
override fun onParse(response: Response): StrResponse { override fun onParse(response: Response): StrResponse {
return StrResponse.success(getString(response), response) val body = getString(response)
return StrResponse.success(body, response)
} }
private fun getString(response: Response): String { private fun getString(response: Response): String {

@ -312,6 +312,7 @@ class AnalyzeUrl(
else -> RxHttp.get(url) else -> RxHttp.get(url)
.setOkClient(HttpHelper.getProxyClient(proxy)) .setOkClient(HttpHelper.getProxyClient(proxy))
.addAll(fieldMap) .addAll(fieldMap)
.addAllHeader(headerMap)
.toStrResponse().await() .toStrResponse().await()
} }
} }

@ -41,6 +41,7 @@ class ExploreShowViewModel(application: Application) : BaseViewModel(application
App.db.searchBookDao.insert(*searchBooks.toTypedArray()) App.db.searchBookDao.insert(*searchBooks.toTypedArray())
page++ page++
}.onError { }.onError {
it.printStackTrace()
toast(it.msg) toast(it.msg)
} }
} }

Loading…
Cancel
Save