Learned and understood what is flattening the code.

This commit is contained in:
RowdyRushya 2024-04-24 17:49:00 -07:00 committed by GitHub
parent a936fc9ac8
commit dc8ba3399c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,17 +22,15 @@ 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)
}
}
} }
} }
} }
@ -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>?