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