SpectralScan: Fix pages (#9658)
* Fix pages * Close the response. --------- Co-authored-by: stevenyomi <95685115+stevenyomi@users.noreply.github.com>
This commit is contained in:
parent
09bab2593b
commit
0a7189534e
@ -1,7 +1,7 @@
|
|||||||
ext {
|
ext {
|
||||||
extName = 'Spectral Scan'
|
extName = 'Spectral Scan'
|
||||||
extClass = '.SpectralScan'
|
extClass = '.SpectralScan'
|
||||||
extVersionCode = 47
|
extVersionCode = 48
|
||||||
isNsfw = false
|
isNsfw = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,12 +7,8 @@ import eu.kanade.tachiyomi.source.model.Page
|
|||||||
import eu.kanade.tachiyomi.source.model.SChapter
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||||
import keiyoushi.utils.parseAs
|
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
import okhttp3.MediaType.Companion.toMediaType
|
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.ResponseBody.Companion.toResponseBody
|
|
||||||
import okio.ByteString.Companion.decodeBase64
|
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
@ -32,28 +28,12 @@ class SpectralScan : ParsedHttpSource() {
|
|||||||
override val client = super.client.newBuilder()
|
override val client = super.client.newBuilder()
|
||||||
.rateLimit(2)
|
.rateLimit(2)
|
||||||
.addInterceptor { chain ->
|
.addInterceptor { chain ->
|
||||||
val request = chain.request()
|
chain.proceed(chain.request()).also {
|
||||||
val response = chain.proceed(request)
|
if (it.request.url.toString().contains("login")) {
|
||||||
val url = response.request.url
|
it.close()
|
||||||
|
throw IOException("Faça o login na WebView para acessar o contéudo")
|
||||||
if (url.toString().contains("login")) {
|
|
||||||
throw IOException("Faça o login na WebView para acessar o contéudo")
|
|
||||||
}
|
|
||||||
|
|
||||||
if (url.fragment.isNullOrBlank().not() && url.fragment!!.contains("page")) {
|
|
||||||
val dto = response.parseAs<ImageSrc>()
|
|
||||||
|
|
||||||
if (dto.isBase64().not()) {
|
|
||||||
response.close()
|
|
||||||
return@addInterceptor chain.proceed(GET(dto.url, headers))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val byteString = dto.base64.decodeBase64()!!
|
|
||||||
return@addInterceptor response.newBuilder()
|
|
||||||
.body(byteString.toResponseBody(dto.mimeType.toMediaType()))
|
|
||||||
.build()
|
|
||||||
}
|
}
|
||||||
response
|
|
||||||
}
|
}
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
@ -132,7 +112,7 @@ class SpectralScan : ParsedHttpSource() {
|
|||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
return document.select(".manga-page-container").mapIndexed { index, element ->
|
return document.select(".manga-page-container").mapIndexed { index, element ->
|
||||||
Page(index, imageUrl = "${element.absUrl("data-api-src")}#page")
|
Page(index, imageUrl = "${element.absUrl("data-image-src")}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user