|
|
@ -128,18 +128,24 @@ class WebBook(val bookSource: BookSource) { |
|
|
|
): Coroutine<List<BookChapter>> { |
|
|
|
): Coroutine<List<BookChapter>> { |
|
|
|
return Coroutine.async(scope, context) { |
|
|
|
return Coroutine.async(scope, context) { |
|
|
|
book.type = bookSource.bookSourceType |
|
|
|
book.type = bookSource.bookSourceType |
|
|
|
val body = |
|
|
|
|
|
|
|
if (book.bookUrl == book.tocUrl && !book.tocHtml.isNullOrEmpty()) { |
|
|
|
if (book.bookUrl == book.tocUrl && !book.tocHtml.isNullOrEmpty()) { |
|
|
|
book.tocHtml |
|
|
|
BookChapterList.analyzeChapterList( |
|
|
|
|
|
|
|
this, |
|
|
|
|
|
|
|
book, |
|
|
|
|
|
|
|
book.tocHtml, |
|
|
|
|
|
|
|
bookSource, |
|
|
|
|
|
|
|
book.tocUrl |
|
|
|
|
|
|
|
) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
AnalyzeUrl( |
|
|
|
val res = AnalyzeUrl( |
|
|
|
book = book, |
|
|
|
book = book, |
|
|
|
ruleUrl = book.tocUrl, |
|
|
|
ruleUrl = book.tocUrl, |
|
|
|
baseUrl = book.bookUrl, |
|
|
|
baseUrl = book.bookUrl, |
|
|
|
headerMapF = bookSource.getHeaderMap() |
|
|
|
headerMapF = bookSource.getHeaderMap() |
|
|
|
).getResponseAwait(bookSource.bookSourceUrl).body |
|
|
|
).getResponseAwait(bookSource.bookSourceUrl) |
|
|
|
|
|
|
|
BookChapterList.analyzeChapterList(this, book, res.body, bookSource, res.url) |
|
|
|
} |
|
|
|
} |
|
|
|
BookChapterList.analyzeChapterList(this, book, body, bookSource, book.tocUrl) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -173,31 +179,37 @@ class WebBook(val bookSource: BookSource) { |
|
|
|
Debug.log(sourceUrl, "⇒正文规则为空,使用章节链接:${bookChapter.url}") |
|
|
|
Debug.log(sourceUrl, "⇒正文规则为空,使用章节链接:${bookChapter.url}") |
|
|
|
return bookChapter.url |
|
|
|
return bookChapter.url |
|
|
|
} |
|
|
|
} |
|
|
|
val body = |
|
|
|
return if (bookChapter.url == book.bookUrl && !book.tocHtml.isNullOrEmpty()) { |
|
|
|
if (bookChapter.url == book.bookUrl && !book.tocHtml.isNullOrEmpty()) { |
|
|
|
BookContent.analyzeContent( |
|
|
|
book.tocHtml |
|
|
|
scope, |
|
|
|
|
|
|
|
book.tocHtml, |
|
|
|
|
|
|
|
book, |
|
|
|
|
|
|
|
bookChapter, |
|
|
|
|
|
|
|
bookSource, |
|
|
|
|
|
|
|
bookChapter.getAbsoluteURL(), |
|
|
|
|
|
|
|
nextChapterUrl |
|
|
|
|
|
|
|
) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
val analyzeUrl = AnalyzeUrl( |
|
|
|
val res = AnalyzeUrl( |
|
|
|
ruleUrl = bookChapter.url, |
|
|
|
ruleUrl = bookChapter.getAbsoluteURL(), |
|
|
|
baseUrl = book.tocUrl, |
|
|
|
baseUrl = book.tocUrl, |
|
|
|
headerMapF = bookSource.getHeaderMap(), |
|
|
|
headerMapF = bookSource.getHeaderMap(), |
|
|
|
book = book, |
|
|
|
book = book, |
|
|
|
chapter = bookChapter |
|
|
|
chapter = bookChapter |
|
|
|
) |
|
|
|
).getResponseAwait( |
|
|
|
analyzeUrl.getResponseAwait( |
|
|
|
|
|
|
|
bookSource.bookSourceUrl, |
|
|
|
bookSource.bookSourceUrl, |
|
|
|
jsStr = bookSource.getContentRule().webJs, |
|
|
|
jsStr = bookSource.getContentRule().webJs, |
|
|
|
sourceRegex = bookSource.getContentRule().sourceRegex |
|
|
|
sourceRegex = bookSource.getContentRule().sourceRegex |
|
|
|
).body |
|
|
|
) |
|
|
|
} |
|
|
|
BookContent.analyzeContent( |
|
|
|
return BookContent.analyzeContent( |
|
|
|
|
|
|
|
scope, |
|
|
|
scope, |
|
|
|
body, |
|
|
|
res.body, |
|
|
|
book, |
|
|
|
book, |
|
|
|
bookChapter, |
|
|
|
bookChapter, |
|
|
|
bookSource, |
|
|
|
bookSource, |
|
|
|
bookChapter.url, |
|
|
|
res.url, |
|
|
|
nextChapterUrl |
|
|
|
nextChapterUrl |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |