fix vizjer

This commit is contained in:
C10udburst 2022-08-17 16:40:34 +02:00
parent bb71152e31
commit 5b9e6cdc6d
2 changed files with 13 additions and 14 deletions

View file

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

View file

@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
import android.util.Log
import com.lagradost.cloudstream3.utils.loadExtractor import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.Jsoup import org.jsoup.Jsoup
import org.jsoup.select.Elements import org.jsoup.select.Elements
@ -27,10 +26,11 @@ class VizjerProvider : MainAPI() {
for (l in lists) { for (l in lists) {
val title = capitalizeString(l.parent()!!.select("h3").text().lowercase()) val title = capitalizeString(l.parent()!!.select("h3").text().lowercase())
val items = l.select(".poster").map { i -> val items = l.select(".poster").map { i ->
val name = i.select("a[href]").attr("title") val a = i.parent()!!
val href = i.select("a[href]").attr("href") val name = a.attr("title")
val href = a.attr("href")
val poster = i.select("img[src]").attr("src") val poster = i.select("img[src]").attr("src")
val year = l.select(".year").text().toIntOrNull() val year = a.select(".year").text().toIntOrNull()
MovieSearchResponse( MovieSearchResponse(
name, name,
properUrl(href)!!, properUrl(href)!!,
@ -48,7 +48,6 @@ class VizjerProvider : MainAPI() {
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {
val url = "$mainUrl/wyszukaj?phrase=$query" val url = "$mainUrl/wyszukaj?phrase=$query"
val document = app.get(url).document val document = app.get(url).document
Log.d("vizjer", document.toString())
val lists = document.select("#advanced-search > div") val lists = document.select("#advanced-search > div")
val movies = lists[1].select("div:not(.clearfix)") val movies = lists[1].select("div:not(.clearfix)")
val series = lists[3].select("div:not(.clearfix)") val series = lists[3].select("div:not(.clearfix)")
@ -62,15 +61,15 @@ class VizjerProvider : MainAPI() {
if (type === TvType.TvSeries) { if (type === TvType.TvSeries) {
TvSeriesSearchResponse( TvSeriesSearchResponse(
name, name,
properUrl(href) ?: "", properUrl(href)!!,
this.name, this.name,
type, type,
properUrl(img) ?: "", properUrl(img)!!,
null, null,
null null
) )
} else { } else {
MovieSearchResponse(name, properUrl(href) ?: "", this.name, type, properUrl(img) ?: "", null) MovieSearchResponse(name, properUrl(href)!!, this.name, type, properUrl(img)!!, null)
} }
} }
} }
@ -91,9 +90,9 @@ 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, properUrl(url) ?: "", name, TvType.Movie, data, properUrl(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 ->
val e = episode.text() val e = episode.text()
val regex = Regex("""\[s(\d{1,3})e(\d{1,3})]""").find(e) ?: return@mapNotNull null val regex = Regex("""\[s(\d{1,3})e(\d{1,3})]""").find(e) ?: return@mapNotNull null
@ -108,11 +107,11 @@ class VizjerProvider : MainAPI() {
return TvSeriesLoadResponse( return TvSeriesLoadResponse(
title, title,
properUrl(url) ?: "", properUrl(url)!!,
name, name,
TvType.TvSeries, TvType.TvSeries,
episodes, episodes,
properUrl(posterUrl) ?: "", properUrl(posterUrl)!!,
null, null,
plot plot
) )
@ -127,7 +126,7 @@ class VizjerProvider : MainAPI() {
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")) else if (data.startsWith("URL"))
app.get(properUrl(data) ?: "").document.select("#link-list").first() 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 ->