[RU]ComX Antibot returned detect ( (#12228)

solve works)
This commit is contained in:
Ejan 2022-06-18 18:40:45 +05:00 committed by GitHub
parent 5cf8a7cb9b
commit 81a8e77845
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Com-X' extName = 'Com-X'
pkgNameSuffix = 'ru.comx' pkgNameSuffix = 'ru.comx'
extClass = '.ComX' extClass = '.ComX'
extVersionCode = 21 extVersionCode = 22
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -33,6 +33,7 @@ import org.jsoup.nodes.Document
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
import rx.Observable import rx.Observable
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.io.IOException
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
@ -91,6 +92,13 @@ class ComX : ParsedHttpSource() {
} }
} }
) )
.addInterceptor { chain ->
val originalRequest = chain.request()
val response = chain.proceed(originalRequest)
if (response.code == 404 && response.asJsoup().toString().contains("Protected by Batman"))
throw IOException("Antibot, попробуйте пройти капчу в WebView")
response
}
.build() .build()
override fun headersBuilder(): Headers.Builder = Headers.Builder() override fun headersBuilder(): Headers.Builder = Headers.Builder()