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

View file

@ -48,7 +48,11 @@ class FaselHD : MainAPI() {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse { override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
var doc = app.get(request.data + page).document 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\"]") 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()
@ -59,7 +63,11 @@ 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(" ","+")
var d = app.get("$mainUrl/?s=$q").document 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\"]") 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()
@ -69,7 +77,11 @@ class FaselHD : MainAPI() {
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
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 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") }
@ -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") doc.select("div[id=\"seasonList\"] div[class=\"col-xl-2 col-lg-3 col-md-6\"] div.seasonDiv")
.not(".active").apmap { it -> .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 { s.select("div.epAll a").map {
episodes.add( episodes.add(
Episode( Episode(
@ -151,7 +167,11 @@ class FaselHD : MainAPI() {
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
): Boolean { ): Boolean {
var doc = app.get(data).document 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( listOf(
doc.select(".downloadLinks a").attr("href") to "download", doc.select(".downloadLinks a").attr("href") to "download",
doc.select("iframe[name=\"player_iframe\"]").attr("src") to "iframe" doc.select("iframe[name=\"player_iframe\"]").attr("src") to "iframe"