Skip to content

Commit 7838a5d

Browse files
authored
Merge pull request #1 from ArixAR/master
support alternative streaming sources
2 parents d3be0e6 + d03b637 commit 7838a5d

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

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

+14-6
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,29 @@ class Kinoger : MainAPI() {
7777
it.toSearchResult()
7878
}
7979

80-
val script = document.selectFirst("script:containsData(pw)")?.data()
81-
val data = script?.substringAfter("[")?.substringBeforeLast("]")?.replace("\'", "\"")
82-
val json = AppUtils.tryParseJson<List<List<String>>>("[$data]")
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*0\.2\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+
}
8391

84-
val type = if(script?.substringBeforeLast(")")?.substringAfterLast(",") == "0.2") TvType.Movie else TvType.TvSeries
92+
val type = if (scripts.any { it.contains("0.2") }) TvType.Movie else TvType.TvSeries
8593

86-
val episodes = json?.flatMapIndexed { season: Int, iframes: List<String> ->
94+
val episodes = jsonData.flatMapIndexed { season: Int, iframes: List<String> ->
8795
iframes.mapIndexed { episode, iframe ->
8896
Episode(
8997
iframe.trim(),
9098
season = season + 1,
9199
episode = episode + 1
92100
)
93101
}
94-
} ?: emptyList()
102+
}
95103

96104
return newTvSeriesLoadResponse(title, url, type, episodes) {
97105
this.posterUrl = poster

0 commit comments

Comments
 (0)