解析正文url时传入chapter参数

pull/416/head
gedoor 4 years ago
parent ee569a38d5
commit e3485cba92
  1. 1
      app/src/main/assets/updateLog.md
  2. 4
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt
  3. 18
      app/src/main/java/io/legado/app/model/webBook/WebBook.kt

@ -6,6 +6,7 @@
**2020/10/04**
* 更新时预下载10章
* 支持更多分组
*
**2020/10/02**
* 优化规则解析

@ -11,6 +11,7 @@ import io.legado.app.constant.AppConst.userAgent
import io.legado.app.constant.AppPattern.EXP_PATTERN
import io.legado.app.constant.AppPattern.JS_PATTERN
import io.legado.app.data.entities.BaseBook
import io.legado.app.data.entities.BookChapter
import io.legado.app.help.JsExtensions
import io.legado.app.help.http.*
import io.legado.app.help.http.api.HttpGetApi
@ -39,8 +40,9 @@ class AnalyzeUrl(
speakSpeed: Int? = null,
headerMapF: Map<String, String>? = null,
baseUrl: String? = null,
val book: BaseBook? = null,
var useWebView: Boolean = false,
val book: BaseBook? = null,
val chapter: BookChapter? = null
) : JsExtensions {
companion object {
private val pagePattern = Pattern.compile("<(.*?)>")

@ -106,10 +106,10 @@ class WebBook(val bookSource: BookSource) {
book.infoHtml
} else {
val analyzeUrl = AnalyzeUrl(
book = book,
ruleUrl = book.bookUrl,
baseUrl = sourceUrl,
headerMapF = bookSource.getHeaderMap()
headerMapF = bookSource.getHeaderMap(),
book = book
)
analyzeUrl.getResponseAwait(bookSource.bookSourceUrl).body
}
@ -177,13 +177,13 @@ class WebBook(val bookSource: BookSource) {
if (bookChapter.url == book.bookUrl && !book.tocHtml.isNullOrEmpty()) {
book.tocHtml
} else {
val analyzeUrl =
AnalyzeUrl(
book = book,
ruleUrl = bookChapter.url,
baseUrl = book.tocUrl,
headerMapF = bookSource.getHeaderMap()
)
val analyzeUrl = AnalyzeUrl(
ruleUrl = bookChapter.url,
baseUrl = book.tocUrl,
headerMapF = bookSource.getHeaderMap(),
book = book,
chapter = bookChapter
)
analyzeUrl.getResponseAwait(
bookSource.bookSourceUrl,
jsStr = bookSource.getContentRule().webJs,

Loading…
Cancel
Save