From cbe4476d0e9e2d83fe40303da7ee67f6265b9ccd Mon Sep 17 00:00:00 2001 From: antonydp <38143733+antonydp@users.noreply.github.com> Date: Thu, 2 Jun 2022 11:04:29 +0200 Subject: [PATCH] Added two new italian Providers and five new extraxtors (#1111) * Added 3 new extractors and a new italian provider * Added 3 new extractors and a new italian provider * Added 3 new extractors and a new italian provider * Added 4 new extractors and a new italian provider * Added another italian provider Altadefinizione, and a new extractor Supervideo * fix extractor Supervideo * fix extractor Supervideo * fix extractor Userload, fixed pr comments * final fix to the extractor Userload --- .../com/lagradost/cloudstream3/MainAPI.kt | 2 + .../cloudstream3/extractors/DoodExtractor.kt | 4 + .../cloudstream3/extractors/Maxstream.kt | 29 +++ .../cloudstream3/extractors/Supervideo.kt | 41 ++++ .../cloudstream3/extractors/Tantifilm.kt | 42 ++++ .../cloudstream3/extractors/Userload.kt | 117 ++++++++++ .../movieproviders/AltadefinizioneProvider.kt | 148 +++++++++++++ .../movieproviders/Cb01Provider.kt | 207 ++++++++++++++++++ .../cloudstream3/utils/ExtractorApi.kt | 5 + 9 files changed, 595 insertions(+) create mode 100644 app/src/main/java/com/lagradost/cloudstream3/extractors/Maxstream.kt create mode 100644 app/src/main/java/com/lagradost/cloudstream3/extractors/Supervideo.kt create mode 100644 app/src/main/java/com/lagradost/cloudstream3/extractors/Tantifilm.kt create mode 100644 app/src/main/java/com/lagradost/cloudstream3/extractors/Userload.kt create mode 100644 app/src/main/java/com/lagradost/cloudstream3/movieproviders/AltadefinizioneProvider.kt create mode 100644 app/src/main/java/com/lagradost/cloudstream3/movieproviders/Cb01Provider.kt diff --git a/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt b/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt index 57c29dc4..58528038 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt @@ -87,6 +87,8 @@ object APIHolder { TheFlixToProvider(), StreamingcommunityProvider(), TantifilmProvider(), + Cb01Provider(), + AltadefinizioneProvider(), HDMovie5(), RebahinProvider(), LayarKacaProvider(), diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/DoodExtractor.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/DoodExtractor.kt index 3be8f510..eb6bb014 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/DoodExtractor.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/DoodExtractor.kt @@ -11,6 +11,10 @@ class DoodCxExtractor : DoodLaExtractor() { override var mainUrl = "https://dood.cx" } +class DoodShExtractor : DoodLaExtractor() { + override var mainUrl = "https://dood.sh" +} + class DoodPmExtractor : DoodLaExtractor() { override var mainUrl = "https://dood.pm" } diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/Maxstream.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/Maxstream.kt new file mode 100644 index 00000000..51b0827d --- /dev/null +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/Maxstream.kt @@ -0,0 +1,29 @@ +package com.lagradost.cloudstream3.extractors + +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.utils.* + +open class Maxstream : ExtractorApi() { + override var name = "Maxstream" + override var mainUrl = "https://maxstream.video/" + override val requiresReferer = false + override suspend fun getUrl(url: String, referer: String?): List? { + val extractedLinksList: MutableList = mutableListOf() + val response = app.get(url).text + val jstounpack = Regex("cript\">eval((.|\\n)*?)").find(response)?.groups?.get(1)?.value + val unpacjed = JsUnpacker(jstounpack).unpack() + val extractedUrl = unpacjed?.let { Regex("""src:"((.|\n)*?)",type""").find(it) }?.groups?.get(1)?.value.toString() + + M3u8Helper.generateM3u8( + name, + extractedUrl, + url, + headers = mapOf("referer" to url) + ).forEach { link -> + extractedLinksList.add(link) + } + + return extractedLinksList + } +} \ No newline at end of file diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/Supervideo.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/Supervideo.kt new file mode 100644 index 00000000..955345aa --- /dev/null +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/Supervideo.kt @@ -0,0 +1,41 @@ +package com.lagradost.cloudstream3.extractors + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.utils.* +import com.lagradost.cloudstream3.utils.AppUtils.parseJson + +data class Files( + @JsonProperty("file") val id: String, + @JsonProperty("label") val label: String? = null, +) + + open class Supervideo : ExtractorApi() { + override var name = "Supervideo" + override var mainUrl = "https://supervideo.tv" + override val requiresReferer = false + override suspend fun getUrl(url: String, referer: String?): List? { + val extractedLinksList: MutableList = mutableListOf() + val response = app.get(url).text + val jstounpack = Regex("eval((.|\\n)*?)").find(response)?.groups?.get(1)?.value + val unpacjed = JsUnpacker(jstounpack).unpack() + val extractedUrl = unpacjed?.let { Regex("""sources:((.|\n)*?)image""").find(it) }?.groups?.get(1)?.value.toString().replace("file",""""file"""").replace("label",""""label"""").substringBeforeLast(",") + val parsedlinks = parseJson>(extractedUrl) + parsedlinks.forEach { data -> + if (data.label.isNullOrBlank()){ // mp4 links (with labels) are slow. Use only m3u8 link. + M3u8Helper.generateM3u8( + name, + data.id, + url, + headers = mapOf("referer" to url) + ).forEach { link -> + extractedLinksList.add(link) + } + } + } + + + return extractedLinksList + } +} \ No newline at end of file diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/Tantifilm.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/Tantifilm.kt new file mode 100644 index 00000000..d721dea8 --- /dev/null +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/Tantifilm.kt @@ -0,0 +1,42 @@ +package com.lagradost.cloudstream3.extractors + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.utils.ExtractorApi +import com.lagradost.cloudstream3.utils.AppUtils.parseJson +import com.lagradost.cloudstream3.utils.ExtractorLink + +open class Tantifilm : ExtractorApi() { + override var name = "Tantifilm" + override var mainUrl = "https://cercafilm.net" + override val requiresReferer = false + + data class TantifilmJsonData ( + @JsonProperty("success") val success : Boolean, + @JsonProperty("data") val data : List, + @JsonProperty("captions")val captions : List, + @JsonProperty("is_vr") val is_vr : Boolean + ) + + data class TantifilmData ( + @JsonProperty("file") val file : String, + @JsonProperty("label") val label : String, + @JsonProperty("type") val type : String + ) + + override suspend fun getUrl(url: String, referer: String?): List? { + val link = "$mainUrl/api/source/${url.substringAfterLast("/")}" + val response = app.post(link).text.replace("""\""","") + val jsonvideodata = parseJson(response) + return jsonvideodata.data.map { + ExtractorLink( + it.file+".${it.type}", + this.name, + it.file+".${it.type}", + mainUrl, + it.label.filter{ it.isDigit() }.toInt(), + false + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/Userload.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/Userload.kt new file mode 100644 index 00000000..7752b824 --- /dev/null +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/Userload.kt @@ -0,0 +1,117 @@ +package com.lagradost.cloudstream3.extractors + +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.utils.* +import org.mozilla.javascript.Context +import org.mozilla.javascript.EvaluatorException +import org.mozilla.javascript.Scriptable +import java.util.* + + +open class Userload : ExtractorApi() { + override var name = "Userload" + override var mainUrl = "https://userload.co" + override val requiresReferer = false + + private fun splitInput(input: String): List { + var counter = 0 + val array = ArrayList() + var buffer = "" + for (c in input) { + when (c) { + '(' -> counter++ + ')' -> counter-- + else -> {} + } + buffer += c + if (counter == 0) { + if (buffer.isNotBlank() && buffer != "+") + array.add(buffer) + buffer = "" + } + } + return array + } + + private fun evaluateMath(mathExpression : String): String { + val rhino = Context.enter() + rhino.initStandardObjects() + rhino.optimizationLevel = -1 + val scope: Scriptable = rhino.initStandardObjects() + return try { + rhino.evaluateString(scope, "eval($mathExpression)", "JavaScript", 1, null).toString() + } + catch (e: EvaluatorException){ + "" + } + } + + private fun decodeVideoJs(text: String): List { + text.replace("""\s+|/\*.*?\*/""".toRegex(), "") + val data = text.split("""+(゚Д゚)[゚o゚]""")[1] + val chars = data.split("""+ (゚Д゚)[゚ε゚]+""").drop(1) + val newchars = chars.map { char -> + char.replace("(o゚ー゚o)", "u") + .replace("c", "0") + .replace("(゚Д゚)['0']", "c") + .replace("゚Θ゚", "1") + .replace("!+[]", "1") + .replace("-~", "1+") + .replace("o", "3") + .replace("_", "3") + .replace("゚ー゚", "4") + .replace("(+", "(") + } + + val subchar = mutableListOf() + + newchars.dropLast(1).forEach { v -> + subchar.add(splitInput(v).map { evaluateMath(it).substringBefore(".") }.toString().filter { it.isDigit() }) + } + var txtresult = "" + subchar.forEach{ + txtresult = txtresult.plus(Char(it.toInt(8))) + } + val val1 = Regex(""""morocco="((.|\\n)*?)"&mycountry="""").find(txtresult)?.groups?.get(1)?.value.toString().drop(1).dropLast(1) + val val2 = txtresult.substringAfter("""&mycountry="+""").substringBefore(")") + + return listOf( + val1, + val2 + ) + + + } + + override suspend fun getUrl(url: String, referer: String?): List? { + + val extractedLinksList: MutableList = mutableListOf() + + val response = app.get(url).text + val jsToUnpack = Regex("ext/javascript\">eval((.|\\n)*?)").find(response)?.groups?.get(1)?.value + val unpacked = JsUnpacker(jsToUnpack).unpack() + val videoJs = app.get("$mainUrl/api/assets/userload/js/videojs.js") + val videoJsToDecode = videoJs.text + val values = decodeVideoJs(videoJsToDecode) + val morocco = unpacked!!.split(";").filter { it.contains(values[0]) }[0].split("=")[1].drop(1).dropLast(1) + val mycountry = unpacked.split(";").filter { it.contains(values[1]) }[0].split("=")[1].drop(1).dropLast(1) + val videoLinkPage = app.post("$mainUrl/api/request/", data = mapOf( + "morocco" to morocco, + "mycountry" to mycountry + )) + val videoLink = videoLinkPage.text + val nameSource = app.get(url).document.head().selectFirst("title")!!.text() + extractedLinksList.add( + ExtractorLink( + name, + name, + videoLink, + mainUrl, + getQualityFromName(nameSource), + ) + ) + + return extractedLinksList + } +} \ No newline at end of file diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/AltadefinizioneProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/AltadefinizioneProvider.kt new file mode 100644 index 00000000..16730b67 --- /dev/null +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/AltadefinizioneProvider.kt @@ -0,0 +1,148 @@ +package com.lagradost.cloudstream3.movieproviders + +import androidx.core.text.parseAsHtml +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.mvvm.logError +import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.utils.* + +class AltadefinizioneProvider : MainAPI() { + override val lang = "it" + override var mainUrl = "https://altadefinizione.limo" + override var name = "Altadefinizione" + override val hasMainPage = true + override val hasChromecastSupport = true + override val supportedTypes = setOf( + TvType.Movie + ) + + override suspend fun getMainPage(): HomePageResponse { + val items = ArrayList() + val urls = listOf( + Pair("$mainUrl/azione/", "Azione"), + Pair("$mainUrl/avventura/", "Avventura"), + ) + for ((url, name) in urls) { + try { + val soup = app.get(url).document + val home = soup.select("div.box").map { + val title = it.selectFirst("img")!!.attr("alt") + val link = it.selectFirst("a")!!.attr("href") + val image = mainUrl + it.selectFirst("img")!!.attr("src") + val quality = getQualityFromString(it.selectFirst("span")!!.text()) + + MovieSearchResponse( + title, + link, + this.name, + TvType.Movie, + image, + null, + null, + quality, + ) + } + + items.add(HomePageList(name, home)) + } catch (e: Exception) { + logError(e) + } + } + if (items.size <= 0) throw ErrorLoadingException() + return HomePageResponse(items) + } + + override suspend fun search(query: String): List { + val doc = app.post("$mainUrl/index.php?do=search", data = mapOf( + "subaction" to "search", + "story" to query + )).document + return doc.select("div.box").map { + val title = it.selectFirst("img")!!.attr("alt") + val link = it.selectFirst("a")!!.attr("href") + val image = mainUrl+it.selectFirst("img")!!.attr("src") + val quality = getQualityFromString(it.selectFirst("span")!!.text()) + + MovieSearchResponse( + title, + link, + this.name, + TvType.Movie, + image, + null, + null, + quality, + ) + } + } + + override suspend fun load(url: String): LoadResponse { + val page = app.get(url) + val document = page.document + val title = document.selectFirst(" h1 > a")!!.text() + val description = document.select("#sfull").toString().substringAfter("altadefinizione").substringBeforeLast("fonte trama").parseAsHtml().toString() + val rating = null + + val year = document.selectFirst("#details > li:nth-child(2)")!!.childNode(2).toString().filter { it.isDigit() }.toInt() + + val poster = fixUrl(document.selectFirst("div.thumbphoto > img")!!.attr("src")) + + val recomm = document.select("ul.related-list > li").map { + val href = it.selectFirst("a")!!.attr("href") + val posterUrl = mainUrl + it.selectFirst("img")!!.attr("src") + val name = it.selectFirst("img")!!.attr("alt") + MovieSearchResponse( + name, + href, + this.name, + TvType.Movie, + posterUrl, + null + ) + + } + + return newMovieLoadResponse( + title, + url, + TvType.Movie, + url + ) { + posterUrl = fixUrlNull(poster) + this.year = year + this.plot = description + this.rating = rating + this.recommendations = recomm + this.duration = null + + } + } + + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + val doc = app.get(data).document + if (doc.select("div.guardahd-player").isNullOrEmpty()){ + val videoUrl = doc.select("input").filter { it.hasAttr("data-mirror") }.last().attr("value") + loadExtractor(videoUrl, data, callback) + doc.select("#mirrors > li > a").forEach { + loadExtractor(fixUrl(it.attr("data-target")), data, callback) + } + } + else{ + val pagelinks = doc.select("div.guardahd-player").select("iframe").attr("src") + val docLinks = app.get(pagelinks).document + docLinks.select("body > div > ul > li").forEach { + loadExtractor(fixUrl(it.attr("data-link")), data, callback) + } + } + + + + return true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/Cb01Provider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/Cb01Provider.kt new file mode 100644 index 00000000..90e25428 --- /dev/null +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/Cb01Provider.kt @@ -0,0 +1,207 @@ +package com.lagradost.cloudstream3.movieproviders + +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.mvvm.logError +import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.utils.* + +class Cb01Provider : MainAPI() { + override val lang = "it" + override var mainUrl = "https://cb01.rip" + override var name = "Cineblog01" + override val hasMainPage = true + override val hasChromecastSupport = true + override val supportedTypes = setOf( + TvType.Movie, + TvType.TvSeries, + ) + + override suspend fun getMainPage(): HomePageResponse { + val items = ArrayList() + val urls = listOf( + Pair("$mainUrl/genere/azione/", "Azione"), + Pair("$mainUrl/genere/avventura/", "Avventura"), + ) + for ((url, name) in urls) { + try { + val soup = app.get(url).document + val home = soup.select("article.item.movies").map { + val title = it.selectFirst("div.data > h3 > a")!!.text().substringBefore("(") + val link = it.selectFirst("div.poster > a")!!.attr("href") + TvSeriesSearchResponse( + title, + link, + this.name, + TvType.Movie, + it.selectFirst("img")!!.attr("src"), + null, + null, + ) + } + + items.add(HomePageList(name, home)) + } catch (e: Exception) { + logError(e) + } + } + try { + val soup = app.get("$mainUrl/serietv/").document + val home = soup.select("article.item.tvshows").map { + val title = it.selectFirst("div.data > h3 > a")!!.text().substringBefore("(") + val link = it.selectFirst("div.poster > a")!!.attr("href") + TvSeriesSearchResponse( + title, + link, + this.name, + TvType.Movie, + it.selectFirst("img")!!.attr("src"), + null, + null, + ) + } + + items.add(HomePageList("Serie tv", home)) + } catch (e: Exception) { + logError(e) + } + + if (items.size <= 0) throw ErrorLoadingException() + return HomePageResponse(items) + } + + override suspend fun search(query: String): List { + val queryformatted = query.replace(" ", "+") + val url = "$mainUrl?s=$queryformatted" + val doc = app.get(url,referer= mainUrl ).document + return doc.select("div.result-item").map { + val href = it.selectFirst("div.image > div > a")!!.attr("href") + val poster = it.selectFirst("div.image > div > a > img")!!.attr("src") + val name = it.selectFirst("div.details > div.title > a")!!.text().substringBefore("(") + MovieSearchResponse( + name, + href, + this.name, + TvType.Movie, + poster, + null + ) + + } + } + + override suspend fun load(url: String): LoadResponse { + val page = app.get(url) + val document = page.document + val type = if (url.contains("film")) TvType.Movie else TvType.TvSeries + val title = document.selectFirst("div.data > h1")!!.text().substringBefore("(") + val description = document.select("#info > div.wp-content > p").html().toString() + val rating = null + + var year = document.selectFirst(" div.data > div.extra > span.date")!!.text().substringAfter(",") + .filter { it.isDigit() } + if (year.length > 4) { + year = year.dropLast(4) + } + + val poster = document.selectFirst("div.poster > img")!!.attr("src") + + val recomm = document.select("#single_relacionados >article").map { + val href = it.selectFirst("a")!!.attr("href") + val posterUrl = it.selectFirst("a > img")!!.attr("src") + val name = it.selectFirst("a > img")!!.attr("alt").substringBeforeLast("(") + MovieSearchResponse( + name, + href, + this.name, + TvType.Movie, + posterUrl, + null + ) + + } + + + + if (type == TvType.TvSeries) { + + val episodeList = ArrayList() + document.select("#seasons > div").reversed().map { element -> + val season = element.selectFirst("div.se-q > span.se-t")!!.text().toInt() + element.select("div.se-a > ul > li").map{ episode -> + val href = episode.selectFirst("div.episodiotitle > a")!!.attr("href") + val epNum =episode.selectFirst("div.numerando")!!.text().substringAfter("-").filter { it.isDigit() }.toIntOrNull() + val epTitle = episode.selectFirst("div.episodiotitle > a")!!.text() + val posterUrl = episode.selectFirst("div.imagen > img")!!.attr("src") + episodeList.add( + Episode( + href, + epTitle, + season, + epNum, + posterUrl, + ) + ) + } + } + return TvSeriesLoadResponse( + title, + url, + this.name, + type, + episodeList, + fixUrlNull(poster), + year.toIntOrNull(), + description, + null, + rating, + null, + null, + null, + recomm + ) + } else { + + return newMovieLoadResponse( + title, + url, + type, + url + ) { + posterUrl = fixUrlNull(poster) + this.year = year.toIntOrNull() + this.plot = description + this.rating = rating + this.recommendations = recomm + this.duration = null + + } + } + } + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + val doc = app.get(data).document + val type = if( data.contains("film") ){"movie"} else {"tv"} + val idpost=doc.select("#player-option-1").attr("data-post") + val test = app.post("$mainUrl/wp-admin/admin-ajax.php", headers = mapOf( + "content-type" to "application/x-www-form-urlencoded; charset=UTF-8", + "accept" to "*/*", + "X-Requested-With" to "XMLHttpRequest", + ), data = mapOf( + "action" to "doo_player_ajax", + "post" to idpost, + "nume" to "1", + "type" to type, + )) + + val url2= Regex("""src='((.|\\n)*?)'""").find(test.text)?.groups?.get(1)?.value.toString() + val trueUrl = app.get(url2, headers = mapOf("referer" to mainUrl)).url + loadExtractor(trueUrl, data, callback) + + return true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt index 18bc55ca..9fc6491d 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt @@ -172,6 +172,7 @@ val extractorApis: Array = arrayOf( DoodSoExtractor(), DoodLaExtractor(), DoodWsExtractor(), + DoodShExtractor(), AsianLoad(), @@ -181,6 +182,10 @@ val extractorApis: Array = arrayOf( ZplayerV2(), Upstream(), + Maxstream(), + Tantifilm(), + Userload(), + Supervideo(), // StreamSB.kt works // SBPlay(),