mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Learned and understood what is flattening the code.
This commit is contained in:
parent
a936fc9ac8
commit
dc8ba3399c
1 changed files with 10 additions and 11 deletions
|
@ -22,20 +22,18 @@ class VidSrcTo : ExtractorApi() {
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit
|
||||||
) {
|
) {
|
||||||
app.get(url).document.selectFirst("ul.episodes li a")?.attr("data-id")?.let { mediaId ->
|
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>()
|
val res = app.get("$mainUrl/ajax/embed/episode/$mediaId/sources").parsedSafe<VidsrctoEpisodeSources>() ?: return
|
||||||
if (res?.status == 200) {
|
if (res?.status == 200) return
|
||||||
res.result?.amap { source ->
|
res.result?.amap { source ->
|
||||||
val embedRes = app.get("$mainUrl/ajax/embed/source/${source.id}").parsedSafe<VidsrctoEmbedSource>()
|
val embedRes = app.get("$mainUrl/ajax/embed/source/${source.id}").parsedSafe<VidsrctoEmbedSource>() ?: return@amap
|
||||||
val finalUrl = DecryptUrl(embedRes?.result?.encUrl ?: "")
|
val finalUrl = DecryptUrl(embedRes?.result?.encUrl)
|
||||||
when (source.title) {
|
when (source.title) {
|
||||||
"Vidplay" -> AnyVidplay(finalUrl.substringBefore("/e/")).getUrl(finalUrl, referer, subtitleCallback, callback)
|
"Vidplay" -> AnyVidplay(finalUrl.substringBefore("/e/")).getUrl(finalUrl, referer, subtitleCallback, callback)
|
||||||
"Filemoon" -> FileMoon().getUrl(finalUrl, referer, subtitleCallback, callback)
|
"Filemoon" -> FileMoon().getUrl(finalUrl, referer, subtitleCallback, callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun DecryptUrl(encUrl: String): String {
|
private fun DecryptUrl(encUrl: String): String {
|
||||||
var data = encUrl.toByteArray()
|
var data = encUrl.toByteArray()
|
||||||
|
@ -46,6 +44,7 @@ class VidSrcTo : ExtractorApi() {
|
||||||
data = cipher.doFinal(data)
|
data = cipher.doFinal(data)
|
||||||
return URLDecoder.decode(data.toString(Charsets.UTF_8), "utf-8")
|
return URLDecoder.decode(data.toString(Charsets.UTF_8), "utf-8")
|
||||||
}
|
}
|
||||||
|
|
||||||
data class VidsrctoEpisodeSources(
|
data class VidsrctoEpisodeSources(
|
||||||
@JsonProperty("status") val status: Int,
|
@JsonProperty("status") val status: Int,
|
||||||
@JsonProperty("result") val result: List<VidsrctoResult>?
|
@JsonProperty("result") val result: List<VidsrctoResult>?
|
||||||
|
|
Loading…
Reference in a new issue