anime4up fix video extractor (#255)

* Update build.gradle

* Update Anime4Up.kt
This commit is contained in:
Ahmed gamal
2022-01-23 17:31:58 +02:00
committed by GitHub
parent a3b576a750
commit 07fae038ed
2 changed files with 21 additions and 2 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Anime4up'
pkgNameSuffix = 'ar.anime4up'
extClass = '.Anime4Up'
extVersionCode = 22
extVersionCode = 23
libVersion = '12'
}

View File

@ -12,7 +12,9 @@ import eu.kanade.tachiyomi.animesource.model.SEpisode
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.animesource.online.ParsedAnimeHttpSource
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.FormBody
import okhttp3.Headers
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.OkHttpClient
@ -88,9 +90,26 @@ class Anime4Up : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
override fun videoListParse(response: Response): List<Video> {
val document = response.asJsoup()
val iframe = document.selectFirst("iframe").attr("src")
// get POST valus
val postUrl = document.select("form[method=post]").attr("action")
val ur = document.select("input[name=ur]").attr("value")
val wl = document.select("input[name=wl]").attr("value")
val dl = document.select("input[name=dl]").attr("value")
val moshahda = document.select("input[name=moshahda]").attr("value")
val submit = document.select("input[name=submit]").attr("value")
// POST data
val body = FormBody.Builder()
.add("ur", "$ur")
.add("wl", "$wl")
.add("dl", "$dl")
.add("moshahda", "$moshahda")
.add("submit", "$submit")
.build()
// Call POST
val referer = response.request.url.encodedPath
val newHeaders = Headers.headersOf("referer", baseUrl + referer)
val ifram1 = client.newCall(POST(postUrl, newHeaders, body)).execute().asJsoup()
val iframe = ifram1.select("li.active").attr("data-server")
val iframeResponse = client.newCall(GET(iframe, newHeaders))
.execute().asJsoup()
return videosFromElement(iframeResponse.selectFirst(videoListSelector()))