|
|
|
@ -4,7 +4,9 @@ import io.legado.app.App |
|
|
|
|
import io.legado.app.R |
|
|
|
|
import io.legado.app.data.entities.BookSource |
|
|
|
|
import io.legado.app.data.entities.SearchBook |
|
|
|
|
import io.legado.app.model.analyzeRule.AnalyzeRule |
|
|
|
|
import io.legado.app.model.analyzeRule.AnalyzeUrl |
|
|
|
|
import io.legado.app.utils.NetworkUtils |
|
|
|
|
import retrofit2.Response |
|
|
|
|
|
|
|
|
|
class BookList { |
|
|
|
@ -17,13 +19,16 @@ class BookList { |
|
|
|
|
isSearch: Boolean = true |
|
|
|
|
): ArrayList<SearchBook> { |
|
|
|
|
var bookList = ArrayList<SearchBook>() |
|
|
|
|
val baseUrl: String = NetworkUtils.getUrl(response) |
|
|
|
|
val body: String? = response.body() |
|
|
|
|
body ?: throw Exception( |
|
|
|
|
App.INSTANCE.getString( |
|
|
|
|
R.string.get_web_content_error, |
|
|
|
|
analyzeUrl.url |
|
|
|
|
baseUrl |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
val analyzer = AnalyzeRule(null) |
|
|
|
|
analyzer.setContent(body, baseUrl) |
|
|
|
|
|
|
|
|
|
return bookList |
|
|
|
|
} |
|
|
|
|