Kumanga - fix token (#4077)

This commit is contained in:
Mike 2020-08-10 20:35:52 -04:00 committed by GitHub
parent 7865e6a42e
commit 90308cf7b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Kumanga'
pkgNameSuffix = 'es.kumanga'
extClass = '.Kumanga'
extVersionCode = 4
extVersionCode = 5
libVersion = '1.2'
}

View File

@ -61,10 +61,13 @@ class Kumanga : HttpSource() {
.build()
private var kumangaToken = ""
private val tokenRegex = Regex(""""([^"\s]{100,})"""")
private fun getKumangaToken() {
kumangaToken = client.newCall(GET("$baseUrl/mangalist?&page=1", headers)).execute().asJsoup()
.select("div.input-group [type=hidden]").firstOrNull()?.outerHtml()?.substringBeforeLast("\"")?.substringAfterLast("\"")
.select("div.input-group [type=hidden]")
.firstOrNull()
?.let { tokenRegex.find(it.outerHtml())?.groupValues?.get(1) }
?: throw IOException("No fue posible obtener la lista de mangas")
}