parent
7b680f38a9
commit
ec769a8c82
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'HentaiNexus'
|
extName = 'HentaiNexus'
|
||||||
pkgNameSuffix = 'en.hentainexus'
|
pkgNameSuffix = 'en.hentainexus'
|
||||||
extClass = '.HentaiNexus'
|
extClass = '.HentaiNexus'
|
||||||
extVersionCode = 3
|
extVersionCode = 4
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
containsNsfw = true
|
containsNsfw = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,12 @@ import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import java.net.URLEncoder
|
import java.net.URLEncoder
|
||||||
|
import android.util.Base64
|
||||||
|
import kotlin.experimental.xor
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.google.gson.JsonElement
|
||||||
|
import com.google.gson.JsonObject
|
||||||
|
import com.google.gson.JsonParser
|
||||||
|
|
||||||
@Nsfw
|
@Nsfw
|
||||||
class HentaiNexus : ParsedHttpSource() {
|
class HentaiNexus : ParsedHttpSource() {
|
||||||
|
@ -194,13 +200,38 @@ class HentaiNexus : ParsedHttpSource() {
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
return document.select("script:containsData(initreader)").first().data()
|
return document.select("script:containsData(initreader)").first().data()
|
||||||
.substringAfter("[")
|
.substringAfter("initReader(\"")
|
||||||
.substringBefore("]")
|
.substringBefore("\", 1")
|
||||||
.replace(Regex("""["\\]"""), "")
|
.let(::decodePages)
|
||||||
.split(",")
|
|
||||||
.mapIndexed { i, image -> Page(i, "", image) }
|
.mapIndexed { i, image -> Page(i, "", image) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun decodePages(code: String): List<String> {
|
||||||
|
val hidden: ByteArray = Base64.decode(code, Base64.DEFAULT)
|
||||||
|
var key: ByteArray = hidden.sliceArray(0..63)
|
||||||
|
var body: ByteArray = hidden.sliceArray(64..hidden.size-1)
|
||||||
|
|
||||||
|
val buf = StringBuilder()
|
||||||
|
|
||||||
|
for (begin in 0 until body.size step 64) {
|
||||||
|
var chunk: ByteArray = body.sliceArray(begin..begin+63)
|
||||||
|
for (x in 0 until 64) {
|
||||||
|
buf.append((chunk[x] xor key[x]).toChar())
|
||||||
|
}
|
||||||
|
key = chunk
|
||||||
|
}
|
||||||
|
|
||||||
|
val json = JsonParser().parse(buf.toString()).asJsonObject
|
||||||
|
|
||||||
|
val base = json.get("b").asString
|
||||||
|
val folder = json.get("r").asString
|
||||||
|
val id = json.get("i").asString
|
||||||
|
return json.get("f").asJsonArray.map { it ->
|
||||||
|
val page = it.asJsonObject
|
||||||
|
"${base}${folder}${page.get("h").asString}/${id}/${page.get("p").asString}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
|
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
|
||||||
|
|
||||||
override fun getFilterList() = FilterList(
|
override fun getFilterList() = FilterList(
|
||||||
|
|
Loading…
Reference in New Issue