This commit is contained in:
alex 2024-01-16 15:56:30 +07:00
parent 7d49cd44a0
commit 11b4998d1d
9 changed files with 137 additions and 141 deletions

View file

@ -1,7 +1,7 @@
import org.jetbrains.kotlin.konan.properties.Properties
// use an integer for version numbers
version = 217
version = 218
android {
defaultConfig {

View file

@ -1275,7 +1275,7 @@ object SoraExtractor : SoraStream() {
val selector =
if (season == null) "p a:contains(V-Cloud)" else "h4:matches(0?$episode) + p a:contains(V-Cloud)"
val server = app.get(
href ?: return@apmap, interceptor = wpredisInterceptor
href ?: return@apmap, interceptor = wpRedisInterceptor
).document.selectFirst("div.entry-content > $selector")
?.attr("href") ?: return@apmap
@ -1717,13 +1717,13 @@ object SoraExtractor : SoraStream() {
"$url&apikey=whXgvN4kVyoubGwqXpw26Oy3PVryl8dm",
referer = "https://watcha.movie/"
).text
val link = Regex("\"file\":\"(http.*?)\"").find(res)?.groupValues?.getOrNull(1) ?: return
val link = Regex("\"file\":\"(http.*?)\"").find(res)?.groupValues?.getOrNull(1)
callback.invoke(
ExtractorLink(
"RStream",
"RStream",
link,
link ?: return,
"$rStreamAPI/",
Qualities.P1080.value,
INFER_TYPE
@ -2053,7 +2053,7 @@ object SoraExtractor : SoraStream() {
"$dahmerMoviesAPI/tvs/${title?.replace(":", " -")}/Season $season/"
}
val request = app.get(url, timeout = 120L)
val request = app.get(url, interceptor = TimeOutInterceptor())
if (!request.isSuccessful) return
val paths = request.document.select("a").map {
it.text() to it.attr("href")
@ -2382,12 +2382,18 @@ object SoraExtractor : SoraStream() {
callback: (ExtractorLink) -> Unit,
referer: String = "https://bflix.gs/"
) {
suspend fun String.isSuccess() : Boolean {
return app.get(this, referer = referer).isSuccessful
}
val slug = getEpisodeSlug(season, episode)
var url =
if (season == null) "$nowTvAPI/$tmdbId.mp4" else "$nowTvAPI/tv/$tmdbId/s${season}e${slug.second}.mp4"
if (!app.get(url, referer = referer).isSuccessful) {
url =
if (season == null) "$nowTvAPI/$imdbId.mp4" else "$nowTvAPI/tv/$imdbId/s${season}e${slug.second}.mp4"
var url = if (season == null) "$nowTvAPI/$tmdbId.mp4" else "$nowTvAPI/tv/$tmdbId/s${season}e${slug.second}.mp4"
if (!url.isSuccess()) {
url = if (season == null) {
val temp = "$nowTvAPI/$imdbId.mp4"
if (temp.isSuccess()) temp else "$nowTvAPI/$tmdbId-1.mp4"
} else {
"$nowTvAPI/tv/$imdbId/s${season}e${slug.second}.mp4"
}
if (!app.get(url, referer = referer).isSuccessful) return
}
callback.invoke(

View file

@ -68,7 +68,7 @@ open class SoraStream : TmdbProvider() {
TvType.Anime,
)
val wpredisInterceptor by lazy { CloudflareKiller() }
val wpRedisInterceptor by lazy { CloudflareKiller() }
val multiInterceptor by lazy { CloudflareKiller() }
/** AUTHOR : Hexated & Sora */
@ -250,8 +250,7 @@ open class SoraStream : TmdbProvider() {
val recommendations =
res.recommendations?.results?.mapNotNull { media -> media.toSearchResponse() }
val trailer =
res.videos?.results?.map { "https://www.youtube.com/watch?v=${it.key}" }?.randomOrNull()
val trailer = res.videos?.results?.map { "https://www.youtube.com/watch?v=${it.key}" }
return if (type == TvType.TvSeries) {
val lastSeason = res.last_episode_to_air?.season_number

View file

@ -23,6 +23,7 @@ import com.lagradost.nicehttp.requestCreator
import kotlinx.coroutines.delay
import okhttp3.FormBody
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.Interceptor
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.OkHttpClient
import okhttp3.Request
@ -1285,23 +1286,17 @@ private enum class Symbol(val decimalValue: Int) {
}
}
suspend fun request(
url: String,
allowRedirects: Boolean = true,
timeout: Long = 60L
): Response {
val client = OkHttpClient().newBuilder()
.connectTimeout(timeout, TimeUnit.SECONDS)
.readTimeout(timeout, TimeUnit.SECONDS)
.writeTimeout(timeout, TimeUnit.SECONDS)
.followRedirects(allowRedirects)
.followSslRedirects(allowRedirects)
.build()
val request: Request = Request.Builder()
.url(url)
.build()
return client.newCall(request).await()
class TimeOutInterceptor : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
val call = chain
.withConnectTimeout(60, TimeUnit.SECONDS)
.withReadTimeout(60, TimeUnit.SECONDS)
.withWriteTimeout(60, TimeUnit.SECONDS)
.request()
.newBuilder()
.build()
return chain.proceed(call)
}
}
// steal from https://github.com/aniyomiorg/aniyomi-extensions/blob/master/src/en/aniwave/src/eu/kanade/tachiyomi/animeextension/en/nineanime/AniwaveUtils.kt