|
|
@ -209,8 +209,27 @@ object BookChapterList { |
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌获取目录列表", log) |
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌获取目录列表", log) |
|
|
|
val elements = analyzeRule.getElements(listRule) |
|
|
|
val elements = analyzeRule.getElements(listRule) |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└列表大小:${elements.size}", log) |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└列表大小:${elements.size}", log) |
|
|
|
|
|
|
|
//获取下一页链接 |
|
|
|
|
|
|
|
val nextUrlList = arrayListOf<String>() |
|
|
|
|
|
|
|
val nextTocRule = tocRule.nextTocUrl |
|
|
|
|
|
|
|
if (getNextUrl && !nextTocRule.isNullOrEmpty()) { |
|
|
|
|
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌获取目录下一页列表", log) |
|
|
|
|
|
|
|
analyzeRule.getStringList(nextTocRule, true)?.let { |
|
|
|
|
|
|
|
for (item in it) { |
|
|
|
|
|
|
|
if (item != baseUrl) { |
|
|
|
|
|
|
|
nextUrlList.add(item) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Debug.log( |
|
|
|
|
|
|
|
bookSource.bookSourceUrl, |
|
|
|
|
|
|
|
"└" + TextUtils.join(",\n", nextUrlList), |
|
|
|
|
|
|
|
log |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
scope.ensureActive() |
|
|
|
scope.ensureActive() |
|
|
|
if (elements.isNotEmpty()) { |
|
|
|
if (elements.isNotEmpty()) { |
|
|
|
|
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌解析目录列表", log) |
|
|
|
val nameRule = analyzeRule.splitSourceRule(tocRule.chapterName) |
|
|
|
val nameRule = analyzeRule.splitSourceRule(tocRule.chapterName) |
|
|
|
val urlRule = analyzeRule.splitSourceRule(tocRule.chapterUrl) |
|
|
|
val urlRule = analyzeRule.splitSourceRule(tocRule.chapterUrl) |
|
|
|
val vipRule = analyzeRule.splitSourceRule(tocRule.isVip) |
|
|
|
val vipRule = analyzeRule.splitSourceRule(tocRule.isVip) |
|
|
@ -235,31 +254,14 @@ object BookChapterList { |
|
|
|
chapterList.add(bookChapter) |
|
|
|
chapterList.add(bookChapter) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌获取首章名称", log) |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└解析目录列表完成", log) |
|
|
|
|
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌首章名称", log) |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└${chapterList[0].title}", log) |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└${chapterList[0].title}", log) |
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌获取首章链接", log) |
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌首章链接", log) |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└${chapterList[0].url}", log) |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└${chapterList[0].url}", log) |
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌获取首章信息", log) |
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌首章信息", log) |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└${chapterList[0].tag}", log) |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└${chapterList[0].tag}", log) |
|
|
|
} |
|
|
|
} |
|
|
|
//获取下一页链接 |
|
|
|
|
|
|
|
val nextUrlList = arrayListOf<String>() |
|
|
|
|
|
|
|
val nextTocRule = tocRule.nextTocUrl |
|
|
|
|
|
|
|
if (getNextUrl && !nextTocRule.isNullOrEmpty()) { |
|
|
|
|
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌获取目录下一页列表", log) |
|
|
|
|
|
|
|
analyzeRule.getStringList(nextTocRule, true)?.let { |
|
|
|
|
|
|
|
for (item in it) { |
|
|
|
|
|
|
|
if (item != baseUrl) { |
|
|
|
|
|
|
|
nextUrlList.add(item) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Debug.log( |
|
|
|
|
|
|
|
bookSource.bookSourceUrl, |
|
|
|
|
|
|
|
"└" + TextUtils.join(",\n", nextUrlList), |
|
|
|
|
|
|
|
log |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ChapterData(chapterList, nextUrlList) |
|
|
|
return ChapterData(chapterList, nextUrlList) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|