|
|
@ -62,23 +62,33 @@ object BookChapterList { |
|
|
|
} |
|
|
|
} |
|
|
|
if (reverse) chapterList.reverse() |
|
|
|
if (reverse) chapterList.reverse() |
|
|
|
} else if (chapterData.nextUrl.size > 1) { |
|
|
|
} else if (chapterData.nextUrl.size > 1) { |
|
|
|
|
|
|
|
val chapterDataList = arrayListOf<ChapterData<String>>() |
|
|
|
for (item in chapterData.nextUrl) { |
|
|
|
for (item in chapterData.nextUrl) { |
|
|
|
if (!nextUrlList.contains(item)) { |
|
|
|
if (!nextUrlList.contains(item)) { |
|
|
|
|
|
|
|
val data = ChapterData(nextUrl = item) |
|
|
|
|
|
|
|
chapterDataList.add(data) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (item in chapterDataList) { |
|
|
|
|
|
|
|
if (!nextUrlList.contains(item.nextUrl)) { |
|
|
|
withContext(coroutineScope.coroutineContext) { |
|
|
|
withContext(coroutineScope.coroutineContext) { |
|
|
|
val nextResponse = AnalyzeUrl(ruleUrl = item, book = book).getResponseAsync().await() |
|
|
|
val nextResponse = AnalyzeUrl(ruleUrl = item.nextUrl, book = book).getResponseAsync().await() |
|
|
|
val nextChapterData = analyzeChapterList( |
|
|
|
val nextChapterData = analyzeChapterList( |
|
|
|
nextResponse.body() ?: "", |
|
|
|
nextResponse.body() ?: "", |
|
|
|
item, |
|
|
|
item.nextUrl, |
|
|
|
tocRule, |
|
|
|
tocRule, |
|
|
|
listRule, |
|
|
|
listRule, |
|
|
|
book |
|
|
|
book |
|
|
|
) |
|
|
|
) |
|
|
|
nextChapterData.chapterList?.let { |
|
|
|
item.chapterList = nextChapterData.chapterList |
|
|
|
chapterList.addAll(it) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for (item in chapterDataList) { |
|
|
|
|
|
|
|
item.chapterList?.let { |
|
|
|
|
|
|
|
chapterList.addAll(it) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (reverse) chapterList.reverse() |
|
|
|
if (reverse) chapterList.reverse() |
|
|
|
} |
|
|
|
} |
|
|
|
return chapterList |
|
|
|
return chapterList |
|
|
@ -99,7 +109,7 @@ object BookChapterList { |
|
|
|
analyzeRule.getStringList(tocRule.nextTocUrl ?: "", true)?.let { |
|
|
|
analyzeRule.getStringList(tocRule.nextTocUrl ?: "", true)?.let { |
|
|
|
nextUrlList.addAll(it) |
|
|
|
nextUrlList.addAll(it) |
|
|
|
} |
|
|
|
} |
|
|
|
val elements = analyzeRule.getElements(tocRule.chapterList ?: "") |
|
|
|
val elements = analyzeRule.getElements(listRule) |
|
|
|
if (elements.isNotEmpty()) { |
|
|
|
if (elements.isNotEmpty()) { |
|
|
|
val nameRule = analyzeRule.splitSourceRule(tocRule.chapterName ?: "") |
|
|
|
val nameRule = analyzeRule.splitSourceRule(tocRule.chapterName ?: "") |
|
|
|
val urlRule = analyzeRule.splitSourceRule(tocRule.chapterUrl ?: "") |
|
|
|
val urlRule = analyzeRule.splitSourceRule(tocRule.chapterUrl ?: "") |
|
|
|