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