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

View file

@ -1,7 +1,7 @@
package com.lagradost package com.lagradost
import com.lagradost.cloudstream3.* 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.mvvm.logError
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor import com.lagradost.cloudstream3.utils.loadExtractor
@ -113,10 +113,22 @@ class AllMoviesForYouProvider : MainAPI() {
val rating = val rating =
document.selectFirst("div.Vote > div.post-ratings > span")?.text()?.toRatingInt() document.selectFirst("div.Vote > div.post-ratings > span")?.text()?.toRatingInt()
val year = document.selectFirst("span.Date")?.text() val year = document.selectFirst("span.Date")?.text()
val duration = document.selectFirst("span.Time")!!.text()
val backgroundPoster = 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) { if (type == TvType.TvSeries) {
val list = ArrayList<Pair<Int, String>>() val list = ArrayList<Pair<Int, String>>()
@ -156,18 +168,19 @@ class AllMoviesForYouProvider : MainAPI() {
} }
} }
} }
return TvSeriesLoadResponse( return newTvSeriesLoadResponse(
title, title,
url, url,
this.name, TvType.TvSeries,
type, episodeList
episodeList, ) {
backgroundPoster, posterUrl = backgroundPoster
year?.toIntOrNull(), this.year = year?.toIntOrNull()
descipt, this.plot = descipt
null, this.tags = tags
rating this.rating = rating
) addActors(cast)
}
} else { } else {
return newMovieLoadResponse( return newMovieLoadResponse(
title, title,
@ -178,8 +191,9 @@ class AllMoviesForYouProvider : MainAPI() {
posterUrl = backgroundPoster posterUrl = backgroundPoster
this.year = year?.toIntOrNull() this.year = year?.toIntOrNull()
this.plot = descipt this.plot = descipt
this.tags = tags
this.rating = rating this.rating = rating
addDuration(duration) addActors(cast)
} }
} }
} }