mirror of
https://github.com/recloudstream/cloudstream-extensions-multilingual.git
synced 2024-08-15 03:15:14 +00:00
9goal 👍 (#60)
This commit is contained in:
parent
2faa926b2d
commit
24336c1fb9
2 changed files with 12 additions and 12 deletions
|
@ -1,4 +1,4 @@
|
||||||
version = 4
|
version = 5
|
||||||
|
|
||||||
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.URL
|
||||||
import java.net.UnknownHostException
|
import java.net.UnknownHostException
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
@ -60,10 +61,6 @@ 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"
|
||||||
|
@ -76,7 +73,10 @@ class NineGoal : MainAPI() {
|
||||||
|
|
||||||
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
|
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
|
||||||
val doc = app.get(mainUrl).document
|
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<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(
|
||||||
|
@ -132,16 +132,16 @@ class NineGoal : MainAPI() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val language = it.name?.replace("""\(.*""".toRegex(), "") ?: ""
|
val language = it.name?.replace("""\(.*""".toRegex(), "") ?: ""
|
||||||
|
val url = URL(it.url)
|
||||||
val requestStatus = try {
|
val requestStatus = try {
|
||||||
app.head(
|
app.head(
|
||||||
fixUrl(
|
fixUrl(
|
||||||
it.url?.getDomainFromUrl() ?: "canyou.letmestreamyou.net"
|
it.url ?: ""
|
||||||
)
|
)
|
||||||
).isSuccessful
|
).isSuccessful
|
||||||
} catch (e: UnknownHostException) {
|
} catch (e: UnknownHostException) {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
val domain = fixUrl(it.url?.getDomainFromUrl() ?: "https://canyou.letmestreamyou.net")
|
|
||||||
if (!requestStatus) {
|
if (!requestStatus) {
|
||||||
mapOf(
|
mapOf(
|
||||||
"(1)" to "https://playing.smoothlikebutterstream.com",
|
"(1)" to "https://playing.smoothlikebutterstream.com",
|
||||||
|
@ -153,8 +153,8 @@ class NineGoal : MainAPI() {
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
ExtractorLink(
|
ExtractorLink(
|
||||||
this.name,
|
this.name,
|
||||||
"$language - $name",
|
"$language $name",
|
||||||
it.url?.replace(domain, value) ?: "",
|
it.url?.replace(url.host, value) ?: "",
|
||||||
"$mainUrl/",
|
"$mainUrl/",
|
||||||
quality,
|
quality,
|
||||||
isM3u8 = true,
|
isM3u8 = true,
|
||||||
|
@ -165,7 +165,7 @@ class NineGoal : MainAPI() {
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
ExtractorLink(
|
ExtractorLink(
|
||||||
this.name,
|
this.name,
|
||||||
"$language - ${sourcesData.name}",
|
"$language ${sourcesData.name}",
|
||||||
it.url ?: "",
|
it.url ?: "",
|
||||||
"$mainUrl/",
|
"$mainUrl/",
|
||||||
quality,
|
quality,
|
||||||
|
|
Loading…
Reference in a new issue