|
|
|
@ -19,7 +19,7 @@ class WebBook(private val bookSource: BookSource) { |
|
|
|
|
fun searchBook(key: String, page: Int?, isSearch: Boolean = true): Coroutine<List<SearchBook>> { |
|
|
|
|
return Coroutine.async { |
|
|
|
|
bookSource.getSearchRule().searchUrl?.let { searchUrl -> |
|
|
|
|
val analyzeUrl = AnalyzeUrl(searchUrl, key, page, baseUrl = bookSource.bookSourceUrl) |
|
|
|
|
val analyzeUrl = AnalyzeUrl(searchUrl, key, page, baseUrl = sourceUrl) |
|
|
|
|
val response = analyzeUrl.getResponseAsync().await() |
|
|
|
|
BookList.analyzeBookList(response, bookSource, analyzeUrl, isSearch) |
|
|
|
|
} ?: arrayListOf() |
|
|
|
@ -28,7 +28,7 @@ class WebBook(private val bookSource: BookSource) { |
|
|
|
|
|
|
|
|
|
fun getBookInfo(book: Book): Coroutine<Book> { |
|
|
|
|
return Coroutine.async { |
|
|
|
|
val analyzeUrl = AnalyzeUrl(book = book, ruleUrl = book.bookUrl) |
|
|
|
|
val analyzeUrl = AnalyzeUrl(book = book, ruleUrl = book.bookUrl, baseUrl = sourceUrl) |
|
|
|
|
val response = analyzeUrl.getResponseAsync().await() |
|
|
|
|
BookInfo.analyzeBookInfo(book, response.body(), bookSource, analyzeUrl) |
|
|
|
|
book |
|
|
|
@ -37,7 +37,7 @@ class WebBook(private val bookSource: BookSource) { |
|
|
|
|
|
|
|
|
|
fun getChapterList(book: Book): Coroutine<List<BookChapter>> { |
|
|
|
|
return Coroutine.async { |
|
|
|
|
val analyzeUrl = AnalyzeUrl(book = book, ruleUrl = book.tocUrl) |
|
|
|
|
val analyzeUrl = AnalyzeUrl(book = book, ruleUrl = book.tocUrl, baseUrl = book.bookUrl) |
|
|
|
|
val response = analyzeUrl.getResponseAsync().await() |
|
|
|
|
BookChapterList.analyzeChapterList(this, book, response, bookSource, analyzeUrl) |
|
|
|
|
} |
|
|
|
@ -45,9 +45,9 @@ class WebBook(private val bookSource: BookSource) { |
|
|
|
|
|
|
|
|
|
fun getContent(book: Book, bookChapter: BookChapter): Coroutine<String> { |
|
|
|
|
return Coroutine.async { |
|
|
|
|
val analyzeUrl = AnalyzeUrl(book = book, ruleUrl = bookChapter.url) |
|
|
|
|
val analyzeUrl = AnalyzeUrl(book = book, ruleUrl = bookChapter.url, baseUrl = book.tocUrl) |
|
|
|
|
val response = analyzeUrl.getResponseAsync().await() |
|
|
|
|
BookContent.analyzeContent(this, response, book, bookChapter, bookSource, analyzeUrl) |
|
|
|
|
BookContent.analyzeContent(this, response, book, bookSource) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |