diff --git a/app/src/main/java/io/legado/app/data/entities/Book.kt b/app/src/main/java/io/legado/app/data/entities/Book.kt index 239097013..89555fe9e 100644 --- a/app/src/main/java/io/legado/app/data/entities/Book.kt +++ b/app/src/main/java/io/legado/app/data/entities/Book.kt @@ -21,7 +21,7 @@ data class Book( var origin: String = "", // 书源URL(默认BookType.local) var name: String? = null, // 书籍名称(书源获取) var author: String? = null, // 作者名称(书源获取) - var tag: String? = null, // 分类信息(书源获取) + var kind: String? = null, // 分类信息(书源获取) var customTag: String? = null, // 分类信息(用户修改) var coverUrl: String? = null, // 封面Url(书源获取) var customCoverUrl: String? = null, // 封面Url(用户修改) 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 bc08d8219..dd04cf238 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 @@ -20,7 +20,7 @@ data class SearchBook( var originName: String = "", var name: String? = null, var author: String? = null, - var tag: String? = null, + var kind: String? = null, var coverUrl: String? = null, var intro: String? = null, var latestChapterTitle: String? = null, 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 4676828dd..480778959 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 @@ -8,6 +8,7 @@ import io.legado.app.data.entities.rule.BookListRule import io.legado.app.model.analyzeRule.AnalyzeRule import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.utils.NetworkUtils +import org.mozilla.javascript.NativeObject import retrofit2.Response class BookList { @@ -64,7 +65,7 @@ class BookList { } else { if (allInOne) { for (item in collections) { - getAllInOneItem(analyzer, bookListRule, bookSource, baseUrl)?.let { searchBook -> + getAllInOneItem(item, analyzer, bookListRule, bookSource, baseUrl)?.let { searchBook -> if (baseUrl == searchBook.bookUrl) { searchBook.bookInfoHtml = body } @@ -101,7 +102,7 @@ class BookList { searchBook.coverUrl = analyzeRule.getString(coverUrl ?: "") searchBook.intro = analyzeRule.getString(intro ?: "") searchBook.latestChapterTitle = analyzeRule.getString(lastChapter ?: "") - + searchBook.kind = analyzeRule.getString(kind ?: "") return searchBook } } @@ -109,6 +110,7 @@ class BookList { } private fun getAllInOneItem( + item: Any, analyzeRule: AnalyzeRule, bookListRule: BookListRule, bookSource: BookSource, @@ -117,8 +119,14 @@ class BookList { val searchBook = SearchBook() searchBook.origin = bookSource.bookSourceUrl searchBook.originName = bookSource.bookSourceName - - + val nativeObject = item as NativeObject + searchBook.name = nativeObject[bookListRule.name]?.toString() + searchBook.name?.let { + searchBook.author = nativeObject[bookListRule.author]?.toString() + searchBook.coverUrl = nativeObject[bookListRule.coverUrl]?.toString() + searchBook.intro = nativeObject[bookListRule.intro]?.toString() + searchBook.kind = nativeObject[bookListRule.kind]?.toString() + } return null }