fixed 2embed

This commit is contained in:
Blatzar 2022-05-14 19:07:34 +02:00
parent eb36315b04
commit 8d14046c4a
3 changed files with 33 additions and 12 deletions

View file

@ -18,6 +18,7 @@ import com.lagradost.cloudstream3.utils.M3u8Helper
import com.lagradost.cloudstream3.utils.getQualityFromName
import com.lagradost.nicehttp.NiceResponse
import kotlinx.coroutines.delay
import okhttp3.RequestBody.Companion.toRequestBody
import org.jsoup.Jsoup
import org.jsoup.nodes.Element
import java.net.URI
@ -478,7 +479,8 @@ open class SflixProvider : MainAPI() {
val data = negotiateNewSid(extractorData) ?: return null to null
app.post(
"$extractorData&t=${generateTimeStamp()}&sid=${data.sid}",
json = "40", headers = headers
requestBody = "40".toRequestBody(),
headers = headers
)
// This makes the second get request work, and re-connect work.
@ -634,9 +636,9 @@ open class SflixProvider : MainAPI() {
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit,
/** Used for extractorLink name, input: Source name */
extractorData: String? = null,
extractorData: String,
nameTransformer: (String) -> String
) {
) = suspendSafeApiCall {
// https://rapid-cloud.ru/embed-6/dcPOVRE57YOT?z= -> https://rapid-cloud.ru/embed-6
val mainIframeUrl =
url.substringBeforeLast("/")
@ -652,10 +654,10 @@ open class SflixProvider : MainAPI() {
var sid: String? = null
extractorData?.let { negotiateNewSid(it) }?.also {
negotiateNewSid(extractorData)?.also {
app.post(
"$extractorData&t=${generateTimeStamp()}&sid=${it.sid}",
json = "40",
requestBody = "40".toRequestBody(),
timeout = 60
)
val text = app.get(
@ -673,7 +675,7 @@ open class SflixProvider : MainAPI() {
"/embed",
"/ajax/embed"
)
}/getSources?id=$mainIframeId&_token=$iframeToken&_number=$number${sid?.let { "&sid=$it" } ?: ""}",
}/getSources?id=$mainIframeId&_token=$iframeToken&_number=$number$&sId=${sid!!}",
referer = mainUrl,
headers = mapOf(
"X-Requested-With" to "XMLHttpRequest",

View file

@ -1,11 +1,13 @@
package com.lagradost.cloudstream3.movieproviders
import android.util.Log
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.APIHolder.getCaptchaToken
import com.lagradost.cloudstream3.metaproviders.TmdbLink
import com.lagradost.cloudstream3.metaproviders.TmdbProvider
import com.lagradost.cloudstream3.movieproviders.SflixProvider.Companion.extractRabbitStream
import com.lagradost.cloudstream3.movieproviders.SflixProvider.Companion.runSflixExtractorVerifierJob
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
@ -42,11 +44,11 @@ class TwoEmbedProvider : TmdbProvider() {
val isMovie = mappedData.episode == null && mappedData.season == null
val embedUrl = if (isMovie) {
"$mainUrl/embed/$site/movie?id=$id"
} else {
val suffix = "$id&s=${mappedData.season ?: 1}&e=${mappedData.episode ?: 1}"
"$mainUrl/embed/$site/tv?id=$suffix"
}
val document = app.get(embedUrl).document
val captchaKey =
document.select("script[src*=https://www.google.com/recaptcha/api.js?render=]")
@ -59,11 +61,16 @@ class TwoEmbedProvider : TmdbProvider() {
val mappedservers = parseJson<EmbedJson>(ajax)
val iframeLink = mappedservers.link
if (iframeLink.contains("rabbitstream")) {
extractRabbitStream(iframeLink, subtitleCallback, callback) { it }
extractRabbitStream(iframeLink, subtitleCallback, callback, "https://ws10.rabbitstream.net/socket.io/?EIO=4&transport=polling") { it }
} else {
loadExtractor(iframeLink, embedUrl, callback)
}
}
return true
}
override suspend fun extractorVerifierJob(extractorData: String?) {
Log.d(this.name, "Starting ${this.name} job!")
runSflixExtractorVerifierJob(this, extractorData, "https://rabbitstream.net/")
}
}

View file

@ -429,7 +429,9 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio
})
if (currentLinks.isEmpty()) {
main {
showToast(activity, R.string.no_links_found_toast, Toast.LENGTH_SHORT)
}
return@safeApiCall
}
@ -1516,7 +1518,12 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio
}
START_ACTION_LOAD_EP -> {
if (episodeList.size == 1) {
handleAction(EpisodeClickEvent(ACTION_PLAY_EPISODE_IN_PLAYER, episodeList.first()))
handleAction(
EpisodeClickEvent(
ACTION_PLAY_EPISODE_IN_PLAYER,
episodeList.first()
)
)
} else {
var found = false
for (ep in episodeList) {
@ -1531,7 +1538,12 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio
for (ep in episodeList) {
if (ep.episode == resumeEpisode && ep.season == resumeSeason) {
println("WATCH STATUS::: START_ACTION_LOAD_EP S${ep.season} E ${ep.episode} - ${ep.getWatchProgress()}")
handleAction(EpisodeClickEvent(ACTION_PLAY_EPISODE_IN_PLAYER, ep))
handleAction(
EpisodeClickEvent(
ACTION_PLAY_EPISODE_IN_PLAYER,
ep
)
)
break
}
}