diff --git a/TimefourTv/build.gradle.kts b/TimefourTv/build.gradle.kts index 5c62e04d..d7f2d517 100644 --- a/TimefourTv/build.gradle.kts +++ b/TimefourTv/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 5 +version = 6 cloudstream { diff --git a/TimefourTv/src/main/kotlin/com/hexated/TimefourTv.kt b/TimefourTv/src/main/kotlin/com/hexated/TimefourTv.kt index 1a1f4ef1..5e24d44b 100644 --- a/TimefourTv/src/main/kotlin/com/hexated/TimefourTv.kt +++ b/TimefourTv/src/main/kotlin/com/hexated/TimefourTv.kt @@ -67,7 +67,7 @@ open class TimefourTv : MainAPI() { private fun Element.toSearchSchedule(): LiveSearchResponse? { return LiveSearchResponse( this.text() ?: return null, - Schedule(this.text()).toJson(), + this.text(), this@TimefourTv.name, TvType.Live, posterUrl = time4tvPoster @@ -86,10 +86,11 @@ open class TimefourTv : MainAPI() { } private suspend fun loadSchedule(url: String): LoadResponse { + val name = url.removePrefix("$mainUrl/") val doc = app.get("$mainUrl/schedule.php").document val episode = - doc.selectFirst("div.search_p h2:contains($url)")?.nextElementSibling()?.select("span") + doc.selectFirst("div.search_p h2:contains($name)")?.nextElementSibling()?.select("span") ?.mapIndexedNotNull { index, ele -> val title = ele.select("a").text() val href = ele.select("a").attr("href") @@ -102,16 +103,15 @@ open class TimefourTv : MainAPI() { ) } ?: throw ErrorLoadingException("Referest Page") - return newTvSeriesLoadResponse(url, url, TvType.TvSeries, episode) { + return newTvSeriesLoadResponse(name, url, TvType.TvSeries, episode) { } } override suspend fun load(url: String): LoadResponse? { - val data = AppUtils.parseJson(url) - - if (data.name?.startsWith("http") == false) return loadSchedule(data.name) val res = app.get(url) + if (!res.isSuccessful) return loadSchedule(url) + val document = res.document val title = document.selectFirst("div.channelHeading h1")?.text() ?: return null val poster = @@ -176,8 +176,4 @@ open class TimefourTv : MainAPI() { return true } - data class Schedule( - val name: String? = null - ) - } \ No newline at end of file