uakino: Add seasons to recommendations

This commit is contained in:
CakesTwix 2024-01-21 13:59:12 +02:00
parent 1d63e72987
commit cbcddbd8f3
Signed by: CakesTwix
GPG key ID: 7B11051D5CE19825
2 changed files with 19 additions and 2 deletions

View file

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

View file

@ -60,6 +60,18 @@ class UakinoProvider : MainAPI() {
} }
private suspend fun Element.getSeasonInfo(): SearchResponse {
Log.d("CakesTwix-Debug", "getSeasonInfo: ${this.attr("href")}")
val document = app.get(this.attr("href")).document
val title = document.selectFirst("h1 span.solototle")?.text()?.trim().toString()
val poster = mainUrl + document.selectFirst("div.film-poster img")?.attr("src").toString()
return newMovieSearchResponse(title, this.attr("href"), TvType.Movie) {
this.posterUrl = poster
}
}
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {
val document = app.post( val document = app.post(
url = mainUrl, url = mainUrl,
@ -124,8 +136,13 @@ class UakinoProvider : MainAPI() {
val description = document.selectFirst("div[itemprop=description]")?.text()?.trim() val description = document.selectFirst("div[itemprop=description]")?.text()?.trim()
val trailer = document.selectFirst("iframe#pre")?.attr("data-src") val trailer = document.selectFirst("iframe#pre")?.attr("data-src")
// Add seasons to recommendations
val recommendations = document.select(".seasons li a").map{
it.getSeasonInfo()
}.toMutableList()
val recommendations = document.select(".related-item").map { // Other recommendations
recommendations += document.select(".related-item").map {
it.toSearchResponse() it.toSearchResponse()
} }