|
|
@ -138,12 +138,12 @@ object BookHelp { |
|
|
|
try { |
|
|
|
try { |
|
|
|
var bytes = analyzeUrl.getByteArrayAwait() |
|
|
|
var bytes = analyzeUrl.getByteArrayAwait() |
|
|
|
//某些图片被加密,需要进一步解密 |
|
|
|
//某些图片被加密,需要进一步解密 |
|
|
|
bookSource?.getContentRule()?.imageDecode?.let { |
|
|
|
bookSource?.getContentRule()?.imageDecode?.let { imageDecode -> |
|
|
|
if (it.isBlank()) { |
|
|
|
if (imageDecode.isBlank()) { |
|
|
|
return@let |
|
|
|
return@let |
|
|
|
} |
|
|
|
} |
|
|
|
kotlin.runCatching { |
|
|
|
kotlin.runCatching { |
|
|
|
bookSource.evalJS(it) { |
|
|
|
bookSource.evalJS(imageDecode) { |
|
|
|
put("book", book) |
|
|
|
put("book", book) |
|
|
|
put("result", bytes) |
|
|
|
put("result", bytes) |
|
|
|
put("src", src) |
|
|
|
put("src", src) |
|
|
@ -155,11 +155,11 @@ object BookHelp { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
FileUtils.createFileIfNotExist( |
|
|
|
FileUtils.createFileIfNotExist( |
|
|
|
downloadDir, |
|
|
|
downloadDir, |
|
|
|
cacheFolderName, |
|
|
|
cacheFolderName, |
|
|
|
book.getFolderName(), |
|
|
|
book.getFolderName(), |
|
|
|
cacheImageFolderName, |
|
|
|
cacheImageFolderName, |
|
|
|
"${MD5Utils.md5Encode16(src)}.${getImageSuffix(src)}" |
|
|
|
"${MD5Utils.md5Encode16(src)}.${getImageSuffix(src)}" |
|
|
|
).writeBytes(bytes) |
|
|
|
).writeBytes(bytes) |
|
|
|
} catch (e: Exception) { |
|
|
|
} catch (e: Exception) { |
|
|
|
AppLog.putDebug("${src}下载错误", e) |
|
|
|
AppLog.putDebug("${src}下载错误", e) |
|
|
@ -323,7 +323,7 @@ object BookHelp { |
|
|
|
newChapterList: List<BookChapter>, |
|
|
|
newChapterList: List<BookChapter>, |
|
|
|
oldChapterListSize: Int = 0 |
|
|
|
oldChapterListSize: Int = 0 |
|
|
|
): Int { |
|
|
|
): Int { |
|
|
|
if (oldDurChapterIndex == 0) return oldDurChapterIndex |
|
|
|
if (oldDurChapterIndex == 0) return 0 |
|
|
|
if (newChapterList.isEmpty()) return oldDurChapterIndex |
|
|
|
if (newChapterList.isEmpty()) return oldDurChapterIndex |
|
|
|
val oldChapterNum = getChapterNum(oldDurChapterName) |
|
|
|
val oldChapterNum = getChapterNum(oldDurChapterName) |
|
|
|
val oldName = getPureChapterName(oldDurChapterName) |
|
|
|
val oldName = getPureChapterName(oldDurChapterName) |
|
|
@ -370,6 +370,7 @@ object BookHelp { |
|
|
|
Pattern.compile(".*?第([\\d零〇一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+)[章节篇回集话]") |
|
|
|
Pattern.compile(".*?第([\\d零〇一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+)[章节篇回集话]") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Suppress("RegExpSimplifiable") |
|
|
|
private val chapterNamePattern2 by lazy { |
|
|
|
private val chapterNamePattern2 by lazy { |
|
|
|
Pattern.compile("^(?:[\\d零〇一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+[,:、])*([\\d零〇一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+)(?:[,:、]|\\.[^\\d])") |
|
|
|
Pattern.compile("^(?:[\\d零〇一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+[,:、])*([\\d零〇一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+)(?:[,:、]|\\.[^\\d])") |
|
|
|
} |
|
|
|
} |
|
|
@ -397,7 +398,7 @@ object BookHelp { |
|
|
|
return@lazy "[^\\w\\u4E00-\\u9FEF〇\\u3400-\\u4DBF\\u20000-\\u2A6DF\\u2A700-\\u2EBEF]".toRegex() |
|
|
|
return@lazy "[^\\w\\u4E00-\\u9FEF〇\\u3400-\\u4DBF\\u20000-\\u2A6DF\\u2A700-\\u2EBEF]".toRegex() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Suppress("RegExpUnnecessaryNonCapturingGroup") |
|
|
|
@Suppress("RegExpUnnecessaryNonCapturingGroup", "RegExpSimplifiable") |
|
|
|
private val regexB by lazy { |
|
|
|
private val regexB by lazy { |
|
|
|
//章节序号,排除处于结尾的状况,避免将章节名替换为空字串 |
|
|
|
//章节序号,排除处于结尾的状况,避免将章节名替换为空字串 |
|
|
|
return@lazy "^.*?第(?:[\\d零〇一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+)[章节篇回集话](?!$)|^(?:[\\d零〇一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+[,:、])*(?:[\\d零〇一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+)(?:[,:、](?!$)|\\.(?=[^\\d]))".toRegex() |
|
|
|
return@lazy "^.*?第(?:[\\d零〇一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+)[章节篇回集话](?!$)|^(?:[\\d零〇一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+[,:、])*(?:[\\d零〇一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+)(?:[,:、](?!$)|\\.(?=[^\\d]))".toRegex() |
|
|
|