|
|
|
@ -5,6 +5,7 @@ import io.legado.app.data.entities.BookChapter |
|
|
|
|
import io.legado.app.data.entities.BookSource |
|
|
|
|
import io.legado.app.data.entities.SearchBook |
|
|
|
|
import io.legado.app.help.coroutine.Coroutine |
|
|
|
|
import io.legado.app.help.http.StrResponse |
|
|
|
|
import io.legado.app.model.Debug |
|
|
|
|
import io.legado.app.model.analyzeRule.AnalyzeUrl |
|
|
|
|
import kotlinx.coroutines.CoroutineScope |
|
|
|
@ -47,15 +48,7 @@ class WebBook(val bookSource: BookSource) { |
|
|
|
|
book = variableBook |
|
|
|
|
) |
|
|
|
|
val res = analyzeUrl.getStrResponse(bookSource.bookSourceUrl) |
|
|
|
|
return BookList.analyzeBookList( |
|
|
|
|
scope, |
|
|
|
|
res.body, |
|
|
|
|
bookSource, |
|
|
|
|
analyzeUrl, |
|
|
|
|
res.url, |
|
|
|
|
variableBook, |
|
|
|
|
true |
|
|
|
|
) |
|
|
|
|
return BookList.analyzeBookList(scope, res, bookSource, analyzeUrl, variableBook, true) |
|
|
|
|
} |
|
|
|
|
return arrayListOf() |
|
|
|
|
} |
|
|
|
@ -88,15 +81,7 @@ class WebBook(val bookSource: BookSource) { |
|
|
|
|
headerMapF = bookSource.getHeaderMap() |
|
|
|
|
) |
|
|
|
|
val res = analyzeUrl.getStrResponse(bookSource.bookSourceUrl) |
|
|
|
|
return BookList.analyzeBookList( |
|
|
|
|
scope, |
|
|
|
|
res.body, |
|
|
|
|
bookSource, |
|
|
|
|
analyzeUrl, |
|
|
|
|
res.url, |
|
|
|
|
variableBook, |
|
|
|
|
false |
|
|
|
|
) |
|
|
|
|
return BookList.analyzeBookList(scope, res, bookSource, analyzeUrl, variableBook, false) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -120,16 +105,8 @@ class WebBook(val bookSource: BookSource) { |
|
|
|
|
): Book { |
|
|
|
|
book.type = bookSource.bookSourceType |
|
|
|
|
if (!book.infoHtml.isNullOrEmpty()) { |
|
|
|
|
book.infoHtml |
|
|
|
|
BookInfo.analyzeBookInfo( |
|
|
|
|
scope, |
|
|
|
|
book, |
|
|
|
|
book.infoHtml, |
|
|
|
|
bookSource, |
|
|
|
|
book.bookUrl, |
|
|
|
|
book.bookUrl, |
|
|
|
|
canReName |
|
|
|
|
) |
|
|
|
|
val strResponse = StrResponse(book.bookUrl, book.infoHtml) |
|
|
|
|
BookInfo.analyzeBookInfo(scope, strResponse, bookSource, book, book.bookUrl, canReName) |
|
|
|
|
} else { |
|
|
|
|
val res = AnalyzeUrl( |
|
|
|
|
ruleUrl = book.bookUrl, |
|
|
|
@ -137,15 +114,7 @@ class WebBook(val bookSource: BookSource) { |
|
|
|
|
headerMapF = bookSource.getHeaderMap(), |
|
|
|
|
book = book |
|
|
|
|
).getStrResponse(bookSource.bookSourceUrl) |
|
|
|
|
BookInfo.analyzeBookInfo( |
|
|
|
|
scope, |
|
|
|
|
book, |
|
|
|
|
res.body, |
|
|
|
|
bookSource, |
|
|
|
|
book.bookUrl, |
|
|
|
|
res.url, |
|
|
|
|
canReName |
|
|
|
|
) |
|
|
|
|
BookInfo.analyzeBookInfo(scope, res, bookSource, book, book.bookUrl, canReName) |
|
|
|
|
} |
|
|
|
|
return book |
|
|
|
|
} |
|
|
|
@ -169,14 +138,8 @@ class WebBook(val bookSource: BookSource) { |
|
|
|
|
): List<BookChapter> { |
|
|
|
|
book.type = bookSource.bookSourceType |
|
|
|
|
return if (book.bookUrl == book.tocUrl && !book.tocHtml.isNullOrEmpty()) { |
|
|
|
|
BookChapterList.analyzeChapterList( |
|
|
|
|
scope, |
|
|
|
|
book, |
|
|
|
|
book.tocHtml, |
|
|
|
|
bookSource, |
|
|
|
|
book.tocUrl, |
|
|
|
|
book.tocUrl |
|
|
|
|
) |
|
|
|
|
val strResponse = StrResponse(book.tocUrl, book.tocHtml) |
|
|
|
|
BookChapterList.analyzeChapterList(scope, strResponse, bookSource, book, book.tocUrl) |
|
|
|
|
} else { |
|
|
|
|
val res = AnalyzeUrl( |
|
|
|
|
book = book, |
|
|
|
@ -184,14 +147,7 @@ class WebBook(val bookSource: BookSource) { |
|
|
|
|
baseUrl = book.bookUrl, |
|
|
|
|
headerMapF = bookSource.getHeaderMap() |
|
|
|
|
).getStrResponse(bookSource.bookSourceUrl) |
|
|
|
|
BookChapterList.analyzeChapterList( |
|
|
|
|
scope, |
|
|
|
|
book, |
|
|
|
|
res.body, |
|
|
|
|
bookSource, |
|
|
|
|
book.tocUrl, |
|
|
|
|
res.url |
|
|
|
|
) |
|
|
|
|
BookChapterList.analyzeChapterList(scope, res, bookSource, book, book.tocUrl) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -221,13 +177,13 @@ class WebBook(val bookSource: BookSource) { |
|
|
|
|
return bookChapter.url |
|
|
|
|
} |
|
|
|
|
return if (bookChapter.url == book.bookUrl && !book.tocHtml.isNullOrEmpty()) { |
|
|
|
|
val strResponse = StrResponse(bookChapter.getAbsoluteURL(), book.tocHtml) |
|
|
|
|
BookContent.analyzeContent( |
|
|
|
|
scope, |
|
|
|
|
book.tocHtml, |
|
|
|
|
strResponse, |
|
|
|
|
bookSource, |
|
|
|
|
book, |
|
|
|
|
bookChapter, |
|
|
|
|
bookSource, |
|
|
|
|
bookChapter.getAbsoluteURL(), |
|
|
|
|
bookChapter.getAbsoluteURL(), |
|
|
|
|
nextChapterUrl |
|
|
|
|
) |
|
|
|
@ -245,12 +201,11 @@ class WebBook(val bookSource: BookSource) { |
|
|
|
|
) |
|
|
|
|
BookContent.analyzeContent( |
|
|
|
|
scope, |
|
|
|
|
res.body, |
|
|
|
|
res, |
|
|
|
|
bookSource, |
|
|
|
|
book, |
|
|
|
|
bookChapter, |
|
|
|
|
bookSource, |
|
|
|
|
bookChapter.getAbsoluteURL(), |
|
|
|
|
res.url, |
|
|
|
|
nextChapterUrl |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|