[Hentalk] Small fixes

master
Draken 1 year ago committed by GitHub
parent 826c948260
commit c294f5bb61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -257,13 +257,11 @@ internal class Hentalk(context: MangaLoaderContext) :
for (i in 0 until dataArray.length()) { for (i in 0 until dataArray.length()) {
val item = dataArray.opt(i) val item = dataArray.opt(i)
if (item is JSONObject && item.has("hash")) { if (item is JSONObject && item.has("hash")) {
if (i < 20) { // search in first 20 items if (i < 20) {
val hashValue = dataArray.getString(item.getInt("hash")) val hashValue = dataArray.getString(item.getInt("hash"))
if (hashValue.length == 8) { // hash is a key that has 8 chars if (hashValue.length == 8) {
compressID = hashValue compressID = hashValue
break break
} else {
throw ParseException("Can't find type ID in this chapter!", chapter.url)
} }
} }
} }
@ -284,16 +282,14 @@ internal class Hentalk(context: MangaLoaderContext) :
val item = dataArray.opt(i) val item = dataArray.opt(i)
if (item is JSONObject && item.has("gallery")) { if (item is JSONObject && item.has("gallery")) {
val galleryIndex = item.getInt("gallery") val galleryIndex = item.getInt("gallery")
val galleryTemp = dataArray.optJSONObject(galleryIndex) val galleryTemplate = dataArray.optJSONObject(galleryIndex)
if (galleryTemp != null && galleryTemp.has("hash")) { if (galleryTemplate != null && galleryTemplate.has("hash")) {
val hashIndex = galleryTemp.getInt("hash") val hashIndex = galleryTemplate.getInt("hash")
hashID = dataArray.getString(hashIndex) hashID = dataArray.getString(hashIndex)
break break
} }
} }
} }
} else {
throw ParseException("Can't find hash ID in this chapter!", chapter.url)
} }
val imgList = mutableListOf<String>() val imgList = mutableListOf<String>()
@ -306,8 +302,6 @@ internal class Hentalk(context: MangaLoaderContext) :
if (filename.isNotEmpty()) { if (filename.isNotEmpty()) {
imgList.add(filename) imgList.add(filename)
} }
} else {
throw ParseException("Can't find imageUrls in this chapter!", chapter.url)
} }
} }
} }

Loading…
Cancel
Save