diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt index eb4230e1a..088090555 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt @@ -55,6 +55,7 @@ class AnalyzeUrl( private var charset: String? = null private var method = RequestMethod.GET private var proxy: String? = null + private var retry: Int = 0 init { baseUrl = baseUrl.split(splitUrlRegex, 1)[0] @@ -197,6 +198,7 @@ class AnalyzeUrl( option.js?.let { evalJS(it) } + retry = option.retry } } headerMap[UA_NAME] ?: let { @@ -304,7 +306,7 @@ class AnalyzeUrl( params.tag = tag return getWebViewSrc(params) } - return getProxyClient(proxy).newCallStrResponse { + return getProxyClient(proxy).newCallStrResponse(retry) { removeHeader(UA_NAME) headerMap.forEach { addHeader(it.key, it.value) @@ -326,7 +328,7 @@ class AnalyzeUrl( suspend fun getByteArray(tag: String? = null): ByteArray { setCookie(tag) @Suppress("BlockingMethodInNonBlockingContext") - return getProxyClient(proxy).newCall { + return getProxyClient(proxy).newCall(retry) { removeHeader(UA_NAME) headerMap.forEach { addHeader(it.key, it.value) @@ -375,7 +377,8 @@ class AnalyzeUrl( val headers: Any?, val body: Any?, val type: String?, - val js: String? + val js: String?, + val retry: Int = 0 ) }