From c007fefc1a29e23f707596e8076cfaedc87ce104 Mon Sep 17 00:00:00 2001 From: Zaw <42999156+ImZaw@users.noreply.github.com> Date: Wed, 23 Nov 2022 20:14:16 +0300 Subject: [PATCH] some fixes for some providers egybest still broken --- AnimeBlkomProvider/build.gradle.kts | 2 +- .../com/animeblkom/AnimeBlkomProvider.kt | 41 ++++++++++++++++++- AnimeiatProvider/build.gradle.kts | 2 +- .../kotlin/com/animeiat/AnimeiatProvider.kt | 4 +- .../kotlin/com/egybest/EgyBestProvider.kt | 13 +++--- MovizlandProvider/build.gradle.kts | 4 +- .../kotlin/com/movizland/MovizlandProvider.kt | 40 ++++++++---------- 7 files changed, 68 insertions(+), 38 deletions(-) diff --git a/AnimeBlkomProvider/build.gradle.kts b/AnimeBlkomProvider/build.gradle.kts index bce0be9..d22dcae 100644 --- a/AnimeBlkomProvider/build.gradle.kts +++ b/AnimeBlkomProvider/build.gradle.kts @@ -1,4 +1,4 @@ -version = 1 +version = 2 cloudstream { description = "" diff --git a/AnimeBlkomProvider/src/main/kotlin/com/animeblkom/AnimeBlkomProvider.kt b/AnimeBlkomProvider/src/main/kotlin/com/animeblkom/AnimeBlkomProvider.kt index 08351ea..2da8483 100644 --- a/AnimeBlkomProvider/src/main/kotlin/com/animeblkom/AnimeBlkomProvider.kt +++ b/AnimeBlkomProvider/src/main/kotlin/com/animeblkom/AnimeBlkomProvider.kt @@ -4,6 +4,8 @@ package com.animeblkom import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.Qualities +import com.lagradost.cloudstream3.utils.loadExtractor import org.jsoup.nodes.Element class AnimeBlkom : MainAPI() { @@ -111,11 +113,46 @@ class AnimeBlkom : MainAPI() { callback: (ExtractorLink) -> Unit ): Boolean { val doc = app.get(data).document - doc.select(".panel .panel-body a").forEach { + doc.select("div.item a[data-src]").map { + it.attr("data-src").let { url -> + if(url.startsWith("https://animetitans.net/")) { + val iframe = app.get(url).document + callback.invoke( + ExtractorLink( + this.name, + "Animetitans " + it.text(), + iframe.select("script").last()?.data()?.substringAfter("source: \"")?.substringBefore("\"").toString(), + this.mainUrl, + Qualities.Unknown.value, + isM3u8 = true + ) + ) + } else if(it.text() == "Blkom") { + val iframe = app.get(url).document + iframe.select("source").forEach { source -> + callback.invoke( + ExtractorLink( + this.name, + it.text(), + source.attr("src"), + this.mainUrl, + source.attr("res").toInt() + ) + ) + } + } else { + var sourceUrl = url + if(it.text().contains("Google")) sourceUrl = "http://gdriveplayer.to/embed2.php?link=$url" + loadExtractor(sourceUrl, mainUrl, subtitleCallback, callback) + } + } + } + doc.select(".panel .panel-body a").apmap { + println(it.text()) callback.invoke( ExtractorLink( this.name, - it.attr("title") + " " + it.select("small").text(), + it.attr("title") + " " + it.select("small").text() + " Download Source", it.attr("href"), this.mainUrl, it.text().replace("p.*| ".toRegex(),"").toInt(), diff --git a/AnimeiatProvider/build.gradle.kts b/AnimeiatProvider/build.gradle.kts index 723d77f..73d67b1 100644 --- a/AnimeiatProvider/build.gradle.kts +++ b/AnimeiatProvider/build.gradle.kts @@ -1,4 +1,4 @@ -version = 1 +version = 2 cloudstream { description = "" diff --git a/AnimeiatProvider/src/main/kotlin/com/animeiat/AnimeiatProvider.kt b/AnimeiatProvider/src/main/kotlin/com/animeiat/AnimeiatProvider.kt index 711c343..230bfa3 100644 --- a/AnimeiatProvider/src/main/kotlin/com/animeiat/AnimeiatProvider.kt +++ b/AnimeiatProvider/src/main/kotlin/com/animeiat/AnimeiatProvider.kt @@ -116,7 +116,7 @@ class Animeiat : MainAPI() { ) override suspend fun load(url: String): LoadResponse { val loadSession = Requests() - val request = loadSession.get(url).text + val request = loadSession.get(url.replace(pageUrl, mainUrl)).text val json = parseJson(request) val episodes = arrayListOf() (1..parseJson(loadSession.get("$url/episodes").text).meta.lastPage!!).map { pageNumber -> @@ -134,7 +134,7 @@ class Animeiat : MainAPI() { } } return newAnimeLoadResponse(json.data?.animeName.toString(), "$pageUrl/watch/"+json.data?.slug, if(json.data?.type == "movie") TvType.AnimeMovie else if(json.data?.type == "tv") TvType.Anime else TvType.OVA) { - japName = json.data?.otherNames?.split("\n")?.get(1) + japName = json.data?.otherNames?.replace("\\n.*".toRegex(), "") engName = json.data?.animeName posterUrl = "https://api.animeiat.co/storage/" + json.data?.posterPath this.year = json.data?.year?.name?.toIntOrNull() diff --git a/EgyBestProvider/src/main/kotlin/com/egybest/EgyBestProvider.kt b/EgyBestProvider/src/main/kotlin/com/egybest/EgyBestProvider.kt index 614f172..295e5c7 100644 --- a/EgyBestProvider/src/main/kotlin/com/egybest/EgyBestProvider.kt +++ b/EgyBestProvider/src/main/kotlin/com/egybest/EgyBestProvider.kt @@ -37,7 +37,7 @@ fun String.runJS(variableName: String): String { class EgyBest : MainAPI() { override var lang = "ar" - override var mainUrl = "https://www.egy.best" + override var mainUrl = "https://egybest.org" override var name = "EgyBest" var pssid = "" override val usesWebView = false @@ -60,7 +60,7 @@ class EgyBest : MainAPI() { // If you need to differentiate use the url. return MovieSearchResponse( title, - url, + mainUrl + url, this@EgyBest.name, tvType, posterUrl, @@ -102,9 +102,8 @@ class EgyBest : MainAPI() { } override suspend fun search(query: String): List { - val q = query.replace(" ","%20") val result = arrayListOf() - listOf("$mainUrl/explore/?q=$q").apmap { url -> + listOf("$mainUrl/explore/?q=$query").apmap { url -> val d = app.get(url).document d.select("div.movies a").not("a.auto.load.btn.b").mapNotNull { it.toSearchResponse()?.let { it1 -> result.add(it1) } @@ -118,7 +117,7 @@ class EgyBest : MainAPI() { } override suspend fun load(url: String): LoadResponse { - val doc = app.get(mainUrl + url).document + val doc = app.get(url).document val isMovie = Regex(".*/movie/.*|.*/masrahiya/.*").matches(url) val posterUrl = doc.select("div.movie_img a img")?.attr("src") val year = doc.select("div.movie_title h1 a")?.text()?.toIntOrNull() @@ -172,7 +171,7 @@ class EgyBest : MainAPI() { val ep = Regex("ep-(.....)").find(element.select(".ep_title a").attr("href"))?.groupValues?.getOrNull(1)?.getIntFromText() episodes.add( Episode( - element.select(".ep_title a").attr("href"), + mainUrl + element.select(".ep_title a").attr("href"), name = element.select("td.ep_title").html().replace(".*|".toRegex(), ""), season, ep, @@ -185,7 +184,7 @@ class EgyBest : MainAPI() { val ep = Regex("ep-(.....)").find(eit.attr("href"))?.groupValues?.getOrNull(1)?.getIntFromText() episodes.add( Episode( - eit.attr("href"), + mainUrl + eit.attr("href"), eit.select("span.title").text(), season, ep, diff --git a/MovizlandProvider/build.gradle.kts b/MovizlandProvider/build.gradle.kts index b584a81..a65ff9c 100644 --- a/MovizlandProvider/build.gradle.kts +++ b/MovizlandProvider/build.gradle.kts @@ -1,7 +1,7 @@ -version = 1 +version = 2 cloudstream { - description = "" + description = "Not recommended for series." authors = listOf( "Spoonge" ) language = "ar" diff --git a/MovizlandProvider/src/main/kotlin/com/movizland/MovizlandProvider.kt b/MovizlandProvider/src/main/kotlin/com/movizland/MovizlandProvider.kt index bce6522..43d226c 100644 --- a/MovizlandProvider/src/main/kotlin/com/movizland/MovizlandProvider.kt +++ b/MovizlandProvider/src/main/kotlin/com/movizland/MovizlandProvider.kt @@ -46,7 +46,9 @@ class Movizland : MainAPI() { private fun Element.toSearchResponse(): SearchResponse? { val url = select(".BlockItem") val title = url.select(".BlockTitle").text().cleanTitle() - val posterUrl = if (url.select(".BlockTitle").text().contains("فيلم")) {select(".BlockImageItem img")?.attr("src")} else {select(".BlockImageItem > img:nth-child(3)")?.attr("src")} + val posterUrl = select(".BlockImageItem img")?.attr("src")?.ifEmpty { + select(".BlockImageItem img")[1].attr("src") + } val year = select(".InfoEndBlock li").last()?.text()?.getIntFromText() var quality = select(".RestInformation li").last()?.text()?.replace(" |-|1080p|720p".toRegex(), "") ?.replace("WEB DL","WEBDL")?.replace("BluRay","BLURAY") @@ -76,19 +78,11 @@ class Movizland : MainAPI() { } override suspend fun search(query: String): List { - val q = query.replace(" ".toRegex(), "%20") - val result = arrayListOf() - listOf( - "$mainUrl/category/movies/?s=$q", - "$mainUrl/series/?searching=$q" - ).apmap { url -> - val d = app.get(url).document - d.select("div.BlockItem").mapNotNull { - //if (!it.text().contains("فيلم||موسم")) return@mapNotNull null - it.toSearchResponse()?.let { it1 -> result.add(it1) } - } + val d = app.get("$mainUrl/?s=$query").document + return d.select("div.BlockItem").mapNotNull { + if(it.select(".BlockTitle").text().contains("الحلقة")) return@mapNotNull null; + it.toSearchResponse() } - return result.distinct().sortedBy { it.name } } private fun getSeasonFromString(tit: String): Int { @@ -119,10 +113,12 @@ class Movizland : MainAPI() { override suspend fun load(url: String): LoadResponse { var doc = app.get(url).document val sdetails = doc.select(".SingleDetails") - val posterUrl = sdetails.select("img")?.attr("data-src") + val posterUrl = sdetails.select(".Poster img").attr("data-src").ifEmpty { + sdetails.select(".BlockItem").last()?.select(".Poster img")?.attr("src") + } val year = sdetails.select("li:has(.fa-clock) a").text()?.getIntFromText() val title = doc.select("h2.postTitle").text().cleanTitle() - val isMovie = if(doc.select("h2.postTitle").text().contains("عرض|فيلم".toRegex())) true else false + val isMovie = doc.select("h2.postTitle").text().contains("عرض|فيلم".toRegex()) val synopsis = doc.select("section.story").text() val trailer = doc.select("div.InnerTrailer iframe").attr("data-src") val tags = sdetails.select("li:has(.fa-film) a").map{ it.text() } @@ -147,14 +143,12 @@ class Movizland : MainAPI() { val refererUrl = doc.select("body > header > div > div.Logo > a").attr("href") if(doc.select(".BlockItem a").attr("href").contains("/series/")){//seasons doc.select(".BlockItem").map { seas -> - seas.select("a").attr("href") }.apmap{ - val Sedoc = app.get(it).document - val pagEl = Sedoc.select(".pagination > div > ul > li.active > a").isNotEmpty() - val pagSt = if(pagEl) true else false - if(pagSt){ - Sedoc.select(".pagination > div > ul > li:nth-child(n):not(:last-child) a").map{ eppages -> - eppages.attr("href") }.apmap{ - val epidoc = app.get(it).document + seas.select("a").attr("href") }.apmap{ pageIt -> + val Sedoc = app.get(pageIt).document + val pagEl = Sedoc.select(".pagination > div > ul > li").isNotEmpty() + if(pagEl) { + Sedoc.select(".pagination > div > ul > li:nth-child(n):not(:last-child) a").apmap { + val epidoc = app.get(it.attr("href")).document epidoc.select("div.BlockItem").map{ element -> episodes.add( Episode(