fixed TimefourTv

This commit is contained in:
hexated 2022-11-27 16:06:00 +07:00
parent 9f16ea10cb
commit 543b78e97a
2 changed files with 6 additions and 6 deletions

View File

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 8 version = 9
cloudstream { cloudstream {

View File

@ -38,7 +38,7 @@ open class TimefourTv : MainAPI() {
val home = res.select("div.tab-content ul li").mapNotNull { val home = res.select("div.tab-content ul li").mapNotNull {
it.toSearchResult() it.toSearchResult()
} }
items.add(HomePageList(request.name, home, true)) if(home.isNotEmpty()) items.add(HomePageList(request.name, home, true))
} }
if (request.name == "All Channels") { if (request.name == "All Channels") {
val res = if (page == 1) { val res = if (page == 1) {
@ -49,12 +49,12 @@ open class TimefourTv : MainAPI() {
val home = res.select("div.tab-content ul li").mapNotNull { val home = res.select("div.tab-content ul li").mapNotNull {
it.toSearchResult() it.toSearchResult()
} }
items.add(HomePageList(request.name, home, true)) if(home.isNotEmpty()) items.add(HomePageList(request.name, home, true))
} }
if (nonPaged && request.name == "Schedule") { if (nonPaged && request.name == "Schedule") {
val res = app.get(request.data).document val res = app.get(request.data).document
val schedule = res.select("div.search_p h2").mapNotNull { val schedule = res.select("div.search_p h1,div.search_p h2").mapNotNull {
it.toSearchSchedule() it.toSearchSchedule()
} }
items.add(HomePageList(request.name, schedule, true)) items.add(HomePageList(request.name, schedule, true))
@ -88,8 +88,8 @@ open class TimefourTv : MainAPI() {
val name = url.removePrefix("$mainUrl/") val name = url.removePrefix("$mainUrl/")
val doc = app.get("$mainUrl/schedule.php").document val doc = app.get("$mainUrl/schedule.php").document
val episode = mutableListOf<Episode>() val episode = mutableListOf<Episode>()
doc.selectFirst("div.search_p h2:contains($name)")?.nextElementSiblings()?.toString() doc.selectFirst("div.search_p h1:contains($name)")?.nextElementSiblings()?.toString()
?.substringBefore("<h2")?.split("<br>")?.map { ?.substringBefore("<h1")?.split("<br>")?.map {
val desc = it.substringBefore("<span").replace(Regex("</?strong>"), "").replace("<p>", "") val desc = it.substringBefore("<span").replace(Regex("</?strong>"), "").replace("<p>", "")
Jsoup.parse(it).select("span").map { ele -> Jsoup.parse(it).select("span").map { ele ->
val title = ele.select("a").text() val title = ele.select("a").text()