From 12eec1af68ebe01ad53eaf74d743f9dd502e64f3 Mon Sep 17 00:00:00 2001 From: Zaw <42999156+ImZaw@users.noreply.github.com> Date: Fri, 28 Oct 2022 00:07:28 +0200 Subject: [PATCH] Update FaselHDProvider.kt --- .../kotlin/com/faselhd/FaselHDProvider.kt | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/FaselHDProvider/src/main/kotlin/com/faselhd/FaselHDProvider.kt b/FaselHDProvider/src/main/kotlin/com/faselhd/FaselHDProvider.kt index 01b51a7..12bf37a 100644 --- a/FaselHDProvider/src/main/kotlin/com/faselhd/FaselHDProvider.kt +++ b/FaselHDProvider/src/main/kotlin/com/faselhd/FaselHDProvider.kt @@ -48,7 +48,11 @@ class FaselHD : MainAPI() { override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse { var doc = app.get(request.data + page).document - if(doc.select("title").text() === "Just a moment...") doc = app.get(request.data + page, interceptor = CloudflareKiller()).document + println(doc.select("title").text()) + if(doc.select("title").text() == "Just a moment...") { + println("Found Cloudflare.") + doc = app.get(request.data + page, interceptor = CloudflareKiller()).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() @@ -59,7 +63,11 @@ class FaselHD : MainAPI() { override suspend fun search(query: String): List { val q = query.replace(" ","+") var d = app.get("$mainUrl/?s=$q").document - if(d.select("title").text() === "Just a moment...") d = app.get("$mainUrl/?s=$q", interceptor = CloudflareKiller()).document + println(d.select("title").text()) + if(d.select("title").text() == "Just a moment...") { + println("Found Cloudflare.") + d = app.get("$mainUrl/?s=$q", interceptor = CloudflareKiller()).document + } return d.select("div[id=\"postList\"] div[class=\"col-xl-2 col-lg-2 col-md-3 col-sm-3\"]") .mapNotNull { it.toSearchResponse() @@ -69,7 +77,11 @@ class FaselHD : MainAPI() { override suspend fun load(url: String): LoadResponse { var doc = app.get(url).document - if(doc.select("title").text() === "Just a moment...") doc = app.get(url, interceptor = CloudflareKiller()).document + println(doc.select("title").text()) + if(doc.select("title").text() == "Just a moment...") { + println("Found Cloudflare.") + doc = app.get(url, interceptor = CloudflareKiller()).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") } @@ -121,7 +133,11 @@ class FaselHD : MainAPI() { } doc.select("div[id=\"seasonList\"] div[class=\"col-xl-2 col-lg-3 col-md-6\"] div.seasonDiv") .not(".active").apmap { it -> - val s = app.get("$mainUrl/?p="+it.attr("data-href")).document + var s = app.get("$mainUrl/?p="+it.attr("data-href")).document + if(s.select("title").text() == "Just a moment...") { + println("Found Cloudflare.") + s = app.get("$mainUrl/?p="+it.attr("data-href"), interceptor = CloudflareKiller()).document + } s.select("div.epAll a").map { episodes.add( Episode( @@ -151,7 +167,11 @@ class FaselHD : MainAPI() { callback: (ExtractorLink) -> Unit ): Boolean { var doc = app.get(data).document - if(doc.select("title").text() === "Just a moment...") doc = app.get(data, interceptor = CloudflareKiller()).document + println(doc.select("title").text()) + if(doc.select("title").text() === "Just a moment...") { + println("Found Cloudflare.") + doc = app.get(data, interceptor = CloudflareKiller()).document + } listOf( doc.select(".downloadLinks a").attr("href") to "download", doc.select("iframe[name=\"player_iframe\"]").attr("src") to "iframe"