Skip to content

Commit 6e3e818

Browse files
authored
14
1 parent 58ede70 commit 6e3e818

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

Kinoger/src/main/kotlin/com/ne1work/Kinoger.kt

+8-16
Original file line numberDiff line numberDiff line change
@@ -72,35 +72,27 @@ class Kinoger : MainAPI() {
7272
val description = document.select("div.images-border").text()
7373
val year = """\((\d{4})\)""".toRegex().find(title)?.groupValues?.get(1)?.toIntOrNull()
7474
val tags = document.select("li.category a").map { it.text() }
75-
7675
val recommendations = document.select("ul.ul_related li").mapNotNull {
7776
it.toSearchResult()
7877
}
7978

80-
val scripts = document.select("script").mapNotNull { script ->
81-
val scriptContent = script.data()
82-
val showPattern = Regex("""show\s*\(\s*\d+\s*,\s*(\[\[.*?\]\])\s*(,\s*.*?)*\s*\)""")
83-
val match = showPattern.find(scriptContent)
84-
match?.groupValues?.get(1)?.replace("'", "\"")
85-
}
86-
87-
val jsonData = scripts.flatMap { data ->
88-
val parsedData = AppUtils.tryParseJson<List<List<String>>>(data)
89-
parsedData ?: emptyList()
90-
}
79+
val script = document.selectFirst("script:containsData(pw)")?.data()
80+
?: document.selectFirst("script:containsData(fsst)")?.data()
81+
?: document.selectFirst("script:containsData(ollhd)")?.data()
9182

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

94-
val episodes = jsonData.flatMapIndexed { season: Int, iframes: List<String> ->
86+
val type = if(script?.substringBeforeLast(")")?.substringAfterLast(",") == "0.2") TvType.Movie else TvType.TvSeries
87+
val episodes = json?.flatMapIndexed { season: Int, iframes: List<String> ->
9588
iframes.mapIndexed { episode, iframe ->
9689
Episode(
9790
iframe.trim(),
9891
season = season + 1,
9992
episode = episode + 1
10093
)
10194
}
102-
}
103-
95+
} ?: emptyList()
10496
return newTvSeriesLoadResponse(title, url, type, episodes) {
10597
this.posterUrl = poster
10698
this.year = year

0 commit comments

Comments
 (0)