Skip to content

Commit

Permalink
Cuevana Added
Browse files Browse the repository at this point in the history
  • Loading branch information
Stormunblessed committed Feb 2, 2022
1 parent 7d3c317 commit b43fcd8
Show file tree
Hide file tree
Showing 11 changed files with 379 additions and 240 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ android {
targetSdkVersion 30

versionCode 42
versionName "2.7.0"
versionName "2.7.1"

resValue "string", "app_version",
"${defaultConfig.versionName}${versionNameSuffix ?: ""}"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ object APIHolder {
AnimeonlineProvider(),
AsianLoadProvider(),
CinecalidadProvider(),
CuevanathreeProvider(),
DoramasYTProvider(),
DramaSeeProvider(),
DubbedAnimeProvider(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ import com.lagradost.cloudstream3.TvType
class AnimeIDProvider : AnimeIDProviderTemplate() {
override val lang = "es"
// mainUrl is good to have as a holder for the url to make future changes easier.
override val mainUrl: String
get() = "https://animeid.to"
override val mainUrl = "https://animeid.to"

// name is for how the provider will be named which is visible in the UI, no real rules for this.
override val name: String
get() = "AnimeID"
override val name = "AnimeID"

override val homePageUrlList: List<String> = listOf(
"$mainUrl/movies",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ import kotlin.collections.ArrayList

class AnimefenixProvider:MainAPI() {


override val mainUrl: String
get() = "https://animefenix.com"
override val name: String
get() = "Animefenix"
override val mainUrl = "https://animefenix.com"
override val name = "Animefenix"
override val lang = "es"
override val hasMainPage = true
override val hasChromecastSupport = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import java.util.*
import kotlin.collections.ArrayList

class AnimeflvIOProvider:MainAPI() {
override val mainUrl: String
get() = "https://animeflv.io"
override val name: String
get() = "Animeflv.io"
override val mainUrl = "https://animeflv.io"
override val name = "Animeflv.io"
override val lang = "es"
override val hasMainPage = true
override val hasChromecastSupport = true
Expand All @@ -21,7 +19,6 @@ class AnimeflvIOProvider:MainAPI() {
TvType.OVA,
TvType.Anime,
)

override suspend fun getMainPage(): HomePageResponse {
val items = ArrayList<HomePageList>()
val urls = listOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import java.util.*
import kotlin.collections.ArrayList

class AnimeonlineProvider:MainAPI() {
override val mainUrl: String
get() = "https://animeonline1.ninja"
override val name: String
get() = "Animeonline"
override val mainUrl = "https://animeonline1.ninja"
override val name = "Animeonline"
override val lang = "es"
override val hasMainPage = true
override val hasChromecastSupport = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
package com.lagradost.cloudstream3.movieproviders

import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.module.kotlin.readValue
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.extractors.Evoload
import com.lagradost.cloudstream3.extractors.FEmbed
import com.lagradost.cloudstream3.extractors.StreamTape
import com.lagradost.cloudstream3.utils.*
import java.util.*

class CuevanathreeProvider:MainAPI() {
override val mainUrl: String
get() = "https://cuevana3.io"
override val name: String
get() = "Cuevana"
override val mainUrl = "https://cuevana3.io"
override val name = "Cuevana"
override val lang = "es"
override val hasMainPage = true
override val hasChromecastSupport = true
Expand All @@ -20,15 +17,12 @@ class CuevanathreeProvider:MainAPI() {
TvType.Movie,
TvType.TvSeries,
)
override val vpnStatus = VPNStatus.MightBeNeeded //Due to evoload sometimes not loading

override suspend fun getMainPage(): HomePageResponse {
val items = ArrayList<HomePageList>()
val urls = listOf(
Pair("$mainUrl", "Recientemente actualizadas"),
Pair(mainUrl, "Recientemente actualizadas"),
Pair("$mainUrl/estrenos/", "Estrenos"),
)

for (i in urls) {
try {
val soup = app.get(i.first).document
Expand All @@ -55,7 +49,6 @@ class CuevanathreeProvider:MainAPI() {
if (items.size <= 0) throw ErrorLoadingException()
return HomePageResponse(items)
}

override suspend fun search(query: String): List<SearchResponse> {
val url = "$mainUrl/?s=${query}"
val document = app.get(url).document
Expand Down Expand Up @@ -88,22 +81,20 @@ class CuevanathreeProvider:MainAPI() {
}
}
}

override suspend fun load(url: String): LoadResponse? {
val soup = app.get(url, timeout = 120).document

val title = soup.selectFirst("h1.Title").text()
val description = soup.selectFirst(".Description p")?.text()?.trim()
val poster: String? = soup.selectFirst(".movtv-info div.Image img").attr("data-src")
val episodes = soup.select(".TPostMv article").map { li ->
val year1 = soup.selectFirst("footer p.meta").toString()
val yearRegex = Regex("(\\d+)<\\/span>")
val year = yearRegex.findAll(year1).map {
it.value.replace("</span>","")
}.toList().first().toIntOrNull()
val episodes = soup.select(".all-episodes li.TPostMv article").map { li ->
val href = li.select("a").attr("href")
val epThumb = try {
li.select("img.lazy").attr("src")
} catch (e: Exception) {
li.select("img.lazy").attr("data-src")
} catch (e: Exception) {
li.select("div.Image img").attr("data-src")
}
val epThumb =
li.selectFirst("div.Image img").attr("data-src") ?: li.selectFirst("img.lazy").attr("data-srcc")
val name = li.selectFirst("h2.Title").text()
TvSeriesEpisode(
name,
Expand All @@ -122,7 +113,7 @@ class CuevanathreeProvider:MainAPI() {
tvType,
episodes,
poster,
null,
year,
description,
)
}
Expand All @@ -134,12 +125,144 @@ class CuevanathreeProvider:MainAPI() {
tvType,
url,
poster,
null,
year,
description,
)
}
else -> null
}
}

data class Femcuevana(
@JsonProperty("url") val url: String,
)
override suspend fun loadLinks(
data: String,
isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
app.get(data).document.select("div.TPlayer.embed_div iframe").apmap {
val iframe = fixUrl(it.attr("data-src"))
if (iframe.contains("api.cuevana3.io/fembed/")) {
val femregex = Regex("(https.\\/\\/api\\.cuevana3\\.io\\/fembed\\/\\?h=[a-zA-Z0-9]{0,8}[a-zA-Z0-9_-]+)")
femregex.findAll(iframe).map { femreg ->
femreg.value
}.toList().apmap { fem ->
val key = fem.replace("https://api.cuevana3.io/fembed/?h=","")
val url = app.post("https://api.cuevana3.io/fembed/api.php", allowRedirects = false, headers = mapOf("Host" to "api.cuevana3.io",
"User-Agent" to USER_AGENT,
"Accept" to "application/json, text/javascript, */*; q=0.01",
"Accept-Language" to "en-US,en;q=0.5",
"Content-Type" to "application/x-www-form-urlencoded; charset=UTF-8",
"X-Requested-With" to "XMLHttpRequest",
"Origin" to "https://api.cuevana3.io",
"DNT" to "1",
"Connection" to "keep-alive",
"Sec-Fetch-Dest" to "empty",
"Sec-Fetch-Mode" to "cors",
"Sec-Fetch-Site" to "same-origin",),
data = mapOf(Pair("h",key))).text
val json = mapper.readValue<Femcuevana>(url)
val link = json.url
if (link.contains("fembed")) {
for (extractor in extractorApis) {
if (link.startsWith(extractor.mainUrl)) {
extractor.getSafeUrl(link, data)?.apmap { final ->
callback(final)
}
}
}
}
}
}
if (iframe.contains("tomatomatela")) {
val tomatoRegex = Regex("(\\/\\/apialfa.tomatomatela.com\\/ir\\/player.php\\?h=[a-zA-Z0-9]{0,8}[a-zA-Z0-9_-]+)")
tomatoRegex.findAll(iframe).map { tomreg ->
tomreg.value
}.toList().apmap { tom ->
val tomkey = tom.replace("//apialfa.tomatomatela.com/ir/player.php?h=","")
app.post("https://apialfa.tomatomatela.com/ir/rd.php", allowRedirects = false,
headers = mapOf("Host" to "apialfa.tomatomatela.com",
"User-Agent" to USER_AGENT,
"Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Accept-Language" to "en-US,en;q=0.5",
"Content-Type" to "application/x-www-form-urlencoded",
"Origin" to "null",
"DNT" to "1",
"Connection" to "keep-alive",
"Upgrade-Insecure-Requests" to "1",
"Sec-Fetch-Dest" to "iframe",
"Sec-Fetch-Mode" to "navigate",
"Sec-Fetch-Site" to "same-origin",),
data = mapOf(Pair("url",tomkey))
).response.headers.values("location").apmap { loc ->
if (loc.contains("goto_ddh.php")) {
val gotoregex = Regex("(\\/\\/api.cuevana3.io\\/ir\\/goto_ddh.php\\?h=[a-zA-Z0-9]{0,8}[a-zA-Z0-9_-]+)")
gotoregex.findAll(loc).map { goreg ->
goreg.value.replace("//api.cuevana3.io/ir/goto_ddh.php?h=","")
}.toList().apmap { gotolink ->
app.post("https://api.cuevana3.io/ir/redirect_ddh.php", allowRedirects = false,
headers = mapOf("Host" to "api.cuevana3.io",
"User-Agent" to "Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0",
"Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Accept-Language" to "en-US,en;q=0.5",
"Content-Type" to "application/x-www-form-urlencoded",
"Origin" to "null",
"DNT" to "1",
"Connection" to "keep-alive",
"Upgrade-Insecure-Requests" to "1",
"Sec-Fetch-Dest" to "iframe",
"Sec-Fetch-Mode" to "navigate",
"Sec-Fetch-Site" to "same-origin",),
data = mapOf(Pair("url",gotolink))
).response.headers.values("location").apmap { golink ->
for (extractor in extractorApis) {
if (golink.startsWith(extractor.mainUrl)) {
extractor.getSafeUrl(golink, data)?.apmap { final ->
callback(final)
}
}
}
}
}
}
if (loc.contains("index.php?h=")) {
val indexRegex = Regex("(\\/\\/api.cuevana3.io\\/sc\\/index.php\\?h=[a-zA-Z0-9]{0,8}[a-zA-Z0-9_-]+)")
indexRegex.findAll(loc).map { indreg ->
indreg.value.replace("//api.cuevana3.io/sc/index.php?h=","")
}.toList().apmap { inlink ->
app.post("https://api.cuevana3.io/sc/r.php", allowRedirects = false,
headers = mapOf("Host" to "api.cuevana3.io",
"User-Agent" to USER_AGENT,
"Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Accept-Language" to "en-US,en;q=0.5",
"Accept-Encoding" to "gzip, deflate, br",
"Content-Type" to "application/x-www-form-urlencoded",
"Origin" to "null",
"DNT" to "1",
"Connection" to "keep-alive",
"Upgrade-Insecure-Requests" to "1",
"Sec-Fetch-Dest" to "iframe",
"Sec-Fetch-Mode" to "navigate",
"Sec-Fetch-Site" to "same-origin",
"Sec-Fetch-User" to "?1",),
data = mapOf(Pair("h",inlink))
).response.headers.values("location").apmap { link ->
for (extractor in extractorApis) {
if (link.startsWith(extractor.mainUrl)) {
extractor.getSafeUrl(link, data)?.apmap { final ->
callback(final)
}
}
}
}
}
}
}
}
}
}
return true
}
}
Loading

0 comments on commit b43fcd8

Please sign in to comment.