fix vizjer

This commit is contained in:
C10udburst 2022-08-17 16:05:42 +02:00
parent 11baefac06
commit bb71152e31
2 changed files with 22 additions and 9 deletions

View File

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

View File

@ -33,10 +33,10 @@ class VizjerProvider : MainAPI() {
val year = l.select(".year").text().toIntOrNull() val year = l.select(".year").text().toIntOrNull()
MovieSearchResponse( MovieSearchResponse(
name, name,
href, properUrl(href)!!,
this.name, this.name,
TvType.Movie, TvType.Movie,
poster, properUrl(poster)!!,
year year
) )
} }
@ -62,15 +62,15 @@ class VizjerProvider : MainAPI() {
if (type === TvType.TvSeries) { if (type === TvType.TvSeries) {
TvSeriesSearchResponse( TvSeriesSearchResponse(
name, name,
href, properUrl(href) ?: "",
this.name, this.name,
type, type,
img, properUrl(img) ?: "",
null, null,
null null
) )
} else { } else {
MovieSearchResponse(name, href, this.name, type, img, null) MovieSearchResponse(name, properUrl(href) ?: "", this.name, type, properUrl(img) ?: "", null)
} }
} }
} }
@ -91,7 +91,7 @@ class VizjerProvider : MainAPI() {
val plot = document.select(".description").text() val plot = document.select(".description").text()
val episodesElements = document.select("#episode-list a[href]") val episodesElements = document.select("#episode-list a[href]")
if (episodesElements.isEmpty()) { if (episodesElements.isEmpty()) {
return MovieLoadResponse(title, url, name, TvType.Movie, data, posterUrl, null, plot) return MovieLoadResponse(title, properUrl(url) ?: "", name, TvType.Movie, data, properUrl(posterUrl) ?: "", null, plot)
} }
title = document.selectFirst(".info")?.parent()?.select("h2")?.text() ?: "" title = document.selectFirst(".info")?.parent()?.select("h2")?.text() ?: ""
val episodes = episodesElements.mapNotNull { episode -> val episodes = episodesElements.mapNotNull { episode ->
@ -108,11 +108,11 @@ class VizjerProvider : MainAPI() {
return TvSeriesLoadResponse( return TvSeriesLoadResponse(
title, title,
url, properUrl(url) ?: "",
name, name,
TvType.TvSeries, TvType.TvSeries,
episodes, episodes,
posterUrl, properUrl(posterUrl) ?: "",
null, null,
plot plot
) )
@ -126,6 +126,8 @@ class VizjerProvider : MainAPI() {
): Boolean { ): Boolean {
val document = if (data.startsWith("http")) val document = if (data.startsWith("http"))
app.get(data).document.select("#link-list").first() app.get(data).document.select("#link-list").first()
else if (data.startsWith("URL"))
app.get(properUrl(data) ?: "").document.select("#link-list").first()
else Jsoup.parse(data) else Jsoup.parse(data)
document?.select(".link-to-video")?.apmap { item -> document?.select(".link-to-video")?.apmap { item ->
@ -135,6 +137,17 @@ class VizjerProvider : MainAPI() {
} }
return true return true
} }
private fun properUrl(inUrl: String?): String? {
if (inUrl == null) return null
return fixUrl(
inUrl.replace(
"^URL".toRegex(),
"/"
)
)
}
} }
data class LinkElement( data class LinkElement(