2
1
Fork 1
mirror of https://github.com/yoyzo/arab synced 2024-08-15 03:15:00 +00:00

Update FushaarProvider.kt

This commit is contained in:
Lazycoder 2022-08-22 19:57:15 +02:00 committed by GitHub
parent 13c7e68057
commit 3bb52f67d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,10 +2,8 @@ package com.lagradost.cloudstream3.movieproviders
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.utils.AppUtils
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.Qualities import com.lagradost.cloudstream3.utils.Qualities
import com.lagradost.cloudstream3.utils.getQualityFromName
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
class FushaarProvider : MainAPI() { class FushaarProvider : MainAPI() {
@ -33,17 +31,15 @@ class FushaarProvider : MainAPI() {
url.select("a").attr("href"), url.select("a").attr("href"),
this@FushaarProvider.name, this@FushaarProvider.name,
TvType.Movie, TvType.Movie,
posterUrl.also{print("posterurl :"+it)}, posterUrl,
year, year,
null, null,
quality = getQualityFromString(quality), quality = getQualityFromString(quality),
) )
} }
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse { override val mainPage = mainPageOf(
// Title, Url "Movies" to "$mainUrl" + (0..25).random(),
val moviesUrl = listOf(
"Movies" to "$mainUrl/page/" + (0..25).random(),
"Herror" to "$mainUrl/gerne/herror", "Herror" to "$mainUrl/gerne/herror",
"Thriller" to "$mainUrl/gerne/thriller", "Thriller" to "$mainUrl/gerne/thriller",
"Action" to "$mainUrl/gerne/action", "Action" to "$mainUrl/gerne/action",
@ -62,30 +58,23 @@ class FushaarProvider : MainAPI() {
"Romance" to "$mainUrl/gerne/romance", "Romance" to "$mainUrl/gerne/romance",
"Mystery" to "$mainUrl/gerne/mystery" "Mystery" to "$mainUrl/gerne/mystery"
) )
val pages = moviesUrl.apmap {
val doc = app.get(it.second).document override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val list = doc.select("article.poster").mapNotNull { element -> val doc = app.get(request.data + "/page/$page/").document
element.toSearchResponse() val list = doc.select("article.poster").mapNotNull { element ->
} element.toSearchResponse()
HomePageList(it.first, list) }
}.sortedBy { it.name } return newHomePageResponse(request.name, list)
return HomePageResponse(pages)
} }
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {
val q = query.replace(" ", "%20") val q = query.replace(" ", "%20")
val result = arrayListOf<SearchResponse>() return app.get("$mainUrl/?s=$q").document.select("article.poster").mapNotNull {
listOf( it.toSearchResponse()
"$mainUrl/?s=$q",
).apmap { url ->
val d = app.get(url).document
d.select("article.poster").mapNotNull {
it.toSearchResponse()?.let { it1 -> result.add(it1) }
}
} }
return result.distinct().sortedBy { it.name }
} }
override suspend fun load(url: String): LoadResponse { override suspend fun load(url: String): LoadResponse {
var doc = app.get(url).document var doc = app.get(url).document
val posterUrl = doc.select("figure.poster noscript img").attr("src") val posterUrl = doc.select("figure.poster noscript img").attr("src")
@ -100,9 +89,9 @@ class FushaarProvider : MainAPI() {
title, title,
url, url,
TvType.Movie, TvType.Movie,
"$url" url
) { ) {
this.posterUrl = posterUrl.also{print("posterurl2 :"+it)} this.posterUrl = posterUrl
this.year = year this.year = year
this.tags = tags this.tags = tags
this.plot = synopsis this.plot = synopsis
@ -125,11 +114,11 @@ class FushaarProvider : MainAPI() {
name = name, name = name,
url = it.html().substring(252,384), url = it.html().substring(252,384),
referer = this.mainUrl, referer = this.mainUrl,
quality = 1080, quality = Qualities.Unknown.value,
isM3u8 = true isM3u8 = true
) )
) )
} }
return true return true
} }
} }