Mangahub site update (#2878)

Mangahub site update
This commit is contained in:
Pavka 2020-04-27 21:44:40 +03:00 committed by GitHub
parent 42ad92bbff
commit 4a148e2ca2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -5,12 +5,13 @@ ext {
appName = 'Tachiyomi: Mangahub' appName = 'Tachiyomi: Mangahub'
pkgNameSuffix = 'ru.mangahub' pkgNameSuffix = 'ru.mangahub'
extClass = '.Mangahub' extClass = '.Mangahub'
extVersionCode = 7 extVersionCode = 8
libVersion = '1.2' libVersion = '1.2'
} }
dependencies { dependencies {
implementation project(':lib-ratelimit') implementation project(':lib-ratelimit')
compileOnly 'com.google.code.gson:gson:2.8.2'
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.extension.ru.mangahub package eu.kanade.tachiyomi.extension.ru.mangahub
import com.google.gson.JsonParser
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.FilterList
@ -27,6 +28,8 @@ open class Mangahub : ParsedHttpSource() {
private val rateLimitInterceptor = RateLimitInterceptor(2) private val rateLimitInterceptor = RateLimitInterceptor(2)
private val jsonParser = JsonParser()
override val client: OkHttpClient = network.client.newBuilder() override val client: OkHttpClient = network.client.newBuilder()
.addNetworkInterceptor(rateLimitInterceptor).build() .addNetworkInterceptor(rateLimitInterceptor).build()
@ -111,11 +114,13 @@ open class Mangahub : ParsedHttpSource() {
} }
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
val pictures = document.select("div.row > div > div.mb-4").attr("data-js-scans").replace("&quot;", "\"").replace("\\/", "/") val chapInfo = document.select("reader").attr("data-reader-store").replace("&quot;", "\"").replace("\\/", "/")
val r = Regex("""\/\/([\w\.\/])+""") val chapter = jsonParser.parse(chapInfo).asJsonObject
val scans = chapter["scans"].asJsonArray
val pages = mutableListOf<Page>() val pages = mutableListOf<Page>()
for ((index, value) in r.findAll(pictures).withIndex()) { scans.mapIndexed { i, page ->
pages.add(Page(index = index, imageUrl = "https:${value.value}")) pages.add(Page(i, "", "https:${page.asJsonObject.get("src").asString}"))
} }
return pages return pages