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 // use an integer for version numbers
version = 7 version = 8
cloudstream { cloudstream {

View File

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