pull/48/head
kunfei 5 years ago
parent dac407a470
commit 6ad7cbed20
  1. 1
      app/src/main/java/io/legado/app/model/webbook/BookChapterList.kt
  2. 15
      app/src/main/java/io/legado/app/model/webbook/BookContent.kt
  3. 4
      app/src/main/java/io/legado/app/model/webbook/BookList.kt

@ -159,6 +159,7 @@ object BookChapterList {
for (item in elements) {
analyzeRule.setContent(item)
val bookChapter = BookChapter(bookUrl = book.bookUrl)
analyzeRule.chapter = bookChapter
bookChapter.title = analyzeRule.getString(nameRule)
bookChapter.url = analyzeRule.getString(urlRule, true)
if (bookChapter.url.isEmpty()) bookChapter.url = baseUrl

@ -35,7 +35,7 @@ object BookContent {
val content = StringBuilder()
val nextUrlList = arrayListOf(baseUrl)
val contentRule = bookSource.getContentRule()
var contentData = analyzeContent(body, contentRule, book, bookSource, baseUrl)
var contentData = analyzeContent(body, contentRule, book, bookChapter, bookSource, baseUrl)
content.append(contentData.content)
if (contentData.nextUrl.size == 1) {
var nextUrl = contentData.nextUrl[0]
@ -56,7 +56,15 @@ object BookContent {
).getResponseAwait()
.body()?.let { nextBody ->
contentData =
analyzeContent(nextBody, contentRule, book, bookSource, baseUrl, false)
analyzeContent(
nextBody,
contentRule,
book,
bookChapter,
bookSource,
baseUrl,
false
)
nextUrl =
if (contentData.nextUrl.isNotEmpty()) contentData.nextUrl[0] else ""
content.append(contentData.content)
@ -82,6 +90,7 @@ object BookContent {
it,
contentRule,
book,
bookChapter,
bookSource,
item.nextUrl,
false
@ -106,6 +115,7 @@ object BookContent {
body: String,
contentRule: ContentRule,
book: Book,
chapter: BookChapter,
bookSource: BookSource,
baseUrl: String,
printLog: Boolean = true
@ -113,6 +123,7 @@ object BookContent {
val nextUrlList = arrayListOf<String>()
val analyzeRule = AnalyzeRule(book)
analyzeRule.setContent(body, baseUrl)
analyzeRule.chapter = chapter
val nextUrlRule = contentRule.nextContentUrl
if (!nextUrlRule.isNullOrEmpty()) {
SourceDebug.printLog(bookSource.bookSourceUrl, "┌获取正文下一页链接", printLog)

@ -111,7 +111,7 @@ object BookList {
searchBook.originName = bookSource.bookSourceName
searchBook.originOrder = bookSource.customOrder
searchBook.type = bookSource.bookSourceType
analyzeRule.setBook(searchBook)
analyzeRule.book = searchBook
with(bookSource.getBookInfoRule()) {
init?.let {
if (it.isNotEmpty()) {
@ -167,7 +167,7 @@ object BookList {
searchBook.originName = bookSource.bookSourceName
searchBook.type = bookSource.bookSourceType
searchBook.originOrder = bookSource.customOrder
analyzeRule.setBook(searchBook)
analyzeRule.book = searchBook
analyzeRule.setContent(item)
SourceDebug.printLog(bookSource.bookSourceUrl, "┌获取书名", printLog)
searchBook.name = analyzeRule.getString(ruleName)

Loading…
Cancel
Save