pull/34/head
kunfei 5 years ago
parent e16cb8df0a
commit 975bd42526
  1. 1
      app/src/main/java/io/legado/app/model/WebBook.kt
  2. 2
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt
  3. 9
      app/src/main/java/io/legado/app/model/webbook/BookChapterList.kt
  4. 5
      app/src/main/java/io/legado/app/model/webbook/BookContent.kt
  5. 4
      app/src/main/java/io/legado/app/model/webbook/BookInfo.kt
  6. 4
      app/src/main/java/io/legado/app/model/webbook/BookList.kt

@ -114,6 +114,7 @@ class WebBook(val bookSource: BookSource) {
book, book,
bookChapter, bookChapter,
bookSource, bookSource,
analyzeUrl,
nextChapterUrl nextChapterUrl
) )
} }

@ -30,7 +30,7 @@ import javax.script.SimpleBindings
@Keep @Keep
@SuppressLint("DefaultLocale") @SuppressLint("DefaultLocale")
class AnalyzeUrl( class AnalyzeUrl(
private var ruleUrl: String, var ruleUrl: String,
key: String? = null, key: String? = null,
page: Int? = null, page: Int? = null,
headerMapF: Map<String, String>? = null, headerMapF: Map<String, String>? = null,

@ -26,8 +26,13 @@ object BookChapterList {
var chapterList = arrayListOf<BookChapter>() var chapterList = arrayListOf<BookChapter>()
val baseUrl: String = NetworkUtils.getUrl(response) val baseUrl: String = NetworkUtils.getUrl(response)
val body: String? = response.body() val body: String? = response.body()
body ?: throw Exception(App.INSTANCE.getString(R.string.error_get_web_content, baseUrl)) body ?: throw Exception(
SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取成功:$baseUrl") App.INSTANCE.getString(
R.string.error_get_web_content,
analyzeUrl.ruleUrl
)
)
SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取成功:${analyzeUrl.ruleUrl}")
val tocRule = bookSource.getTocRule() val tocRule = bookSource.getTocRule()
val nextUrlList = arrayListOf(baseUrl) val nextUrlList = arrayListOf(baseUrl)
var reverse = false var reverse = false

@ -23,6 +23,7 @@ object BookContent {
book: Book, book: Book,
bookChapter: BookChapter, bookChapter: BookChapter,
bookSource: BookSource, bookSource: BookSource,
analyzeUrl: AnalyzeUrl,
nextChapterUrlF: String? = null nextChapterUrlF: String? = null
): String { ): String {
val baseUrl: String = NetworkUtils.getUrl(response) val baseUrl: String = NetworkUtils.getUrl(response)
@ -30,10 +31,10 @@ object BookContent {
body ?: throw Exception( body ?: throw Exception(
App.INSTANCE.getString( App.INSTANCE.getString(
R.string.error_get_web_content, R.string.error_get_web_content,
baseUrl analyzeUrl.ruleUrl
) )
) )
SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取成功:$baseUrl") SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取成功:${analyzeUrl.ruleUrl}")
val content = StringBuilder() val content = StringBuilder()
val nextUrlList = arrayListOf(baseUrl) val nextUrlList = arrayListOf(baseUrl)
val contentRule = bookSource.getContentRule() val contentRule = bookSource.getContentRule()

@ -21,10 +21,10 @@ object BookInfo {
body ?: throw Exception( body ?: throw Exception(
App.INSTANCE.getString( App.INSTANCE.getString(
R.string.error_get_web_content, R.string.error_get_web_content,
baseUrl analyzeUrl.ruleUrl
) )
) )
SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取成功:$baseUrl") SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取成功:${analyzeUrl.ruleUrl}")
val infoRule = bookSource.getBookInfoRule() val infoRule = bookSource.getBookInfoRule()
val analyzeRule = AnalyzeRule(book) val analyzeRule = AnalyzeRule(book)
analyzeRule.setContent(body, baseUrl) analyzeRule.setContent(body, baseUrl)

@ -25,10 +25,10 @@ object BookList {
body ?: throw Exception( body ?: throw Exception(
App.INSTANCE.getString( App.INSTANCE.getString(
R.string.error_get_web_content, R.string.error_get_web_content,
baseUrl analyzeUrl.ruleUrl
) )
) )
SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取成功:$baseUrl") SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取成功:${analyzeUrl.ruleUrl}")
val analyzeRule = AnalyzeRule(null) val analyzeRule = AnalyzeRule(null)
analyzeRule.setContent(body, baseUrl) analyzeRule.setContent(body, baseUrl)
bookSource.bookUrlPattern?.let { bookSource.bookUrlPattern?.let {

Loading…
Cancel
Save