Compare commits

..

2 commits

Author SHA1 Message Date
b0c94febf5
klontv: Added subs
All checks were successful
Build / build (push) Successful in 1m17s
2024-08-09 16:38:15 +03:00
de83a78845
klontv: Fix crash in search items 2024-08-09 16:38:06 +03:00
3 changed files with 22 additions and 3 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 4
version = 5
cloudstream {

View file

@ -97,7 +97,7 @@ class KlonTVProvider : MainAPI() {
// JSON
val title = titleJson.name
val poster = titleJson.image
val rating = titleJson.aggregateRating.ratingValue.toString().toRatingInt()
val rating = titleJson.aggregateRating?.ratingValue.toString().toRatingInt()
val actors = titleJson.actor.map { it.name }
// HTML
@ -190,6 +190,17 @@ class KlonTVProvider : MainAPI() {
referer = "https://tortuga.wtf/"
).forEach(callback)
val subtitleUrl = app.get(dataList[1]).document.select("script").html()
.substringAfterLast("subtitle: \"")
.substringBefore("\",")
if(subtitleUrl.isNullOrBlank()) return true
subtitleCallback.invoke(
SubtitleFile(
subtitleUrl.substringAfterLast("[").substringBefore("]"),
subtitleUrl.substringAfter("]")
)
)
return true
}
@ -208,6 +219,14 @@ class KlonTVProvider : MainAPI() {
streamUrl = episode.file,
referer = "https://tortuga.wtf/"
).forEach(callback)
if(episode.subtitle.isBlank()) return true
subtitleCallback.invoke(
SubtitleFile(
episode.subtitle.substringAfterLast("[").substringBefore("]"),
episode.subtitle.substringAfter("]")
)
)
}
}
}

View file

@ -13,7 +13,7 @@ data class GeneralInfo (
val director : List<Director>,
val actor : List<Actor>,
val countryOfOrigin : List<CountryOfOrigin>,
val aggregateRating : AggregateRating
val aggregateRating : AggregateRating?,
)
data class Director (