From b911503a6cc79a6f1d28b2668361a8bf4af83faa Mon Sep 17 00:00:00 2001 From: hexated Date: Thu, 6 Oct 2022 04:48:01 +0700 Subject: [PATCH] fixed some sources TimefourTv --- TimefourTv/build.gradle.kts | 2 +- .../src/main/kotlin/com/hexated/TimefourTv.kt | 56 +-------- .../kotlin/com/hexated/TimefourTvExtractor.kt | 119 ++++++++++++++++++ 3 files changed, 125 insertions(+), 52 deletions(-) create mode 100644 TimefourTv/src/main/kotlin/com/hexated/TimefourTvExtractor.kt diff --git a/TimefourTv/build.gradle.kts b/TimefourTv/build.gradle.kts index 813f95b5..badb97c4 100644 --- a/TimefourTv/build.gradle.kts +++ b/TimefourTv/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 3 +version = 4 cloudstream { diff --git a/TimefourTv/src/main/kotlin/com/hexated/TimefourTv.kt b/TimefourTv/src/main/kotlin/com/hexated/TimefourTv.kt index 2b9aa943..a21d300e 100644 --- a/TimefourTv/src/main/kotlin/com/hexated/TimefourTv.kt +++ b/TimefourTv/src/main/kotlin/com/hexated/TimefourTv.kt @@ -4,10 +4,9 @@ import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.Qualities import org.jsoup.nodes.Element -import java.net.URI -class TimefourTv : MainAPI() { - override var mainUrl = "https://time4tv.stream" +open class TimefourTv : MainAPI() { + final override var mainUrl = "https://time4tv.stream" override var name = "Time4tv" override val hasDownloadSupport = false override val hasMainPage = true @@ -30,7 +29,7 @@ class TimefourTv : MainAPI() { ): HomePageResponse { val items = mutableListOf() val nonPaged = request.name != "All Channels" && page <= 1 - if(nonPaged) { + if (nonPaged) { val res = app.get("${request.data}.php").document val home = res.select("div.tab-content ul li").mapNotNull { it.toSearchResult() @@ -97,51 +96,6 @@ class TimefourTv : MainAPI() { } } - private fun getBaseUrl(url: String): String { - return URI(url).let { - "${it.scheme}://${it.host}" - } - } - - private var mainServer: String? = null - private suspend fun getLink(url: String): String? { - val (channel, iframe) = if (url.contains("width=")) { - val doc = app.get(url, referer = "$mainUrl/").document - val tempIframe = doc.selectFirst("iframe")?.attr("src") ?: return null - val doctwo = app.get(fixUrl(tempIframe), referer = url).text - listOf( - tempIframe.split("?").last().removePrefix("id=").replace(".php", ""), - doctwo.substringAfterLast("