Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from nift4/fix-batoto
Browse files Browse the repository at this point in the history
fix bato.to
  • Loading branch information
timschneeb authored Jan 7, 2024
2 parents 0ee1431 + ce4bb0a commit 59bf756
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/all/batoto/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ext {
extName = 'Bato.to'
pkgNameSuffix = 'all.batoto'
extClass = '.BatoToFactory'
extVersionCode = 32
extVersionCode = 33
isNsfw = true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,19 +457,19 @@ open class BatoTo(
}

override fun pageListParse(document: Document): List<Page> {
val script = document.selectFirst("script:containsData(imgHttpLis):containsData(batoWord):containsData(batoPass)")?.html()
val script = document.selectFirst("script:containsData(imgHttps):containsData(batoWord):containsData(batoPass)")?.html()
?: throw RuntimeException("Couldn't find script with image data.")

val imgHttpLisString = script.substringAfter("const imgHttpLis =").substringBefore(";").trim()
val imgHttpLis = json.parseToJsonElement(imgHttpLisString).jsonArray.map { it.jsonPrimitive.content }
val imgHttpsString = script.substringAfter("const imgHttps =").substringBefore(";").trim()
val imgHttps = json.parseToJsonElement(imgHttpsString).jsonArray.map { it.jsonPrimitive.content }
val batoWord = script.substringAfter("const batoWord =").substringBefore(";").trim()
val batoPass = script.substringAfter("const batoPass =").substringBefore(";").trim()

val evaluatedPass: String = Deobfuscator.deobfuscateJsPassword(batoPass)
val imgAccListString = CryptoAES.decrypt(batoWord.removeSurrounding("\""), evaluatedPass)
val imgAccList = json.parseToJsonElement(imgAccListString).jsonArray.map { it.jsonPrimitive.content }

return imgHttpLis.zip(imgAccList).mapIndexed { i, (imgUrl, imgAcc) ->
return imgHttps.zip(imgAccList).mapIndexed { i, (imgUrl, imgAcc) ->
Page(i, imageUrl = "$imgUrl?$imgAcc")
}
}
Expand Down

0 comments on commit 59bf756

Please sign in to comment.