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