@@ -72,35 +72,27 @@ class Kinoger : MainAPI() {
72
72
val description = document.select(" div.images-border" ).text()
73
73
val year = """ \((\d{4})\)""" .toRegex().find(title)?.groupValues?.get(1 )?.toIntOrNull()
74
74
val tags = document.select(" li.category a" ).map { it.text() }
75
-
76
75
val recommendations = document.select(" ul.ul_related li" ).mapNotNull {
77
76
it.toSearchResult()
78
77
}
79
78
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()
91
82
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 ]" )
93
85
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 > ->
95
88
iframes.mapIndexed { episode, iframe ->
96
89
Episode (
97
90
iframe.trim(),
98
91
season = season + 1 ,
99
92
episode = episode + 1
100
93
)
101
94
}
102
- }
103
-
95
+ } ? : emptyList()
104
96
return newTvSeriesLoadResponse(title, url, type, episodes) {
105
97
this .posterUrl = poster
106
98
this .year = year
0 commit comments