diff --git a/app/src/main/java/io/legado/app/data/entities/SearchBook.kt b/app/src/main/java/io/legado/app/data/entities/SearchBook.kt index dd04cf238..8b76eea87 100644 --- a/app/src/main/java/io/legado/app/data/entities/SearchBook.kt +++ b/app/src/main/java/io/legado/app/data/entities/SearchBook.kt @@ -23,6 +23,7 @@ data class SearchBook( var kind: String? = null, var coverUrl: String? = null, var intro: String? = null, + var wordCount: String? = null, var latestChapterTitle: String? = null, var time: Long = 0L, var variable: String? = null, diff --git a/app/src/main/java/io/legado/app/model/webbook/BookInfo.kt b/app/src/main/java/io/legado/app/model/webbook/BookInfo.kt index 9bc05a2e0..edcb2e1ed 100644 --- a/app/src/main/java/io/legado/app/model/webbook/BookInfo.kt +++ b/app/src/main/java/io/legado/app/model/webbook/BookInfo.kt @@ -1,5 +1,29 @@ package io.legado.app.model.webbook +import io.legado.app.App +import io.legado.app.R +import io.legado.app.data.entities.Book +import io.legado.app.data.entities.BookSource +import io.legado.app.model.analyzeRule.AnalyzeUrl + object BookInfo { + @Throws(Exception::class) + fun analyzeBookInfo( + book: Book, + body: String?, + bookSource: BookSource, + analyzeUrl: AnalyzeUrl, + isSearch: Boolean = true + ) { + val baseUrl = analyzeUrl.url + body ?: throw Exception( + App.INSTANCE.getString( + R.string.get_web_content_error, + baseUrl + ) + ) + + } + } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/model/webbook/BookList.kt b/app/src/main/java/io/legado/app/model/webbook/BookList.kt index 72ed43060..3c71fd711 100644 --- a/app/src/main/java/io/legado/app/model/webbook/BookList.kt +++ b/app/src/main/java/io/legado/app/model/webbook/BookList.kt @@ -103,6 +103,8 @@ object BookList { searchBook.intro = analyzeRule.getString(intro ?: "") searchBook.latestChapterTitle = analyzeRule.getString(lastChapter ?: "") searchBook.kind = analyzeRule.getString(kind ?: "") + searchBook.wordCount = analyzeRule.getString(wordCount ?: "") + return searchBook } } @@ -126,7 +128,7 @@ object BookList { searchBook.coverUrl = nativeObject[bookListRule.coverUrl]?.toString() searchBook.intro = nativeObject[bookListRule.intro]?.toString() searchBook.kind = nativeObject[bookListRule.kind]?.toString() - + searchBook.wordCount = nativeObject[bookListRule.wordCount]?.toString() return searchBook } return null @@ -149,6 +151,7 @@ object BookList { searchBook.author = analyzeRule.getString(bookListRule.author ?: "") searchBook.kind = analyzeRule.getString(bookListRule.kind ?: "") searchBook.intro = analyzeRule.getString(bookListRule.intro ?: "") + searchBook.wordCount = analyzeRule.getString(bookListRule.wordCount ?: "") return searchBook }