small fixed for changed domain in Movierulzhd

This commit is contained in:
hexated 2022-11-23 00:33:58 +07:00
parent 3a160a7cc6
commit 86b4e9cecc
2 changed files with 12 additions and 3 deletions

View file

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

View file

@ -8,6 +8,7 @@ import com.lagradost.cloudstream3.mvvm.safeApiCall
import com.lagradost.cloudstream3.network.CloudflareKiller
import com.lagradost.cloudstream3.utils.*
import org.jsoup.nodes.Element
import java.net.URI
class Movierulzhd : MainAPI() {
override var mainUrl = "https://movierulzhd.life"
@ -212,6 +213,12 @@ class Movierulzhd : MainAPI() {
)
}
private fun getBaseUrl(url: String): String {
return URI(url).let {
"${it.scheme}://${it.host}"
}
}
override suspend fun loadLinks(
data: String,
isCasting: Boolean,
@ -219,7 +226,9 @@ class Movierulzhd : MainAPI() {
callback: (ExtractorLink) -> Unit
): Boolean {
var document = app.get(data).document
val req = app.get(data)
val directUrl = getBaseUrl(req.url)
var document = req.document
if(document.select("title").text() == "Just a moment...") {
document = app.get(data, interceptor = interceptor).document
}
@ -231,7 +240,7 @@ class Movierulzhd : MainAPI() {
}.apmap { nume ->
safeApiCall {
val source = app.post(
url = "$mainUrl/wp-admin/admin-ajax.php",
url = "$directUrl/wp-admin/admin-ajax.php",
data = mapOf(
"action" to "doo_player_ajax",
"post" to id,