parent
42ad92bbff
commit
4a148e2ca2
|
@ -5,12 +5,13 @@ ext {
|
|||
appName = 'Tachiyomi: Mangahub'
|
||||
pkgNameSuffix = 'ru.mangahub'
|
||||
extClass = '.Mangahub'
|
||||
extVersionCode = 7
|
||||
extVersionCode = 8
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':lib-ratelimit')
|
||||
compileOnly 'com.google.code.gson:gson:2.8.2'
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package eu.kanade.tachiyomi.extension.ru.mangahub
|
||||
|
||||
import com.google.gson.JsonParser
|
||||
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.source.model.FilterList
|
||||
|
@ -27,6 +28,8 @@ open class Mangahub : ParsedHttpSource() {
|
|||
|
||||
private val rateLimitInterceptor = RateLimitInterceptor(2)
|
||||
|
||||
private val jsonParser = JsonParser()
|
||||
|
||||
override val client: OkHttpClient = network.client.newBuilder()
|
||||
.addNetworkInterceptor(rateLimitInterceptor).build()
|
||||
|
||||
|
@ -111,11 +114,13 @@ open class Mangahub : ParsedHttpSource() {
|
|||
}
|
||||
|
||||
override fun pageListParse(document: Document): List<Page> {
|
||||
val pictures = document.select("div.row > div > div.mb-4").attr("data-js-scans").replace(""", "\"").replace("\\/", "/")
|
||||
val r = Regex("""\/\/([\w\.\/])+""")
|
||||
val chapInfo = document.select("reader").attr("data-reader-store").replace(""", "\"").replace("\\/", "/")
|
||||
val chapter = jsonParser.parse(chapInfo).asJsonObject
|
||||
val scans = chapter["scans"].asJsonArray
|
||||
|
||||
val pages = mutableListOf<Page>()
|
||||
for ((index, value) in r.findAll(pictures).withIndex()) {
|
||||
pages.add(Page(index = index, imageUrl = "https:${value.value}"))
|
||||
scans.mapIndexed { i, page ->
|
||||
pages.add(Page(i, "", "https:${page.asJsonObject.get("src").asString}"))
|
||||
}
|
||||
|
||||
return pages
|
||||
|
|
Loading…
Reference in New Issue