From 86b4e9cecc41c9e163765cfae82922ce1a5d962b Mon Sep 17 00:00:00 2001 From: hexated Date: Wed, 23 Nov 2022 00:33:58 +0700 Subject: [PATCH] small fixed for changed domain in Movierulzhd --- Movierulzhd/build.gradle.kts | 2 +- .../src/main/kotlin/com/hexated/Movierulzhd.kt | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Movierulzhd/build.gradle.kts b/Movierulzhd/build.gradle.kts index 9fc58299..c0afdc50 100644 --- a/Movierulzhd/build.gradle.kts +++ b/Movierulzhd/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 20 +version = 21 cloudstream { diff --git a/Movierulzhd/src/main/kotlin/com/hexated/Movierulzhd.kt b/Movierulzhd/src/main/kotlin/com/hexated/Movierulzhd.kt index 45a6a8f3..56980462 100644 --- a/Movierulzhd/src/main/kotlin/com/hexated/Movierulzhd.kt +++ b/Movierulzhd/src/main/kotlin/com/hexated/Movierulzhd.kt @@ -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,