From 737a141bad4fd821b9bd36aa0217f8fb5459a1eb Mon Sep 17 00:00:00 2001 From: Nguyen Ngoc Duy Bao <57582539+FoxeiZ@users.noreply.github.com> Date: Fri, 6 Dec 2024 03:46:50 +0700 Subject: [PATCH] Nhentai | Fixed NPE in regex parser (#6389) * Improve dataRegex * Bump versionCode * Use a more greedy regex * Remove debug logging * Remove unused import --- src/all/nhentai/build.gradle | 2 +- .../src/eu/kanade/tachiyomi/extension/all/nhentai/NHentai.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/all/nhentai/build.gradle b/src/all/nhentai/build.gradle index 79740fc5b..7d43d3c2d 100644 --- a/src/all/nhentai/build.gradle +++ b/src/all/nhentai/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'NHentai' extClass = '.NHFactory' - extVersionCode = 49 + extVersionCode = 50 isNsfw = true } diff --git a/src/all/nhentai/src/eu/kanade/tachiyomi/extension/all/nhentai/NHentai.kt b/src/all/nhentai/src/eu/kanade/tachiyomi/extension/all/nhentai/NHentai.kt index f3a50c78d..2784f7e17 100644 --- a/src/all/nhentai/src/eu/kanade/tachiyomi/extension/all/nhentai/NHentai.kt +++ b/src/all/nhentai/src/eu/kanade/tachiyomi/extension/all/nhentai/NHentai.kt @@ -74,7 +74,7 @@ open class NHentai( } private val shortenTitleRegex = Regex("""(\[[^]]*]|[({][^)}]*[)}])""") - private val dataRegex = Regex("""JSON.parse\("([^*]*)"\)""") + private val dataRegex = Regex("""JSON\.parse\(\s*"(.*)"\s*\)""") private val hentaiSelector = "script:containsData(JSON.parse):not(:containsData(media_server))" private fun String.shortenTitle() = this.replace(shortenTitleRegex, "").trim()