mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Extractor: new VidSrcTo extractor (#1044)
This commit is contained in:
parent
d3828eeafe
commit
c28a3cb987
4 changed files with 73 additions and 0 deletions
|
@ -0,0 +1,65 @@
|
||||||
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
|
import android.util.Base64
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
import com.lagradost.cloudstream3.SubtitleFile
|
||||||
|
import com.lagradost.cloudstream3.amap
|
||||||
|
import com.lagradost.cloudstream3.app
|
||||||
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
|
import java.net.URLDecoder
|
||||||
|
import javax.crypto.Cipher
|
||||||
|
import javax.crypto.spec.SecretKeySpec
|
||||||
|
|
||||||
|
class VidSrcTo : ExtractorApi() {
|
||||||
|
override val name = "VidSrcTo"
|
||||||
|
override val mainUrl = "https://vidsrc.to"
|
||||||
|
override val requiresReferer = true
|
||||||
|
|
||||||
|
override suspend fun getUrl(
|
||||||
|
url: String,
|
||||||
|
referer: String?,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit
|
||||||
|
) {
|
||||||
|
val mediaId = app.get(url).document.selectFirst("ul.episodes li a")?.attr("data-id") ?: return
|
||||||
|
val res = app.get("$mainUrl/ajax/embed/episode/$mediaId/sources").parsedSafe<VidsrctoEpisodeSources>() ?: return
|
||||||
|
if (res.status != 200) return
|
||||||
|
res.result?.amap { source ->
|
||||||
|
val embedRes = app.get("$mainUrl/ajax/embed/source/${source.id}").parsedSafe<VidsrctoEmbedSource>() ?: return@amap
|
||||||
|
val finalUrl = DecryptUrl(embedRes.result.encUrl)
|
||||||
|
if(finalUrl.equals(embedRes.result.encUrl)) return@amap
|
||||||
|
when (source.title) {
|
||||||
|
"Vidplay" -> AnyVidplay(finalUrl.substringBefore("/e/")).getUrl(finalUrl, referer, subtitleCallback, callback)
|
||||||
|
"Filemoon" -> FileMoon().getUrl(finalUrl, referer, subtitleCallback, callback)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun DecryptUrl(encUrl: String): String {
|
||||||
|
var data = encUrl.toByteArray()
|
||||||
|
data = Base64.decode(data, Base64.URL_SAFE)
|
||||||
|
val rc4Key = SecretKeySpec("WXrUARXb1aDLaZjI".toByteArray(), "RC4")
|
||||||
|
val cipher = Cipher.getInstance("RC4")
|
||||||
|
cipher.init(Cipher.DECRYPT_MODE, rc4Key, cipher.parameters)
|
||||||
|
data = cipher.doFinal(data)
|
||||||
|
return URLDecoder.decode(data.toString(Charsets.UTF_8), "utf-8")
|
||||||
|
}
|
||||||
|
|
||||||
|
data class VidsrctoEpisodeSources(
|
||||||
|
@JsonProperty("status") val status: Int,
|
||||||
|
@JsonProperty("result") val result: List<VidsrctoResult>?
|
||||||
|
)
|
||||||
|
|
||||||
|
data class VidsrctoResult(
|
||||||
|
@JsonProperty("id") val id: String,
|
||||||
|
@JsonProperty("title") val title: String
|
||||||
|
)
|
||||||
|
|
||||||
|
data class VidsrctoEmbedSource(
|
||||||
|
@JsonProperty("status") val status: Int,
|
||||||
|
@JsonProperty("result") val result: VidsrctoUrl
|
||||||
|
)
|
||||||
|
|
||||||
|
data class VidsrctoUrl(@JsonProperty("url") val encUrl: String)
|
||||||
|
}
|
|
@ -13,6 +13,10 @@ import javax.crypto.spec.SecretKeySpec
|
||||||
// Code found in https://github.com/KillerDogeEmpire/vidplay-keys
|
// Code found in https://github.com/KillerDogeEmpire/vidplay-keys
|
||||||
// special credits to @KillerDogeEmpire for providing key
|
// special credits to @KillerDogeEmpire for providing key
|
||||||
|
|
||||||
|
class AnyVidplay(hostUrl: String) : Vidplay() {
|
||||||
|
override val mainUrl = hostUrl
|
||||||
|
}
|
||||||
|
|
||||||
class MyCloud : Vidplay() {
|
class MyCloud : Vidplay() {
|
||||||
override val name = "MyCloud"
|
override val name = "MyCloud"
|
||||||
override val mainUrl = "https://mcloud.bz"
|
override val mainUrl = "https://mcloud.bz"
|
||||||
|
|
|
@ -105,6 +105,7 @@ open class TmdbProvider : MainAPI() {
|
||||||
this.id,
|
this.id,
|
||||||
episode.episode_number,
|
episode.episode_number,
|
||||||
episode.season_number,
|
episode.season_number,
|
||||||
|
this.name ?: this.original_name,
|
||||||
).toJson(),
|
).toJson(),
|
||||||
episode.name,
|
episode.name,
|
||||||
episode.season_number,
|
episode.season_number,
|
||||||
|
@ -122,6 +123,7 @@ open class TmdbProvider : MainAPI() {
|
||||||
this.id,
|
this.id,
|
||||||
episodeNum,
|
episodeNum,
|
||||||
season.season_number,
|
season.season_number,
|
||||||
|
this.name ?: this.original_name,
|
||||||
).toJson(),
|
).toJson(),
|
||||||
season = season.season_number
|
season = season.season_number
|
||||||
)
|
)
|
||||||
|
|
|
@ -185,6 +185,7 @@ import com.lagradost.cloudstream3.extractors.Vanfem
|
||||||
import com.lagradost.cloudstream3.extractors.Vicloud
|
import com.lagradost.cloudstream3.extractors.Vicloud
|
||||||
import com.lagradost.cloudstream3.extractors.VidSrcExtractor
|
import com.lagradost.cloudstream3.extractors.VidSrcExtractor
|
||||||
import com.lagradost.cloudstream3.extractors.VidSrcExtractor2
|
import com.lagradost.cloudstream3.extractors.VidSrcExtractor2
|
||||||
|
import com.lagradost.cloudstream3.extractors.VidSrcTo
|
||||||
import com.lagradost.cloudstream3.extractors.VideoVard
|
import com.lagradost.cloudstream3.extractors.VideoVard
|
||||||
import com.lagradost.cloudstream3.extractors.VideovardSX
|
import com.lagradost.cloudstream3.extractors.VideovardSX
|
||||||
import com.lagradost.cloudstream3.extractors.Vidgomunime
|
import com.lagradost.cloudstream3.extractors.Vidgomunime
|
||||||
|
@ -876,6 +877,7 @@ val extractorApis: MutableList<ExtractorApi> = arrayListOf(
|
||||||
Streamlare(),
|
Streamlare(),
|
||||||
VidSrcExtractor(),
|
VidSrcExtractor(),
|
||||||
VidSrcExtractor2(),
|
VidSrcExtractor2(),
|
||||||
|
VidSrcTo(),
|
||||||
PlayLtXyz(),
|
PlayLtXyz(),
|
||||||
AStreamHub(),
|
AStreamHub(),
|
||||||
Vidplay(),
|
Vidplay(),
|
||||||
|
|
Loading…
Reference in a new issue