fixed Yomovies

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

View file

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

View file

@ -7,9 +7,10 @@ import com.lagradost.cloudstream3.mvvm.safeApiCall
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
import java.net.URI
class YomoviesProvider : MainAPI() { class YomoviesProvider : MainAPI() {
override var mainUrl = "https://yomovies.fyi" override var mainUrl = "https://yomovies.icu"
override var name = "Yomovies" override var name = "Yomovies"
override val hasMainPage = true override val hasMainPage = true
override var lang = "hi" 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( override suspend fun loadLinks(
data: String, data: String,
isCasting: Boolean, isCasting: Boolean,
@ -134,23 +141,25 @@ class YomoviesProvider : MainAPI() {
): Boolean { ): Boolean {
if (data.startsWith(mainUrl)) { 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 -> .apmap { source ->
safeApiCall { safeApiCall {
when { when {
source.startsWith("https://membed.net") -> app.get( source.startsWith("https://membed.net") -> app.get(
source, source,
referer = "$mainUrl/" referer = "$ref/"
).document.select("ul.list-server-items li") ).document.select("ul.list-server-items li")
.apmap { .apmap {
loadExtractor( loadExtractor(
it.attr("data-video").substringBefore("=https://msubload"), it.attr("data-video").substringBefore("=https://msubload"),
"$mainUrl/", "$ref/",
subtitleCallback, subtitleCallback,
callback callback
) )
} }
else -> loadExtractor(source, "$mainUrl/", subtitleCallback, callback) else -> loadExtractor(source, "$ref/", subtitleCallback, callback)
} }
} }
} }