mirror of
https://github.com/recloudstream/cloudstream-extensions-multilingual.git
synced 2024-08-15 03:15:14 +00:00
quality shit and removing domains name from source (#58)
This commit is contained in:
parent
89b344b132
commit
2faa926b2d
2 changed files with 54 additions and 28 deletions
|
@ -1,4 +1,4 @@
|
||||||
version = 3
|
version = 4
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
description = ""
|
description = ""
|
||||||
|
|
|
@ -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,22 +123,40 @@ 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) {
|
||||||
|
"Full HD" -> 1080
|
||||||
|
"HD" -> 720
|
||||||
|
"SD" -> 480
|
||||||
|
else -> Qualities.Unknown.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(
|
mapOf(
|
||||||
"smoothlikebutterstream" to "playing.smoothlikebutterstream.com",
|
"(1)" to "https://playing.smoothlikebutterstream.com",
|
||||||
"tunnelcdnsw" to "playing.tunnelcdnsw.net",
|
"(2)" to "https://playing.tunnelcdnsw.net",
|
||||||
"goforfreedomwme" to "playing.goforfreedomwme.net",
|
"(3)" to "https://playing.goforfreedomwme.net",
|
||||||
"gameon" to "turnthe.gameon.tel",
|
"(4)" to "https://turnthe.gameon.tel",
|
||||||
"whydontyoustreamwme" 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,
|
||||||
"${this.name} ${it.name} - ${name}",
|
"$language - $name",
|
||||||
it.url.toString().replace(brokenDomain, value),
|
it.url?.replace(domain, value) ?: "",
|
||||||
"$mainUrl/",
|
"$mainUrl/",
|
||||||
Qualities.Unknown.value,
|
quality,
|
||||||
isM3u8 = true,
|
isM3u8 = true,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -139,10 +165,10 @@ class NineGoal : MainAPI() {
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
ExtractorLink(
|
ExtractorLink(
|
||||||
this.name,
|
this.name,
|
||||||
"${this.name} ${it.name} - ${sourcesData.name}",
|
"$language - ${sourcesData.name}",
|
||||||
it.url.toString(),
|
it.url ?: "",
|
||||||
"$mainUrl/",
|
"$mainUrl/",
|
||||||
Qualities.Unknown.value,
|
quality,
|
||||||
isM3u8 = true,
|
isM3u8 = true,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue