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

fix faselhd third time

This commit is contained in:
Zaw 2022-08-21 22:18:58 +03:00 committed by GitHub
parent 4bb2bd36dd
commit 93fa22e151
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,7 @@ package com.faselhd
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.network.CloudflareKiller
import com.lagradost.cloudstream3.utils.Qualities
import org.jsoup.nodes.Element
class FaselHD : MainAPI() {
@ -13,8 +14,8 @@ class FaselHD : MainAPI() {
override val usesWebView = false
override val hasMainPage = true
override val supportedTypes = setOf(TvType.TvSeries, TvType.Movie, TvType.AsianDrama, TvType.Anime)
val cfKiller = CloudflareKiller()
val cfKiller = CloudflareKiller()
private fun String.getIntFromText(): Int? {
return Regex("""\d+""").find(this)?.groupValues?.firstOrNull()?.toIntOrNull()
}
@ -44,7 +45,7 @@ class FaselHD : MainAPI() {
)
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val doc = app.get(request.data + page, interceptor = cfKiller).document
val doc = app.get(request.data + page).document
val list = doc.select("div[id=\"postList\"] div[class=\"col-xl-2 col-lg-2 col-md-3 col-sm-3\"]")
.mapNotNull { element ->
element.toSearchResponse()
@ -54,7 +55,7 @@ class FaselHD : MainAPI() {
override suspend fun search(query: String): List<SearchResponse> {
val q = query.replace(" ","+")
val d = app.get("$mainUrl/?s=$q", interceptor = cfKiller).document
val d = app.get("$mainUrl/?s=$q").document
return d.select("div[id=\"postList\"] div[class=\"col-xl-2 col-lg-2 col-md-3 col-sm-3\"]")
.mapNotNull {
it.toSearchResponse()
@ -63,7 +64,7 @@ class FaselHD : MainAPI() {
override suspend fun load(url: String): LoadResponse {
val doc = app.get(url, interceptor = cfKiller).document
val doc = app.get(url).document
val isMovie = doc.select("div.epAll").isEmpty()
val posterUrl = doc.select("div.posterImg img").attr("src")
.ifEmpty { doc.select("div.seasonDiv.active img").attr("data-src") }
@ -144,7 +145,7 @@ class FaselHD : MainAPI() {
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
val player = app.get(app.get(data, interceptor = cfKiller).document.select("iframe[name=\"player_iframe\"]").attr("src"), interceptor = cfKiller).document
val player = app.get(app.get(data).document.select("iframe[name=\"player_iframe\"]").attr("src"), interceptor = cfKiller).document
player.select("div.quality_change button.hd_btn").map {
callback.invoke(
ExtractorLink(
@ -152,7 +153,7 @@ class FaselHD : MainAPI() {
this.name,
it.attr("data-url"),
this.mainUrl,
quality = it.text().getIntFromText() ?: 0,
quality = it.text().getIntFromText() ?: Qualities.Unknown.value,
isM3u8 = true
)
)