fixed desc in TimefourTv schedule

This commit is contained in:
hexated 2022-11-25 22:04:23 +07:00
parent bbf2e244e1
commit 03808b37a0
2 changed files with 15 additions and 13 deletions

View file

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

View file

@ -89,21 +89,23 @@ 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($name)")?.nextElementSiblings()?.toString()
?.substringBefore("<h2")?.let { Jsoup.parse(it) }?.select("span")
?.mapIndexed { index, ele ->
val episode = mutableListOf<Episode>()
doc.selectFirst("div.search_p h2:contains($name)")?.nextElementSiblings()?.toString()
?.substringBefore("<h2")?.split("<br>")?.map {
val desc = it.substringBefore("<span").replace(Regex("</?strong>"), "").replace("<p>", "")
Jsoup.parse(it).select("span").map { ele ->
val title = ele.select("a").text()
val href = ele.select("a").attr("href")
val desc = ele.parent()?.textNodes()?.getOrNull(index)?.toString()
Episode(
href,
title,
posterUrl = time4tvPoster,
description = desc,
episode.add(
Episode(
href,
title,
description = desc,
posterUrl = time4tvPoster
)
)
} ?: throw ErrorLoadingException("Referest Page")
}
}
return newTvSeriesLoadResponse(name, url, TvType.TvSeries, episode) {
}