small fix AnimeKaizoku

This commit is contained in:
hexated 2023-01-11 19:42:59 +07:00
parent 22278bcd2d
commit 112982a39f
3 changed files with 26 additions and 19 deletions

View File

@ -1094,6 +1094,7 @@ object SoraExtractor : SoraStream() {
suspend fun invokeAnimes(
id: Int? = null,
title: String? = null,
epsTitle: String? = null,
year: Int? = null,
season: Int? = null,
episode: Int? = null,
@ -1116,7 +1117,7 @@ object SoraExtractor : SoraStream() {
invokeZoro(aniId, episode, subtitleCallback, callback)
},
{
invokeAnimeKaizoku(malId, season, episode, callback)
invokeAnimeKaizoku(malId, epsTitle, season, episode, callback)
}
)
}
@ -1166,6 +1167,7 @@ object SoraExtractor : SoraStream() {
private suspend fun invokeAnimeKaizoku(
malId: String? = null,
epsTitle: String? = null,
season: Int? = null,
episode: Int? = null,
callback: (ExtractorLink) -> Unit
@ -1202,7 +1204,7 @@ object SoraExtractor : SoraStream() {
if (season == null) list.firstOrNull() else list.find {
it.second.contains(
Regex("($eps\\.)|(-\\s$eps)")
)
) || it.second.contains("$epsTitle", true)
}
} ?: return@apmap null

View File

@ -355,7 +355,7 @@ open class SoraStream : TmdbProvider() {
// )
// },
{
if (res.isAnime) invokeAnimes(res.id, res.title, res.year, res.season, res.episode, subtitleCallback, callback)
if (res.isAnime) invokeAnimes(res.id, res.title, res.epsTitle, res.year, res.season, res.episode, subtitleCallback, callback)
},
{
if (res.season != null && res.isAnime) invokeCrunchyroll(

View File

@ -4,6 +4,7 @@ import com.hexated.SoraStream.Companion.filmxyAPI
import com.hexated.SoraStream.Companion.gdbot
import com.hexated.SoraStream.Companion.tvMoviesAPI
import com.lagradost.cloudstream3.APIHolder
import com.lagradost.cloudstream3.APIHolder.getCaptchaToken
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.base64Decode
import com.lagradost.cloudstream3.base64Encode
@ -269,22 +270,26 @@ fun getDirectGdrive(url: String): String {
suspend fun bypassOuo(url: String?) : String? {
var res = session.get(url ?: return null)
(1..2).forEach { _ ->
val document = res.document
val nextUrl = document.select("form").attr("action")
val data = document.select("form input").mapNotNull {
it.attr("name") to it.attr("value")
}.toMap().toMutableMap()
val captchaKey = document.select("script[src*=https://www.google.com/recaptcha/api.js?render=]")
.attr("src").substringAfter("render=")
val token = APIHolder.getCaptchaToken(url, captchaKey)
data["x-token"] = token ?: ""
res = session.post(
nextUrl,
data = data,
headers = mapOf("content-type" to "application/x-www-form-urlencoded"),
allowRedirects = false
)
run lit@{
(1..2).forEach { _ ->
if (res.headers["location"] != null) return@lit
val document = res.document
val nextUrl = document.select("form").attr("action")
val data = document.select("form input").mapNotNull {
it.attr("name") to it.attr("value")
}.toMap().toMutableMap()
val captchaKey =
document.select("script[src*=https://www.google.com/recaptcha/api.js?render=]")
.attr("src").substringAfter("render=")
val token = getCaptchaToken(url, captchaKey)
data["x-token"] = token ?: ""
res = session.post(
nextUrl,
data = data,
headers = mapOf("content-type" to "application/x-www-form-urlencoded"),
allowRedirects = false
)
}
}
return res.headers["location"]