From 24336c1fb9082fdef0e97eff63d081ba4440ab89 Mon Sep 17 00:00:00 2001 From: Zaw <42999156+ImZaw@users.noreply.github.com> Date: Wed, 30 Nov 2022 20:24:51 +0300 Subject: [PATCH 1/3] =?UTF-8?q?9goal=20=F0=9F=91=8D=20=20(#60)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NineGoalProvider/build.gradle.kts | 2 +- .../main/kotlin/com/ninegoal/9GoalProvider.kt | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/NineGoalProvider/build.gradle.kts b/NineGoalProvider/build.gradle.kts index 94d8a9c..e07b672 100644 --- a/NineGoalProvider/build.gradle.kts +++ b/NineGoalProvider/build.gradle.kts @@ -1,4 +1,4 @@ -version = 4 +version = 5 cloudstream { description = "" diff --git a/NineGoalProvider/src/main/kotlin/com/ninegoal/9GoalProvider.kt b/NineGoalProvider/src/main/kotlin/com/ninegoal/9GoalProvider.kt index 6033272..26d493b 100644 --- a/NineGoalProvider/src/main/kotlin/com/ninegoal/9GoalProvider.kt +++ b/NineGoalProvider/src/main/kotlin/com/ninegoal/9GoalProvider.kt @@ -5,6 +5,7 @@ import com.lagradost.cloudstream3.utils.ExtractorLink import com.fasterxml.jackson.annotation.JsonProperty import com.lagradost.cloudstream3.utils.AppUtils.parseJson import com.lagradost.cloudstream3.utils.Qualities +import java.net.URL import java.net.UnknownHostException import java.util.* @@ -60,10 +61,6 @@ data class sourcesJSON ( @JsonProperty("data" ) var data : sourceData? = sourceData() ) -private fun String.getDomainFromUrl(): String? { - return Regex("""^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n\?\=]+)""").find(this)?.groupValues?.firstOrNull() -} - class NineGoal : MainAPI() { override var mainUrl = "https://9goaltv.to" override var name = "9Goal" @@ -76,7 +73,10 @@ class NineGoal : MainAPI() { override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse { val doc = app.get(mainUrl).document - val apiUrl = doc.select("head > script").first()?.html()?.substringAfter("window.api_base_url = \"")?.substringBefore("\";") + val apiUrl = doc.select("head > script") + .firstOrNull { it.html().contains("window.api_base_url") }.let { + Regex("""window\.api_base_url = "(.*)";""").find(it?.html() ?: "")?.groupValues?.lastOrNull() + } ?: "https://justameanlessdomain.com" val matchesData = parseJson(app.get("$apiUrl/v1/match/featured").text) val liveHomePageList = matchesData.data.filter { it.isLive == true }.map { LiveSearchResponse( @@ -131,17 +131,17 @@ class NineGoal : MainAPI() { else -> Qualities.Unknown.value } } - val language = it.name?.replace(""" \(.*""".toRegex(), "") ?: "" + val language = it.name?.replace("""\(.*""".toRegex(), "") ?: "" + val url = URL(it.url) val requestStatus = try { app.head( fixUrl( - it.url?.getDomainFromUrl() ?: "canyou.letmestreamyou.net" + it.url ?: "" ) ).isSuccessful } catch (e: UnknownHostException) { false } - val domain = fixUrl(it.url?.getDomainFromUrl() ?: "https://canyou.letmestreamyou.net") if (!requestStatus) { mapOf( "(1)" to "https://playing.smoothlikebutterstream.com", @@ -153,8 +153,8 @@ class NineGoal : MainAPI() { callback.invoke( ExtractorLink( this.name, - "$language - $name", - it.url?.replace(domain, value) ?: "", + "$language $name", + it.url?.replace(url.host, value) ?: "", "$mainUrl/", quality, isM3u8 = true, @@ -165,7 +165,7 @@ class NineGoal : MainAPI() { callback.invoke( ExtractorLink( this.name, - "$language - ${sourcesData.name}", + "$language ${sourcesData.name}", it.url ?: "", "$mainUrl/", quality, From a8762857a1bf83d505fc71ac7edf04fcc567c07a Mon Sep 17 00:00:00 2001 From: Zaw <42999156+ImZaw@users.noreply.github.com> Date: Wed, 30 Nov 2022 22:04:00 +0300 Subject: [PATCH 2/3] =?UTF-8?q?hehe=20=F0=9F=98=8A=20(#61)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/kotlin/com/ninegoal/9GoalProvider.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/NineGoalProvider/src/main/kotlin/com/ninegoal/9GoalProvider.kt b/NineGoalProvider/src/main/kotlin/com/ninegoal/9GoalProvider.kt index 26d493b..aa444e4 100644 --- a/NineGoalProvider/src/main/kotlin/com/ninegoal/9GoalProvider.kt +++ b/NineGoalProvider/src/main/kotlin/com/ninegoal/9GoalProvider.kt @@ -144,11 +144,11 @@ class NineGoal : MainAPI() { } if (!requestStatus) { mapOf( - "(1)" to "https://playing.smoothlikebutterstream.com", - "(2)" to "https://playing.tunnelcdnsw.net", - "(3)" to "https://playing.goforfreedomwme.net", - "(4)" to "https://turnthe.gameon.tel", - "(5)" to "https://playing.whydontyoustreamwme.com" + "(1)" to "playing.smoothlikebutterstream.com", + "(2)" to "playing.tunnelcdnsw.net", + "(3)" to "playing.goforfreedomwme.net", + "(4)" to "turnthe.gameon.tel", + "(5)" to "playing.whydontyoustreamwme.com" ).apmap { (name, value) -> callback.invoke( ExtractorLink( From 03539a408b97b7c6de996e1a2455f084eb0c1c9f Mon Sep 17 00:00:00 2001 From: LagradOst <46196380+Blatzar@users.noreply.github.com> Date: Wed, 30 Nov 2022 19:05:49 +0000 Subject: [PATCH 3/3] Update build.gradle.kts --- NineGoalProvider/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NineGoalProvider/build.gradle.kts b/NineGoalProvider/build.gradle.kts index e07b672..bf5b4e9 100644 --- a/NineGoalProvider/build.gradle.kts +++ b/NineGoalProvider/build.gradle.kts @@ -1,4 +1,4 @@ -version = 5 +version = 6 cloudstream { description = ""