Skip to content

Commit

Permalink
14
Browse files Browse the repository at this point in the history
  • Loading branch information
ne1work authored Jul 26, 2024
1 parent 58ede70 commit 6e3e818
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions Kinoger/src/main/kotlin/com/ne1work/Kinoger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,35 +72,27 @@ class Kinoger : MainAPI() {
val description = document.select("div.images-border").text()
val year = """\((\d{4})\)""".toRegex().find(title)?.groupValues?.get(1)?.toIntOrNull()
val tags = document.select("li.category a").map { it.text() }

val recommendations = document.select("ul.ul_related li").mapNotNull {
it.toSearchResult()
}

val scripts = document.select("script").mapNotNull { script ->
val scriptContent = script.data()
val showPattern = Regex("""show\s*\(\s*\d+\s*,\s*(\[\[.*?\]\])\s*(,\s*.*?)*\s*\)""")
val match = showPattern.find(scriptContent)
match?.groupValues?.get(1)?.replace("'", "\"")
}

val jsonData = scripts.flatMap { data ->
val parsedData = AppUtils.tryParseJson<List<List<String>>>(data)
parsedData ?: emptyList()
}
val script = document.selectFirst("script:containsData(pw)")?.data()
?: document.selectFirst("script:containsData(fsst)")?.data()
?: document.selectFirst("script:containsData(ollhd)")?.data()

val type = if (scripts.any { it.contains("0.2") }) TvType.Movie else TvType.TvSeries
val data = script?.substringAfter("[")?.substringBeforeLast("]")?.replace("\'", "\"")
val json = AppUtils.tryParseJson<List<List<String>>>("[$data]")

val episodes = jsonData.flatMapIndexed { season: Int, iframes: List<String> ->
val type = if(script?.substringBeforeLast(")")?.substringAfterLast(",") == "0.2") TvType.Movie else TvType.TvSeries
val episodes = json?.flatMapIndexed { season: Int, iframes: List<String> ->
iframes.mapIndexed { episode, iframe ->
Episode(
iframe.trim(),
season = season + 1,
episode = episode + 1
)
}
}

} ?: emptyList()
return newTvSeriesLoadResponse(title, url, type, episodes) {
this.posterUrl = poster
this.year = year
Expand Down

0 comments on commit 6e3e818

Please sign in to comment.