File tree 1 file changed +14
-6
lines changed
Kinoger/src/main/kotlin/com/ne1work
1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -77,21 +77,29 @@ class Kinoger : MainAPI() {
77
77
it.toSearchResult()
78
78
}
79
79
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
+ }
83
91
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
85
93
86
- val episodes = json? .flatMapIndexed { season: Int , iframes: List <String > ->
94
+ val episodes = jsonData .flatMapIndexed { season: Int , iframes: List <String > ->
87
95
iframes.mapIndexed { episode, iframe ->
88
96
Episode (
89
97
iframe.trim(),
90
98
season = season + 1 ,
91
99
episode = episode + 1
92
100
)
93
101
}
94
- } ? : emptyList()
102
+ }
95
103
96
104
return newTvSeriesLoadResponse(title, url, type, episodes) {
97
105
this .posterUrl = poster
You can’t perform that action at this time.
0 commit comments