RCO: Fix timeout getting image links error (#8433)

* RCO: Fix timeout getting image links error

* Update regex
This commit is contained in:
lamaxama 2025-04-12 14:40:21 +08:00 committed by Draff
parent 54055cb43c
commit 1d2fc4493c
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 6 additions and 5 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'ReadComicOnline'
extClass = '.Readcomiconline'
extVersionCode = 29
extVersionCode = 30
}
apply from: "$rootDir/common.gradle"

View File

@ -234,7 +234,8 @@ class Readcomiconline : ConfigurableSource, ParsedHttpSource() {
var webView: WebView? = null
var images: List<String> = emptyList()
val match = KEY_REGEX.find(document.outerHtml())
val html = document.outerHtml()
val match = KEY_REGEX.find(html)
val key1 = match?.groups?.get(1)?.value ?: throw Exception("Fail to get image links.")
val key2 = match?.groups?.get(2)?.value ?: throw Exception("Fail to get image links.")
handler.post {
@ -285,14 +286,14 @@ class Readcomiconline : ConfigurableSource, ParsedHttpSource() {
innerWv.loadDataWithBaseURL(
document.location(),
document.outerHtml(),
html,
"text/html",
"UTF-8",
null,
)
}
latch.await(30, TimeUnit.SECONDS)
latch.await(10, TimeUnit.SECONDS)
handler.post { webView?.destroy() }
if (latch.count == 1L) {
@ -443,6 +444,6 @@ class Readcomiconline : ConfigurableSource, ParsedHttpSource() {
private const val QUALITY_PREF = "qualitypref"
private const val SERVER_PREF_TITLE = "Server Preference"
private const val SERVER_PREF = "serverpref"
private val KEY_REGEX = """\.attr\('src',\s*([^\(]+)\(([^\[]+)\[currImage\]\)""".toRegex()
private val KEY_REGEX = """\.attr\(\s*['"]src['"]\s*,\s*([\w]+)\(\s*([\w]+)\[\s*currImage""".toRegex()
}
}