Update FaselHDProvider.kt

This commit is contained in:
Zaw 2022-10-28 00:07:28 +02:00 committed by GitHub
parent 400c80afcd
commit 12eec1af68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 5 deletions

View File

@ -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<SearchResponse> {
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"