Fix poster, add actor and tags (#11)

Fix poster, add actor and tags
This commit is contained in:
tuan041 2022-09-10 00:19:39 +07:00 committed by GitHub
parent ac7da297e4
commit 8d1edf6dc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 29 additions and 15 deletions

View File

@ -1,7 +1,7 @@
package com.lagradost
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addDuration
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
@ -113,10 +113,22 @@ class AllMoviesForYouProvider : MainAPI() {
val rating =
document.selectFirst("div.Vote > div.post-ratings > span")?.text()?.toRatingInt()
val year = document.selectFirst("span.Date")?.text()
val duration = document.selectFirst("span.Time")!!.text()
val backgroundPoster =
fixUrlNull(document.selectFirst("div.Image > figure > img")?.attr("data-src"))
fixUrlNull(document.selectFirst("div.Image > figure > img")?.attr("src"))
var tags: List<String>? = null
var cast: List<String>? = null
document.select("div.Description > p").forEach { element ->
val newtype = element.select("span")!!.text() ?: return@forEach
when {
newtype.contains("Genre") -> {
tags = element.select("a").mapNotNull { it.text() }
}
newtype.contains("Cast") -> {
cast = element.select("a").mapNotNull { it.text() }
}
}
}
if (type == TvType.TvSeries) {
val list = ArrayList<Pair<Int, String>>()
@ -156,18 +168,19 @@ class AllMoviesForYouProvider : MainAPI() {
}
}
}
return TvSeriesLoadResponse(
return newTvSeriesLoadResponse(
title,
url,
this.name,
type,
episodeList,
backgroundPoster,
year?.toIntOrNull(),
descipt,
null,
rating
)
TvType.TvSeries,
episodeList
) {
posterUrl = backgroundPoster
this.year = year?.toIntOrNull()
this.plot = descipt
this.tags = tags
this.rating = rating
addActors(cast)
}
} else {
return newMovieLoadResponse(
title,
@ -178,8 +191,9 @@ class AllMoviesForYouProvider : MainAPI() {
posterUrl = backgroundPoster
this.year = year?.toIntOrNull()
this.plot = descipt
this.tags = tags
this.rating = rating
addDuration(duration)
addActors(cast)
}
}
}