quality shit and removing domains name from source (#58)

This commit is contained in:
Zaw 2022-11-29 22:55:08 +03:00 committed by GitHub
parent 89b344b132
commit 2faa926b2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 28 deletions

View File

@ -1,4 +1,4 @@
version = 3 version = 4
cloudstream { cloudstream {
description = "" description = ""

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 (
@ -58,6 +59,11 @@ data class sourceData (
data class sourcesJSON ( 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"
@ -74,7 +80,7 @@ class NineGoal : MainAPI() {
val matchesData = parseJson<matchesJSON>(app.get("$apiUrl/v1/match/featured").text) val matchesData = parseJson<matchesJSON>(app.get("$apiUrl/v1/match/featured").text)
val liveHomePageList = matchesData.data.filter { it.isLive == true }.map { val liveHomePageList = matchesData.data.filter { it.isLive == true }.map {
LiveSearchResponse( LiveSearchResponse(
it.name.toString(), it.name ?: "",
apiUrl + "/v1/match/" + it.id, apiUrl + "/v1/match/" + it.id,
this@NineGoal.name, this@NineGoal.name,
TvType.Live, TvType.Live,
@ -83,7 +89,7 @@ class NineGoal : MainAPI() {
} }
val featuredHomePageList = matchesData.data.filter { it.isLive == false }.map { val featuredHomePageList = matchesData.data.filter { it.isLive == false }.map {
LiveSearchResponse( LiveSearchResponse(
it.name.toString(), it.name ?: "",
apiUrl + "/v1/match/" + it.id, apiUrl + "/v1/match/" + it.id,
this@NineGoal.name, this@NineGoal.name,
TvType.Live, TvType.Live,
@ -101,12 +107,14 @@ class NineGoal : MainAPI() {
override suspend fun load(url: String): LoadResponse { override suspend fun load(url: String): LoadResponse {
val json = parseJson<oneMatch>(app.get(url).text).data val json = parseJson<oneMatch>(app.get(url).text).data
return LiveStreamLoadResponse( return LiveStreamLoadResponse(
json?.name.toString(), json?.name ?: "",
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,
@ -115,38 +123,56 @@ 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 brokenDomain = "canyou.letmestreamyou.net" val quality = it.name?.substringAfter("(")?.substringBefore(")").let { qualityText ->
if(it.url.toString().startsWith("https://$brokenDomain")) { when (qualityText) {
mapOf( "Full HD" -> 1080
"smoothlikebutterstream" to "playing.smoothlikebutterstream.com", "HD" -> 720
"tunnelcdnsw" to "playing.tunnelcdnsw.net", "SD" -> 480
"goforfreedomwme" to "playing.goforfreedomwme.net", else -> Qualities.Unknown.value
"gameon" to "turnthe.gameon.tel", }
"whydontyoustreamwme" to "playing.whydontyoustreamwme.com" }
).apmap { (name, value) -> val language = it.name?.replace(""" \(.*""".toRegex(), "") ?: ""
val requestStatus = try {
app.head(
fixUrl(
it.url?.getDomainFromUrl() ?: "canyou.letmestreamyou.net"
)
).isSuccessful
} catch (e: UnknownHostException) {
false
}
val domain = fixUrl(it.url?.getDomainFromUrl() ?: "https://canyou.letmestreamyou.net")
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"
).apmap { (name, value) ->
callback.invoke(
ExtractorLink(
this.name,
"$language - $name",
it.url?.replace(domain, value) ?: "",
"$mainUrl/",
quality,
isM3u8 = true,
)
)
}
} else {
callback.invoke( callback.invoke(
ExtractorLink( ExtractorLink(
this.name, this.name,
"${this.name} ${it.name} - ${name}", "$language - ${sourcesData.name}",
it.url.toString().replace(brokenDomain, value), it.url ?: "",
"$mainUrl/", "$mainUrl/",
Qualities.Unknown.value, quality,
isM3u8 = true, isM3u8 = true,
) )
) )
} }
} else {
callback.invoke(
ExtractorLink(
this.name,
"${this.name} ${it.name} - ${sourcesData.name}",
it.url.toString(),
"$mainUrl/",
Qualities.Unknown.value,
isM3u8 = true,
)
)
}
} }
return true return true
} }