TempleScan(esp): Fix pages not found (#3484)

js redirect
This commit is contained in:
bapeey 2024-06-09 07:31:31 -05:00 committed by GitHub
parent 5db62c7513
commit 5914fe3ea2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 6 deletions

View File

@ -3,7 +3,7 @@ ext {
extClass = '.TempleScanEsp'
themePkg = 'mangaesp'
baseUrl = 'https://templescanesp.net'
overrideVersionCode = 34
overrideVersionCode = 35
isNsfw = true
}

View File

@ -1,15 +1,31 @@
package eu.kanade.tachiyomi.extension.es.templescanesp
import eu.kanade.tachiyomi.multisrc.mangaesp.MangaEsp
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.FormBody
import okhttp3.Response
class TempleScanEsp : MangaEsp("Temple Scan", "https://templescanesp.net", "es") {
// Site moved from custom theme to MangaEsp
override val versionId = 3
private val readerUrl = "https://templescanesp.xyz"
override fun pageListRequest(chapter: SChapter) = GET(readerUrl + chapter.url, headers)
override fun pageListParse(response: Response): List<Page> {
var doc = response.asJsoup()
val form = doc.selectFirst("body > form[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.read img, main > img[src]").mapIndexed { i, element ->
Page(i, imageUrl = element.attr("abs:src"))
}
}
}