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,22 +270,26 @@ 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)
(1..2).forEach { _ -> run lit@{
val document = res.document (1..2).forEach { _ ->
val nextUrl = document.select("form").attr("action") if (res.headers["location"] != null) return@lit
val data = document.select("form input").mapNotNull { val document = res.document
it.attr("name") to it.attr("value") val nextUrl = document.select("form").attr("action")
}.toMap().toMutableMap() val data = document.select("form input").mapNotNull {
val captchaKey = document.select("script[src*=https://www.google.com/recaptcha/api.js?render=]") it.attr("name") to it.attr("value")
.attr("src").substringAfter("render=") }.toMap().toMutableMap()
val token = APIHolder.getCaptchaToken(url, captchaKey) val captchaKey =
data["x-token"] = token ?: "" document.select("script[src*=https://www.google.com/recaptcha/api.js?render=]")
res = session.post( .attr("src").substringAfter("render=")
nextUrl, val token = getCaptchaToken(url, captchaKey)
data = data, data["x-token"] = token ?: ""
headers = mapOf("content-type" to "application/x-www-form-urlencoded"), res = session.post(
allowRedirects = false nextUrl,
) data = data,
headers = mapOf("content-type" to "application/x-www-form-urlencoded"),
allowRedirects = false
)
}
} }
return res.headers["location"] return res.headers["location"]