RavenManga: Fix pages not found (#3439)

js redirect
This commit is contained in:
bapeey 2024-06-06 01:39:59 -05:00 committed by GitHub
parent 3b03c2ebf2
commit 087cbfbb1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 3 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'RavenManga' extName = 'RavenManga'
extClass = '.RavenManga' extClass = '.RavenManga'
extVersionCode = 2 extVersionCode = 3
isNsfw = false isNsfw = false
} }

View File

@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.extension.es.ravenmanga package eu.kanade.tachiyomi.extension.es.ravenmanga
import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.network.interceptor.rateLimitHost import eu.kanade.tachiyomi.network.interceptor.rateLimitHost
import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.Filter
import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.FilterList
@ -14,6 +15,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.decodeFromString import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import okhttp3.FormBody
import okhttp3.Headers import okhttp3.Headers
import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
@ -135,8 +137,19 @@ class RavenManga : ParsedHttpSource() {
} }
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
return document.select("main.contenedor-imagen > section img[src]").mapIndexed { i, element -> var doc = document
Page(i, "", element.attr("abs:src")) val form = doc.selectFirst("form#redirectForm[method=post]")
if (form != null) {
val url = form.attr("action")
val headers = headersBuilder().set("Referer", doc.location()).build()
val body = FormBody.Builder()
form.select("input").forEach {
body.add(it.attr("name"), it.attr("value"))
}
doc = client.newCall(POST(url, headers, body.build())).execute().asJsoup()
}
return doc.select("main.contenedor-imagen > section img[src], main > img[src]").mapIndexed { i, element ->
Page(i, imageUrl = element.attr("abs:src"))
} }
} }