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( suspend fun invokeAnimes(
id: Int? = null, id: Int? = null,
title: String? = null, title: String? = null,
epsTitle: String? = null,
year: Int? = null, year: Int? = null,
season: Int? = null, season: Int? = null,
episode: Int? = null, episode: Int? = null,
@ -1116,7 +1117,7 @@ object SoraExtractor : SoraStream() {
invokeZoro(aniId, episode, subtitleCallback, callback) 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( private suspend fun invokeAnimeKaizoku(
malId: String? = null, malId: String? = null,
epsTitle: String? = null,
season: Int? = null, season: Int? = null,
episode: Int? = null, episode: Int? = null,
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
@ -1202,7 +1204,7 @@ object SoraExtractor : SoraStream() {
if (season == null) list.firstOrNull() else list.find { if (season == null) list.firstOrNull() else list.find {
it.second.contains( it.second.contains(
Regex("($eps\\.)|(-\\s$eps)") Regex("($eps\\.)|(-\\s$eps)")
) ) || it.second.contains("$epsTitle", true)
} }
} ?: return@apmap null } ?: 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( 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.gdbot
import com.hexated.SoraStream.Companion.tvMoviesAPI import com.hexated.SoraStream.Companion.tvMoviesAPI
import com.lagradost.cloudstream3.APIHolder import com.lagradost.cloudstream3.APIHolder
import com.lagradost.cloudstream3.APIHolder.getCaptchaToken
import com.lagradost.cloudstream3.app import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.base64Decode import com.lagradost.cloudstream3.base64Decode
import com.lagradost.cloudstream3.base64Encode import com.lagradost.cloudstream3.base64Encode
@ -269,15 +270,18 @@ fun getDirectGdrive(url: String): String {
suspend fun bypassOuo(url: String?) : String? { suspend fun bypassOuo(url: String?) : String? {
var res = session.get(url ?: return null) var res = session.get(url ?: return null)
run lit@{
(1..2).forEach { _ -> (1..2).forEach { _ ->
if (res.headers["location"] != null) return@lit
val document = res.document val document = res.document
val nextUrl = document.select("form").attr("action") val nextUrl = document.select("form").attr("action")
val data = document.select("form input").mapNotNull { val data = document.select("form input").mapNotNull {
it.attr("name") to it.attr("value") it.attr("name") to it.attr("value")
}.toMap().toMutableMap() }.toMap().toMutableMap()
val captchaKey = document.select("script[src*=https://www.google.com/recaptcha/api.js?render=]") val captchaKey =
document.select("script[src*=https://www.google.com/recaptcha/api.js?render=]")
.attr("src").substringAfter("render=") .attr("src").substringAfter("render=")
val token = APIHolder.getCaptchaToken(url, captchaKey) val token = getCaptchaToken(url, captchaKey)
data["x-token"] = token ?: "" data["x-token"] = token ?: ""
res = session.post( res = session.post(
nextUrl, nextUrl,
@ -286,6 +290,7 @@ suspend fun bypassOuo(url: String?) : String? {
allowRedirects = false allowRedirects = false
) )
} }
}
return res.headers["location"] return res.headers["location"]
} }