mirror of
https://github.com/keiyoushi/extensions-source.git
synced 2024-11-25 03:33:24 +01:00
Manhastro: fix chapter images (#1363)
* Manhastro: fix chapter images * Update src/pt/manhastro/src/eu/kanade/tachiyomi/extension/pt/manhastro/Manhastro.kt Co-authored-by: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com> --------- Co-authored-by: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com>
This commit is contained in:
parent
0972648a4a
commit
f22f245d9a
@ -3,7 +3,8 @@ ext {
|
||||
extClass = '.Manhastro'
|
||||
themePkg = 'madara'
|
||||
baseUrl = 'https://manhastro.com'
|
||||
overrideVersionCode = 0
|
||||
overrideVersionCode = 1
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
@ -1,8 +1,12 @@
|
||||
package eu.kanade.tachiyomi.extension.pt.manhastro
|
||||
|
||||
import android.util.Base64
|
||||
import eu.kanade.tachiyomi.multisrc.madara.Madara
|
||||
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
||||
import eu.kanade.tachiyomi.source.model.Page
|
||||
import kotlinx.serialization.decodeFromString
|
||||
import okhttp3.OkHttpClient
|
||||
import org.jsoup.nodes.Document
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.TimeUnit
|
||||
@ -19,4 +23,16 @@ class Manhastro : Madara(
|
||||
.build()
|
||||
|
||||
override val useNewChapterEndpoint = true
|
||||
|
||||
override fun pageListParse(document: Document): List<Page> {
|
||||
return document.selectFirst("script:containsData(imageLinks)")?.data()
|
||||
?.let { imageLinksPattern.find(it)?.groups?.get(1)?.value }
|
||||
?.let { json.decodeFromString<List<String>>(it) }
|
||||
?.mapIndexed { i, imageUrlEncoded ->
|
||||
val imageUrl = String(Base64.decode(imageUrlEncoded, Base64.DEFAULT))
|
||||
Page(i, document.location(), imageUrl)
|
||||
} ?: emptyList()
|
||||
}
|
||||
|
||||
private val imageLinksPattern = """var\s+?imageLinks\s*?=\s*?(\[.*]);""".toRegex()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user