kinoger: fix detail page

This commit is contained in:
alex 2024-01-08 12:24:49 +07:00
parent 3955446a36
commit 2da3119c8c
1 changed files with 9 additions and 8 deletions

View File

@ -70,24 +70,24 @@ class Kinoger : MainAPI() {
val poster = fixUrlNull(document.selectFirst("div.images-border img")?.getImageAttr()) val poster = fixUrlNull(document.selectFirst("div.images-border img")?.getImageAttr())
val description = document.select("div.images-border").text() val description = document.select("div.images-border").text()
val year = """\((\d{4})\)""".toRegex().find(title)?.groupValues?.get(1)?.toIntOrNull() val year = """\((\d{4})\)""".toRegex().find(title)?.groupValues?.get(1)?.toIntOrNull()
val type = if (document.selectFirst("label[title=Stream HD+]") val tags = document.select("li.category a").map { it.text() }
?.hasText() == true
) TvType.Movie else TvType.TvSeries
val recommendations = document.select("ul.ul_related li").mapNotNull { val recommendations = document.select("ul.ul_related li").mapNotNull {
it.toSearchResult() it.toSearchResult()
} }
val script = document.selectFirst("script:containsData(pw.show)")?.data() val script = document.selectFirst("script:containsData(pw.show)")?.data()
?.substringAfter("[")?.substringBeforeLast("]")?.replace("\'", "\"") val data = script?.substringAfter("[")?.substringBeforeLast("]")?.replace("\'", "\"")
val json = AppUtils.tryParseJson<List<List<String>>>("[$script]") val json = AppUtils.tryParseJson<List<List<String>>>("[$data]")
val type = if(script?.substringBeforeLast(")")?.substringAfterLast(",") == "0.2") TvType.Movie else TvType.TvSeries
val episodes = json?.flatMapIndexed { season: Int, iframes: List<String> -> val episodes = json?.flatMapIndexed { season: Int, iframes: List<String> ->
iframes.mapIndexed { episode, iframe -> iframes.mapIndexed { episode, iframe ->
Episode( Episode(
iframe.trim(), iframe.trim(),
season = season + 1, season = season + 1,
episode = episode + 1 episode = episode + 1
) )
} }
} ?: emptyList() } ?: emptyList()
@ -96,6 +96,7 @@ class Kinoger : MainAPI() {
this.posterUrl = poster this.posterUrl = poster
this.year = year this.year = year
this.plot = description this.plot = description
this.tags = tags
this.recommendations = recommendations this.recommendations = recommendations
} }
} }