ok final commit

This commit is contained in:
Zaw 2022-11-29 21:02:34 +03:00
parent d98f0786e5
commit 96b6abbd2f

View file

@ -5,6 +5,7 @@ import com.lagradost.cloudstream3.utils.ExtractorLink
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.utils.AppUtils.parseJson import com.lagradost.cloudstream3.utils.AppUtils.parseJson
import com.lagradost.cloudstream3.utils.Qualities import com.lagradost.cloudstream3.utils.Qualities
import java.net.UnknownHostException
import java.util.* import java.util.*
data class Data ( data class Data (
@ -59,6 +60,10 @@ data class sourcesJSON (
@JsonProperty("data" ) var data : sourceData? = sourceData() @JsonProperty("data" ) var data : sourceData? = sourceData()
) )
private fun String.getDomainFromUrl(): String? {
return Regex("""^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n\?\=]+)""").find(this)?.groupValues?.firstOrNull()
}
class NineGoal : MainAPI() { class NineGoal : MainAPI() {
override var mainUrl = "https://9goaltv.to" override var mainUrl = "https://9goaltv.to"
override var name = "9Goal" override var name = "9Goal"
@ -106,8 +111,10 @@ class NineGoal : MainAPI() {
url, url,
this.name, this.name,
"$url/stream", "$url/stream",
"https://img.zr5.repl.co/vs?title=${json?.name}&home=${json?.home?.logo}&away=${json?.away?.logo}&live=${json?.isLive}"
) )
} }
override suspend fun loadLinks( override suspend fun loadLinks(
data: String, data: String,
isCasting: Boolean, isCasting: Boolean,
@ -116,8 +123,8 @@ class NineGoal : MainAPI() {
): Boolean { ): Boolean {
val sourcesData = parseJson<sourcesJSON>(app.get(data).text).data val sourcesData = parseJson<sourcesJSON>(app.get(data).text).data
sourcesData?.playUrls?.apmap { sourcesData?.playUrls?.apmap {
val quality = it.name?.substringAfter("(")?.substringBefore(")").let { val quality = it.name?.substringAfter("(")?.substringBefore(")").let { qualityText ->
when (it) { when (qualityText) {
"Full HD" -> 1080 "Full HD" -> 1080
"HD" -> 720 "HD" -> 720
"SD" -> 480 "SD" -> 480
@ -125,20 +132,29 @@ class NineGoal : MainAPI() {
} }
} }
val language = it.name?.replace(""" \(.*""".toRegex(), "") ?: "" val language = it.name?.replace(""" \(.*""".toRegex(), "") ?: ""
val brokenDomain = "letmestreamyou.net" val requestStatus = try {
if(it.url.toString().contains(brokenDomain)) { app.head(
fixUrl(
it.url?.getDomainFromUrl() ?: "canyou.letmestreamyou.net"
)
).isSuccessful
} catch (e: UnknownHostException) {
false
}
val domain = it.url?.getDomainFromUrl() ?: "canyou.letmestreamyou.net"
if (!requestStatus) {
mapOf( mapOf(
"Domain ( 1 )" to "playing.smoothlikebutterstream.com", "(1)" to "https://playing.smoothlikebutterstream.com",
"Domain ( 2 )" to "playing.tunnelcdnsw.net", "(2)" to "https://playing.tunnelcdnsw.net",
"Domain ( 3 )" to "playing.goforfreedomwme.net", "(3)" to "https://playing.goforfreedomwme.net",
"Domain ( 4 )" to "turnthe.gameon.tel", "(4)" to "https://turnthe.gameon.tel",
"Domain ( 5 )" to "playing.whydontyoustreamwme.com" "(5)" to "https://playing.whydontyoustreamwme.com"
).apmap { (name, value) -> ).apmap { (name, value) ->
callback.invoke( callback.invoke(
ExtractorLink( ExtractorLink(
this.name, this.name,
"$language - ${name}", "$language - $name",
it.url?.replace(brokenDomain, value) ?: "", it.url?.replace(domain, value) ?: "",
"$mainUrl/", "$mainUrl/",
quality, quality,
isM3u8 = true, isM3u8 = true,