@ -29,15 +29,16 @@ interface JsExtensions {
* 访问网络,返回String
*/
fun ajax(urlStr: String): String? {
return try {
return runBlocking {
try {
val analyzeUrl = AnalyzeUrl(urlStr)
runBlocking {
analyzeUrl.getStrResponse(urlStr).body
}
} catch (e: Exception) {
e.printStackTrace()
e.msg
/**
* 访问网络,返回Response<String>
@ -8,7 +8,7 @@ import rxhttp.wrapper.exception.HttpStatusCodeException
import java.nio.charset.Charset
@Parser(name = "Text")
class TextParser(val encode: String? = null) : rxhttp.wrapper.parse.Parser<String> {
class TextParser(private val encode: String? = null) : rxhttp.wrapper.parse.Parser<String> {
override fun onParse(response: Response): String {
@ -653,13 +653,14 @@ class AnalyzeRule(val ruleData: RuleDataInterface) : JsExtensions {
* js实现跨域访问,不能删
override fun ajax(urlStr: String): String? {
val analyzeUrl = AnalyzeUrl(urlStr, book = book)
e.localizedMessage