Skip to content

Commit

Permalink
fix previous fix, whoops
Browse files Browse the repository at this point in the history
  • Loading branch information
az4521 committed Dec 7, 2024
1 parent 3278e2f commit b3a8d2c
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,10 @@ class NHentai(context: Context) : HttpSource(), LewdSource<NHentaiSearchMetadata
metadata: NHentaiSearchMetadata,
input: Response
) {
val server = MEDIA_SERVER_REGEX.find(input.body.string())?.groupValues?.get(1)?.toInt() ?: 1
val strdata = input.body.string()
val server = MEDIA_SERVER_REGEX.find(strdata)?.groupValues?.get(1)?.toInt() ?: 1
val json =
GALLERY_JSON_REGEX.find(input.body.string())!!.groupValues[1].replace(UNICODE_ESCAPE_REGEX) {
GALLERY_JSON_REGEX.find(strdata)!!.groupValues[1].replace(UNICODE_ESCAPE_REGEX) {
it.groupValues[1].toInt(
radix = 16
).toChar().toString()
Expand Down Expand Up @@ -356,7 +357,7 @@ class NHentai(context: Context) : HttpSource(), LewdSource<NHentaiSearchMetadata

companion object {
private val GALLERY_JSON_REGEX = Regex(".parse\\(\"(.*)\"\\);")
private val MEDIA_SERVER_REGEX = Regex("media_server:\\s*(\\d+),")
private val MEDIA_SERVER_REGEX = Regex("media_server\\s*:\\s*(\\d+)")
private val UNICODE_ESCAPE_REGEX = Regex("\\\\u([0-9a-fA-F]{4})")
private const val REVERSE_PARAM = "TEH_REVERSE"

Expand Down

0 comments on commit b3a8d2c

Please sign in to comment.