shahid4u fix, and maybe faselhd cf fix

This commit is contained in:
Zaw 2022-10-28 00:21:41 +03:00
parent 7a98c5100e
commit 3ec8dc1903
4 changed files with 13 additions and 9 deletions

View file

@ -1,4 +1,4 @@
version = 4 version = 5
cloudstream { cloudstream {
description = "" description = ""

View file

@ -47,7 +47,8 @@ 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).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
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()
@ -57,7 +58,8 @@ 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").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
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()
@ -66,7 +68,8 @@ class FaselHD : MainAPI() {
override suspend fun load(url: String): LoadResponse { override suspend fun load(url: String): LoadResponse {
val 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
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") }
@ -147,14 +150,14 @@ class FaselHD : MainAPI() {
subtitleCallback: (SubtitleFile) -> Unit, subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
): Boolean { ): Boolean {
val 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
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"
).apmap { (url, method) -> ).apmap { (url, method) ->
if(method == "download") { if(method == "download") {
val player = app.post(url, interceptor = CloudflareKiller(), referer = mainUrl).document val player = app.post(url, interceptor = CloudflareKiller(), referer = mainUrl).document
callback.invoke( callback.invoke(
ExtractorLink( ExtractorLink(
this.name, this.name,

View file

@ -1,4 +1,4 @@
version = 4 version = 5
cloudstream { cloudstream {
description = "" description = ""

View file

@ -8,7 +8,7 @@ import org.jsoup.nodes.Element
class Shahid4u : MainAPI() { class Shahid4u : MainAPI() {
override var lang = "ar" override var lang = "ar"
override var mainUrl = "https://shahid4u.cc" override var mainUrl = "https://shahed4u.network"
override var name = "Shahid4u" override var name = "Shahid4u"
override val usesWebView = false override val usesWebView = false
override val hasMainPage = true override val hasMainPage = true
@ -38,7 +38,7 @@ class Shahid4u : MainAPI() {
) )
} }
override val mainPage = mainPageOf( override val mainPage = mainPageOf(
"$mainUrl/movies-2/page/" to "Movies", "$mainUrl/movies-3/page/" to "Movies",
"$mainUrl/netflix/page/" to "Series & Anime", "$mainUrl/netflix/page/" to "Series & Anime",
) )
@ -46,6 +46,7 @@ class Shahid4u : MainAPI() {
val doc = app.get(request.data + page).document val doc = app.get(request.data + page).document
val list = doc.select("div.content-box") val list = doc.select("div.content-box")
.mapNotNull { element -> .mapNotNull { element ->
println(element.select("a.fullClick").attr("title"))
element.toSearchResponse() element.toSearchResponse()
} }
return newHomePageResponse(request.name, list) return newHomePageResponse(request.name, list)