Nhentai | Fixed NPE in regex parser (#6389)

* Improve dataRegex

* Bump versionCode

* Use a more greedy regex

* Remove debug logging

* Remove unused import
This commit is contained in:
Nguyen Ngoc Duy Bao 2024-12-06 03:46:50 +07:00 committed by Draff
parent 21aedafb7d
commit 737a141bad
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'NHentai' extName = 'NHentai'
extClass = '.NHFactory' extClass = '.NHFactory'
extVersionCode = 49 extVersionCode = 50
isNsfw = true isNsfw = true
} }

View File

@ -74,7 +74,7 @@ open class NHentai(
} }
private val shortenTitleRegex = Regex("""(\[[^]]*]|[({][^)}]*[)}])""") 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 val hentaiSelector = "script:containsData(JSON.parse):not(:containsData(media_server))"
private fun String.shortenTitle() = this.replace(shortenTitleRegex, "").trim() private fun String.shortenTitle() = this.replace(shortenTitleRegex, "").trim()