fixed Yomovies

This commit is contained in:
hexated 2022-11-27 18:06:44 +07:00
parent 543b78e97a
commit f3d2fbeddd
2 changed files with 15 additions and 6 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 21
version = 22
cloudstream {

View file

@ -7,9 +7,10 @@ import com.lagradost.cloudstream3.mvvm.safeApiCall
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.nodes.Element
import java.net.URI
class YomoviesProvider : MainAPI() {
override var mainUrl = "https://yomovies.fyi"
override var mainUrl = "https://yomovies.icu"
override var name = "Yomovies"
override val hasMainPage = true
override var lang = "hi"
@ -126,6 +127,12 @@ class YomoviesProvider : MainAPI() {
}
}
private fun getBaseUrl(url: String): String {
return URI(url).let {
"${it.scheme}://${it.host}"
}
}
override suspend fun loadLinks(
data: String,
isCasting: Boolean,
@ -134,23 +141,25 @@ class YomoviesProvider : MainAPI() {
): Boolean {
if (data.startsWith(mainUrl)) {
app.get(data).document.select("div.movieplay iframe").map { fixUrl(it.attr("src")) }
val req = app.get(data)
val ref = getBaseUrl(req.url)
req.document.select("div.movieplay iframe").map { fixUrl(it.attr("src")) }
.apmap { source ->
safeApiCall {
when {
source.startsWith("https://membed.net") -> app.get(
source,
referer = "$mainUrl/"
referer = "$ref/"
).document.select("ul.list-server-items li")
.apmap {
loadExtractor(
it.attr("data-video").substringBefore("=https://msubload"),
"$mainUrl/",
"$ref/",
subtitleCallback,
callback
)
}
else -> loadExtractor(source, "$mainUrl/", subtitleCallback, callback)
else -> loadExtractor(source, "$ref/", subtitleCallback, callback)
}
}
}