forked from recloudstream/cloudstream
		
	fixed 2embed
This commit is contained in:
		
							parent
							
								
									eb36315b04
								
							
						
					
					
						commit
						8d14046c4a
					
				
					 3 changed files with 33 additions and 12 deletions
				
			
		|  | @ -18,6 +18,7 @@ import com.lagradost.cloudstream3.utils.M3u8Helper | ||||||
| import com.lagradost.cloudstream3.utils.getQualityFromName | import com.lagradost.cloudstream3.utils.getQualityFromName | ||||||
| import com.lagradost.nicehttp.NiceResponse | import com.lagradost.nicehttp.NiceResponse | ||||||
| import kotlinx.coroutines.delay | import kotlinx.coroutines.delay | ||||||
|  | import okhttp3.RequestBody.Companion.toRequestBody | ||||||
| import org.jsoup.Jsoup | import org.jsoup.Jsoup | ||||||
| import org.jsoup.nodes.Element | import org.jsoup.nodes.Element | ||||||
| import java.net.URI | import java.net.URI | ||||||
|  | @ -478,7 +479,8 @@ open class SflixProvider : MainAPI() { | ||||||
|             val data = negotiateNewSid(extractorData) ?: return null to null |             val data = negotiateNewSid(extractorData) ?: return null to null | ||||||
|             app.post( |             app.post( | ||||||
|                 "$extractorData&t=${generateTimeStamp()}&sid=${data.sid}", |                 "$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. |             // This makes the second get request work, and re-connect work. | ||||||
|  | @ -634,9 +636,9 @@ open class SflixProvider : MainAPI() { | ||||||
|             subtitleCallback: (SubtitleFile) -> Unit, |             subtitleCallback: (SubtitleFile) -> Unit, | ||||||
|             callback: (ExtractorLink) -> Unit, |             callback: (ExtractorLink) -> Unit, | ||||||
|             /** Used for extractorLink name, input: Source name */ |             /** Used for extractorLink name, input: Source name */ | ||||||
|             extractorData: String? = null, |             extractorData: String, | ||||||
|             nameTransformer: (String) -> String |             nameTransformer: (String) -> String | ||||||
|         ) { |         ) = suspendSafeApiCall { | ||||||
|             // https://rapid-cloud.ru/embed-6/dcPOVRE57YOT?z= -> https://rapid-cloud.ru/embed-6 |             // https://rapid-cloud.ru/embed-6/dcPOVRE57YOT?z= -> https://rapid-cloud.ru/embed-6 | ||||||
|             val mainIframeUrl = |             val mainIframeUrl = | ||||||
|                 url.substringBeforeLast("/") |                 url.substringBeforeLast("/") | ||||||
|  | @ -652,10 +654,10 @@ open class SflixProvider : MainAPI() { | ||||||
| 
 | 
 | ||||||
|             var sid: String? = null |             var sid: String? = null | ||||||
| 
 | 
 | ||||||
|             extractorData?.let { negotiateNewSid(it) }?.also { |             negotiateNewSid(extractorData)?.also { | ||||||
|                 app.post( |                 app.post( | ||||||
|                     "$extractorData&t=${generateTimeStamp()}&sid=${it.sid}", |                     "$extractorData&t=${generateTimeStamp()}&sid=${it.sid}", | ||||||
|                     json = "40", |                     requestBody = "40".toRequestBody(), | ||||||
|                     timeout = 60 |                     timeout = 60 | ||||||
|                 ) |                 ) | ||||||
|                 val text = app.get( |                 val text = app.get( | ||||||
|  | @ -673,7 +675,7 @@ open class SflixProvider : MainAPI() { | ||||||
|                         "/embed", |                         "/embed", | ||||||
|                         "/ajax/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, |                 referer = mainUrl, | ||||||
|                 headers = mapOf( |                 headers = mapOf( | ||||||
|                     "X-Requested-With" to "XMLHttpRequest", |                     "X-Requested-With" to "XMLHttpRequest", | ||||||
|  |  | ||||||
|  | @ -1,11 +1,13 @@ | ||||||
| package com.lagradost.cloudstream3.movieproviders | package com.lagradost.cloudstream3.movieproviders | ||||||
| 
 | 
 | ||||||
|  | import android.util.Log | ||||||
| import com.fasterxml.jackson.annotation.JsonProperty | import com.fasterxml.jackson.annotation.JsonProperty | ||||||
| import com.lagradost.cloudstream3.* | import com.lagradost.cloudstream3.* | ||||||
| import com.lagradost.cloudstream3.APIHolder.getCaptchaToken | import com.lagradost.cloudstream3.APIHolder.getCaptchaToken | ||||||
| import com.lagradost.cloudstream3.metaproviders.TmdbLink | import com.lagradost.cloudstream3.metaproviders.TmdbLink | ||||||
| import com.lagradost.cloudstream3.metaproviders.TmdbProvider | import com.lagradost.cloudstream3.metaproviders.TmdbProvider | ||||||
| import com.lagradost.cloudstream3.movieproviders.SflixProvider.Companion.extractRabbitStream | 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.AppUtils.parseJson | ||||||
| import com.lagradost.cloudstream3.utils.ExtractorLink | import com.lagradost.cloudstream3.utils.ExtractorLink | ||||||
| import com.lagradost.cloudstream3.utils.loadExtractor | import com.lagradost.cloudstream3.utils.loadExtractor | ||||||
|  | @ -42,11 +44,11 @@ class TwoEmbedProvider : TmdbProvider() { | ||||||
|         val isMovie = mappedData.episode == null && mappedData.season == null |         val isMovie = mappedData.episode == null && mappedData.season == null | ||||||
|         val embedUrl = if (isMovie) { |         val embedUrl = if (isMovie) { | ||||||
|             "$mainUrl/embed/$site/movie?id=$id" |             "$mainUrl/embed/$site/movie?id=$id" | ||||||
| 
 |  | ||||||
|         } else { |         } else { | ||||||
|             val suffix = "$id&s=${mappedData.season ?: 1}&e=${mappedData.episode ?: 1}" |             val suffix = "$id&s=${mappedData.season ?: 1}&e=${mappedData.episode ?: 1}" | ||||||
|             "$mainUrl/embed/$site/tv?id=$suffix" |             "$mainUrl/embed/$site/tv?id=$suffix" | ||||||
|         } |         } | ||||||
|  | 
 | ||||||
|         val document = app.get(embedUrl).document |         val document = app.get(embedUrl).document | ||||||
|         val captchaKey = |         val captchaKey = | ||||||
|             document.select("script[src*=https://www.google.com/recaptcha/api.js?render=]") |             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 mappedservers = parseJson<EmbedJson>(ajax) | ||||||
|             val iframeLink = mappedservers.link |             val iframeLink = mappedservers.link | ||||||
|             if (iframeLink.contains("rabbitstream")) { |             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 { |             } else { | ||||||
|                 loadExtractor(iframeLink, embedUrl, callback) |                 loadExtractor(iframeLink, embedUrl, callback) | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         return true |         return true | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     override suspend fun extractorVerifierJob(extractorData: String?) { | ||||||
|  |         Log.d(this.name, "Starting ${this.name} job!") | ||||||
|  |         runSflixExtractorVerifierJob(this, extractorData, "https://rabbitstream.net/") | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | @ -429,7 +429,9 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio | ||||||
|                 }) |                 }) | ||||||
| 
 | 
 | ||||||
|                 if (currentLinks.isEmpty()) { |                 if (currentLinks.isEmpty()) { | ||||||
|                     showToast(activity, R.string.no_links_found_toast, Toast.LENGTH_SHORT) |                     main { | ||||||
|  |                         showToast(activity, R.string.no_links_found_toast, Toast.LENGTH_SHORT) | ||||||
|  |                     } | ||||||
|                     return@safeApiCall |                     return@safeApiCall | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|  | @ -1515,8 +1517,13 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|                 START_ACTION_LOAD_EP -> { |                 START_ACTION_LOAD_EP -> { | ||||||
|                     if(episodeList.size == 1) { |                     if (episodeList.size == 1) { | ||||||
|                         handleAction(EpisodeClickEvent(ACTION_PLAY_EPISODE_IN_PLAYER, episodeList.first())) |                         handleAction( | ||||||
|  |                             EpisodeClickEvent( | ||||||
|  |                                 ACTION_PLAY_EPISODE_IN_PLAYER, | ||||||
|  |                                 episodeList.first() | ||||||
|  |                             ) | ||||||
|  |                         ) | ||||||
|                     } else { |                     } else { | ||||||
|                         var found = false |                         var found = false | ||||||
|                         for (ep in episodeList) { |                         for (ep in episodeList) { | ||||||
|  | @ -1531,7 +1538,12 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio | ||||||
|                             for (ep in episodeList) { |                             for (ep in episodeList) { | ||||||
|                                 if (ep.episode == resumeEpisode && ep.season == resumeSeason) { |                                 if (ep.episode == resumeEpisode && ep.season == resumeSeason) { | ||||||
|                                     println("WATCH STATUS::: START_ACTION_LOAD_EP S${ep.season} E ${ep.episode} - ${ep.getWatchProgress()}") |                                     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 |                                     break | ||||||
|                                 } |                                 } | ||||||
|                             } |                             } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue