From 006a4926dcea816b657db0cb2c099a1d33e26fb0 Mon Sep 17 00:00:00 2001 From: Zaw <42999156+ImZaw@users.noreply.github.com> Date: Thu, 25 Aug 2022 15:37:38 +0300 Subject: [PATCH] Shahid4u Fixed --- Shahid4uProvider/build.gradle.kts | 2 +- .../src/main/kotlin/com/shahid4u/Shahid4uProvider.kt | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Shahid4uProvider/build.gradle.kts b/Shahid4uProvider/build.gradle.kts index 3908045..f9dd10a 100644 --- a/Shahid4uProvider/build.gradle.kts +++ b/Shahid4uProvider/build.gradle.kts @@ -1,4 +1,4 @@ -version = 1 +version = 2 cloudstream { description = "" diff --git a/Shahid4uProvider/src/main/kotlin/com/shahid4u/Shahid4uProvider.kt b/Shahid4uProvider/src/main/kotlin/com/shahid4u/Shahid4uProvider.kt index 7d98c32..edf9388 100644 --- a/Shahid4uProvider/src/main/kotlin/com/shahid4u/Shahid4uProvider.kt +++ b/Shahid4uProvider/src/main/kotlin/com/shahid4u/Shahid4uProvider.kt @@ -14,7 +14,10 @@ class Shahid4u : MainAPI() { override val hasMainPage = true override val supportedTypes = setOf(TvType.TvSeries, TvType.Movie, TvType.Anime, TvType.AsianDrama) - + + private fun String.getDomainFromUrl(): String? { + return Regex("""^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n\?\=]+)""").find(this)?.groupValues?.firstOrNull() + } private fun Element.toSearchResponse(): SearchResponse? { val urlElement = select("a.fullClick") val posterUrl = @@ -163,7 +166,7 @@ class Shahid4u : MainAPI() { val id = it.attr("data-id") val i = it.attr("data-i") val sourceUrl = app.post( - "https://shahed4u.mx/wp-content/themes/Shahid4u-WP_HOME/Ajaxat/Single/Server.php", + "${data.getDomainFromUrl()}/wp-content/themes/Shahid4u-WP_HOME/Ajaxat/Single/Server.php", headers = mapOf("referer" to watchUrl, "x-requested-with" to "XMLHttpRequest"), data = mapOf("id" to id, "i" to i) ).document.select("iframe").attr("src")