pull/1941/head
kunfei 3 years ago
parent 7efe1e537c
commit cf4ba745f8
  1. 5
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt

@ -12,6 +12,7 @@ import io.legado.app.help.http.CookieStore
import io.legado.app.model.webBook.WebBook import io.legado.app.model.webBook.WebBook
import io.legado.app.utils.* import io.legado.app.utils.*
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withTimeout
import org.jsoup.nodes.Entities import org.jsoup.nodes.Entities
import org.mozilla.javascript.NativeObject import org.mozilla.javascript.NativeObject
import java.net.URL import java.net.URL
@ -712,6 +713,7 @@ class AnalyzeRule(
val book = book as? Book val book = book as? Book
if (bookSource == null || book == null) return if (bookSource == null || book == null) return
runBlocking { runBlocking {
withTimeout(1800000) {
WebBook.preciseSearchAwait(this, bookSource, book.name, book.author) WebBook.preciseSearchAwait(this, bookSource, book.name, book.author)
.getOrThrow().let { .getOrThrow().let {
book.bookUrl = it.bookUrl book.bookUrl = it.bookUrl
@ -722,6 +724,7 @@ class AnalyzeRule(
WebBook.getBookInfoAwait(this, bookSource, book, false) WebBook.getBookInfoAwait(this, bookSource, book, false)
} }
} }
}
/** /**
* 更新tocUrl,有些书源目录url定期更新,可以在js调用更新 * 更新tocUrl,有些书源目录url定期更新,可以在js调用更新
@ -731,9 +734,11 @@ class AnalyzeRule(
val book = book as? Book val book = book as? Book
if (bookSource == null || book == null) return if (bookSource == null || book == null) return
runBlocking { runBlocking {
withTimeout(1800000) {
WebBook.getBookInfoAwait(this, bookSource, book) WebBook.getBookInfoAwait(this, bookSource, book)
} }
} }
}
companion object { companion object {
private val putPattern = Pattern.compile("@put:(\\{[^}]+?\\})", Pattern.CASE_INSENSITIVE) private val putPattern = Pattern.compile("@put:(\\{[^}]+?\\})", Pattern.CASE_INSENSITIVE)

Loading…
Cancel
Save