made inf scrolling better + fixed search bug

This commit is contained in:
LagradOst 2022-07-30 18:56:41 +02:00
parent a6d2361b52
commit 53fa4ca33f
10 changed files with 298 additions and 303 deletions

View file

@ -167,7 +167,7 @@ class GogoanimeProvider : MainAPI() {
} }
} }
override var mainUrl = "https://gogoanime.sk" override var mainUrl = "https://gogoanime.lu"
override var name = "GogoAnime" override var name = "GogoAnime"
override val hasQuickSearch = false override val hasQuickSearch = false
override val hasMainPage = true override val hasMainPage = true
@ -178,7 +178,6 @@ class GogoanimeProvider : MainAPI() {
TvType.OVA TvType.OVA
) )
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
val headers = mapOf( val headers = mapOf(
"authority" to "ajax.gogo-load.com", "authority" to "ajax.gogo-load.com",
"sec-ch-ua" to "\"Google Chrome\";v=\"89\", \"Chromium\";v=\"89\", \";Not A Brand\";v=\"99\"", "sec-ch-ua" to "\"Google Chrome\";v=\"89\", \"Chromium\";v=\"89\", \";Not A Brand\";v=\"99\"",
@ -195,35 +194,34 @@ class GogoanimeProvider : MainAPI() {
val parseRegex = val parseRegex =
Regex("""<li>\s*\n.*\n.*<a\s*href=["'](.*?-episode-(\d+))["']\s*title=["'](.*?)["']>\n.*?img src="(.*?)"""") Regex("""<li>\s*\n.*\n.*<a\s*href=["'](.*?-episode-(\d+))["']\s*title=["'](.*?)["']>\n.*?img src="(.*?)"""")
val urls = listOf( override val mainPage = mainPageOf(
Pair("1", "Recent Release - Sub"), Pair("1", "Recent Release - Sub"),
Pair("2", "Recent Release - Dub"), Pair("2", "Recent Release - Dub"),
Pair("3", "Recent Release - Chinese"), Pair("3", "Recent Release - Chinese"),
) )
val items = ArrayList<HomePageList>() override suspend fun getMainPage(
for (i in urls) { page: Int,
try { categoryName: String,
val params = mapOf("page" to "1", "type" to i.first) categoryData: String
): HomePageResponse {
val params = mapOf("page" to page.toString(), "type" to categoryData)
val html = app.get( val html = app.get(
"https://ajax.gogo-load.com/ajax/page-recent-release.html", "https://ajax.gogo-load.com/ajax/page-recent-release.html",
headers = headers, headers = headers,
params = params params = params
) )
items.add(HomePageList(i.second, (parseRegex.findAll(html.text).map { val isSub = listOf(1, 3).contains(categoryData.toInt())
val home = parseRegex.findAll(html.text).map {
val (link, epNum, title, poster) = it.destructured val (link, epNum, title, poster) = it.destructured
val isSub = listOf(1, 3).contains(i.first.toInt())
newAnimeSearchResponse(title, link) { newAnimeSearchResponse(title, link) {
this.posterUrl = poster this.posterUrl = poster
addDubStatus(!isSub, epNum.toIntOrNull()) addDubStatus(!isSub, epNum.toIntOrNull())
} }
}).toList())) }.toList()
} catch (e: Exception) {
e.printStackTrace() return newHomePageResponse(categoryName, home)
}
}
if (items.size <= 0) throw ErrorLoadingException()
return HomePageResponse(items)
} }
override suspend fun search(query: String): ArrayList<SearchResponse> { override suspend fun search(query: String): ArrayList<SearchResponse> {

View file

@ -3,7 +3,6 @@ package com.lagradost.cloudstream3.movieproviders
import androidx.core.text.parseAsHtml import androidx.core.text.parseAsHtml
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor import com.lagradost.cloudstream3.utils.loadExtractor
@ -18,14 +17,18 @@ class AltadefinizioneProvider : MainAPI() {
TvType.Movie TvType.Movie
) )
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse { override val mainPage = mainPageOf(
val items = ArrayList<HomePageList>() Pair("$mainUrl/azione/page/", "Azione"),
val urls = listOf( Pair("$mainUrl/avventura/page/", "Avventura"),
Pair("$mainUrl/azione/", "Azione"),
Pair("$mainUrl/avventura/", "Avventura"),
) )
for ((url, name) in urls) {
try { override suspend fun getMainPage(
page: Int,
categoryName: String,
categoryData: String
): HomePageResponse {
val url = categoryData + page
val soup = app.get(url).document val soup = app.get(url).document
val home = soup.select("div.box").map { val home = soup.select("div.box").map {
val title = it.selectFirst("img")!!.attr("alt") val title = it.selectFirst("img")!!.attr("alt")
@ -44,14 +47,7 @@ class AltadefinizioneProvider : MainAPI() {
quality, quality,
) )
} }
return newHomePageResponse(categoryName, home)
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<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {

View file

@ -2,7 +2,6 @@ package com.lagradost.cloudstream3.movieproviders
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.extractors.Cinestart import com.lagradost.cloudstream3.extractors.Cinestart
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor import com.lagradost.cloudstream3.utils.loadExtractor
@ -19,16 +18,19 @@ class CinecalidadProvider : MainAPI() {
) )
override val vpnStatus = VPNStatus.MightBeNeeded //Due to evoload sometimes not loading override val vpnStatus = VPNStatus.MightBeNeeded //Due to evoload sometimes not loading
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse { override val mainPage = mainPageOf(
val items = ArrayList<HomePageList>() Pair("$mainUrl/ver-serie/page/", "Series"),
val urls = listOf( Pair("$mainUrl/page/", "Peliculas"),
Pair("$mainUrl/ver-serie/", "Series"), Pair("$mainUrl/genero-de-la-pelicula/peliculas-en-calidad-4k/page/", "4K UHD"),
Pair("$mainUrl/", "Peliculas"),
Pair("$mainUrl/genero-de-la-pelicula/peliculas-en-calidad-4k/", "4K UHD"),
) )
for ((url, name) in urls) { override suspend fun getMainPage(
try { page: Int,
categoryName: String,
categoryData: String
): HomePageResponse {
val url = categoryData + page
val soup = app.get(url).document val soup = app.get(url).document
val home = soup.select(".item.movies").map { val home = soup.select(".item.movies").map {
val title = it.selectFirst("div.in_title")!!.text() val title = it.selectFirst("div.in_title")!!.text()
@ -44,14 +46,7 @@ class CinecalidadProvider : MainAPI() {
) )
} }
items.add(HomePageList(name, home)) return newHomePageResponse(categoryName, home)
} catch (e: Exception) {
logError(e)
}
}
if (items.size <= 0) throw ErrorLoadingException()
return HomePageResponse(items)
} }
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {

View file

@ -1,11 +1,10 @@
package com.lagradost.cloudstream3.movieproviders package com.lagradost.cloudstream3.movieproviders
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor import com.lagradost.cloudstream3.utils.loadExtractor
class EntrepeliculasyseriesProvider:MainAPI() { class EntrepeliculasyseriesProvider : MainAPI() {
override var mainUrl = "https://entrepeliculasyseries.nu" override var mainUrl = "https://entrepeliculasyseries.nu"
override var name = "EntrePeliculasySeries" override var name = "EntrePeliculasySeries"
override var lang = "es" override var lang = "es"
@ -18,16 +17,19 @@ class EntrepeliculasyseriesProvider:MainAPI() {
) )
override val vpnStatus = VPNStatus.MightBeNeeded //Due to evoload sometimes not loading override val vpnStatus = VPNStatus.MightBeNeeded //Due to evoload sometimes not loading
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse { override val mainPage = mainPageOf(
val items = ArrayList<HomePageList>() Pair("$mainUrl/series/page/", "Series"),
val urls = listOf( Pair("$mainUrl/peliculas/page/", "Peliculas"),
Pair("$mainUrl/series/", "Series"), Pair("$mainUrl/anime/page/", "Animes"),
Pair("$mainUrl/peliculas/", "Peliculas"),
Pair("$mainUrl/anime/", "Animes"),
) )
for ((url, name) in urls) { override suspend fun getMainPage(
try { page: Int,
categoryName: String,
categoryData: String
): HomePageResponse {
val url = categoryData + page
val soup = app.get(url).document val soup = app.get(url).document
val home = soup.select("ul.list-movie li").map { val home = soup.select("ul.list-movie li").map {
val title = it.selectFirst("a.link-title h2")!!.text() val title = it.selectFirst("a.link-title h2")!!.text()
@ -43,14 +45,7 @@ class EntrepeliculasyseriesProvider:MainAPI() {
) )
} }
items.add(HomePageList(name, home)) return newHomePageResponse(categoryName, home)
} catch (e: Exception) {
logError(e)
}
}
if (items.size <= 0) throw ErrorLoadingException()
return HomePageResponse(items)
} }
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {
@ -110,7 +105,8 @@ class EntrepeliculasyseriesProvider:MainAPI() {
fixUrl(epThumb) fixUrl(epThumb)
) )
} }
return when (val tvType = if (url.contains("/pelicula/")) TvType.Movie else TvType.TvSeries) { return when (val tvType =
if (url.contains("/pelicula/")) TvType.Movie else TvType.TvSeries) {
TvType.TvSeries -> { TvType.TvSeries -> {
TvSeriesLoadResponse( TvSeriesLoadResponse(
title, title,
@ -151,8 +147,10 @@ class EntrepeliculasyseriesProvider:MainAPI() {
val doc = app.get(servers).document val doc = app.get(servers).document
doc.select("input").apmap { doc.select("input").apmap {
val postkey = it.attr("value") val postkey = it.attr("value")
app.post("https://entrepeliculasyseries.nu/r.php", app.post(
headers = mapOf("Host" to "entrepeliculasyseries.nu", "https://entrepeliculasyseries.nu/r.php",
headers = mapOf(
"Host" to "entrepeliculasyseries.nu",
"User-Agent" to USER_AGENT, "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" 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-Language" to "en-US,en;q=0.5",
@ -165,7 +163,8 @@ class EntrepeliculasyseriesProvider:MainAPI() {
"Sec-Fetch-Dest" to "document", "Sec-Fetch-Dest" to "document",
"Sec-Fetch-Mode" to "navigate", "Sec-Fetch-Mode" to "navigate",
"Sec-Fetch-Site" to "same-origin", "Sec-Fetch-Site" to "same-origin",
"Sec-Fetch-User" to "?1",), "Sec-Fetch-User" to "?1",
),
//params = mapOf(Pair("h", postkey)), //params = mapOf(Pair("h", postkey)),
data = mapOf(Pair("h", postkey)), data = mapOf(Pair("h", postkey)),
allowRedirects = false allowRedirects = false

View file

@ -1,13 +1,13 @@
package com.lagradost.cloudstream3.movieproviders package com.lagradost.cloudstream3.movieproviders
import androidx.core.text.parseAsHtml import androidx.core.text.parseAsHtml
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.utils.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.LoadResponse.Companion.addRating import com.lagradost.cloudstream3.LoadResponse.Companion.addRating
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.utils.AppUtils.toJson import com.lagradost.cloudstream3.utils.AppUtils.toJson
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
import com.lagradost.nicehttp.NiceResponse import com.lagradost.nicehttp.NiceResponse
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
@ -23,42 +23,41 @@ class FilmpertuttiProvider : MainAPI() {
TvType.TvSeries TvType.TvSeries
) )
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse { override val mainPage = mainPageOf(
val items = ArrayList<HomePageList>() Pair("$mainUrl/category/serie-tv/page/", "Serie Tv"),
val urls = listOf( Pair("$mainUrl/category/film/azione/page/", "Azione"),
Pair("$mainUrl/category/serie-tv/", "Serie Tv"), Pair("$mainUrl/category/film/avventura/page/", "Avventura"),
Pair("$mainUrl/category/film/azione/", "Azione"),
Pair("$mainUrl/category/film/avventura/", "Avventura"),
) )
for ((url, name) in urls) {
try { override suspend fun getMainPage(
page: Int,
categoryName: String,
categoryData: String
): HomePageResponse {
val url = categoryData + page
val soup = app.get(url).document val soup = app.get(url).document
val home = soup.select("ul.posts > li").map { val home = soup.select("ul.posts > li").map {
val title = it.selectFirst("div.title")!!.text().substringBeforeLast("(").substringBeforeLast("[") val title = it.selectFirst("div.title")!!.text().substringBeforeLast("(")
.substringBeforeLast("[")
val link = it.selectFirst("a")!!.attr("href") val link = it.selectFirst("a")!!.attr("href")
val image = it.selectFirst("a")!!.attr("data-thumbnail") val image = it.selectFirst("a")!!.attr("data-thumbnail")
val qualitydata = it.selectFirst("div.hd") val qualitydata = it.selectFirst("div.hd")
val quality = if (qualitydata!= null) { val quality = if (qualitydata != null) {
getQualityFromString(qualitydata?.text()) getQualityFromString(qualitydata.text())
} } else {
else {
null null
} }
newTvSeriesSearchResponse( newTvSeriesSearchResponse(
title, title,
link) { link
) {
this.posterUrl = image this.posterUrl = image
this.quality = quality this.quality = quality
} }
} }
items.add(HomePageList(name, home)) return newHomePageResponse(categoryName, home)
} catch (e: Exception) {
logError(e)
}
}
if (items.size <= 0) throw ErrorLoadingException()
return HomePageResponse(items)
} }
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {
@ -66,7 +65,8 @@ class FilmpertuttiProvider : MainAPI() {
val url = "$mainUrl/?s=$queryformatted" val url = "$mainUrl/?s=$queryformatted"
val doc = app.get(url).document val doc = app.get(url).document
return doc.select("ul.posts > li").map { return doc.select("ul.posts > li").map {
val title = it.selectFirst("div.title")!!.text().substringBeforeLast("(").substringBeforeLast("[") val title = it.selectFirst("div.title")!!.text().substringBeforeLast("(")
.substringBeforeLast("[")
val link = it.selectFirst("a")!!.attr("href") val link = it.selectFirst("a")!!.attr("href")
val image = it.selectFirst("a")!!.attr("data-thumbnail") val image = it.selectFirst("a")!!.attr("data-thumbnail")
val quality = getQualityFromString(it.selectFirst("div.hd")?.text()) val quality = getQualityFromString(it.selectFirst("div.hd")?.text())
@ -90,28 +90,36 @@ class FilmpertuttiProvider : MainAPI() {
val title = document.selectFirst("#content > h1")!!.text().substringBeforeLast("(") val title = document.selectFirst("#content > h1")!!.text().substringBeforeLast("(")
.substringBeforeLast("[") .substringBeforeLast("[")
val description = document.selectFirst("i.fa.fa-file-text-o.fa-fw")?.parent()?.nextSibling()?.toString()?.parseAsHtml().toString() val description =
document.selectFirst("i.fa.fa-file-text-o.fa-fw")?.parent()?.nextSibling()?.toString()
?.parseAsHtml().toString()
val rating = document.selectFirst("div.rating > div.value")?.text() val rating = document.selectFirst("div.rating > div.value")?.text()
val year = val year =
document.selectFirst("#content > h1")?.text()?.substringAfterLast("(")?.filter { it.isDigit() }?.toIntOrNull() ?: document.selectFirst("#content > h1")?.text()?.substringAfterLast("(")
description.substringAfter("trasmessa nel").take(6).filter { it.isDigit() }.toIntOrNull() ?: ?.filter { it.isDigit() }?.toIntOrNull()
(document.selectFirst("i.fa.fa-calendar.fa-fw")?.parent()?.nextSibling() as Element?)?.text()?.substringAfterLast(" ")?.filter { it.isDigit() }?.toIntOrNull() ?: description.substringAfter("trasmessa nel").take(6).filter { it.isDigit() }
.toIntOrNull() ?: (document.selectFirst("i.fa.fa-calendar.fa-fw")?.parent()
?.nextSibling() as Element?)?.text()?.substringAfterLast(" ")
?.filter { it.isDigit() }?.toIntOrNull()
val poster = document.selectFirst("div.meta > div > img")?.attr("data-src") val poster = document.selectFirst("div.meta > div > img")?.attr("data-src")
val trailerurl = document.selectFirst("div.youtube-player")?.attr("data-id")?.let{ urldata-> val trailerurl =
document.selectFirst("div.youtube-player")?.attr("data-id")?.let { urldata ->
"https://www.youtube.com/watch?v=$urldata" "https://www.youtube.com/watch?v=$urldata"
} }
if (type == TvType.TvSeries) { if (type == TvType.TvSeries) {
val episodeList = ArrayList<Episode>() val episodeList = ArrayList<Episode>()
document.select("div.accordion-item").filter{it.selectFirst("#season > ul > li.s_title > span")!!.text().isNotEmpty()}.map { element -> document.select("div.accordion-item")
.filter { it.selectFirst("#season > ul > li.s_title > span")!!.text().isNotEmpty() }
.map { element ->
val season = val season =
element.selectFirst("#season > ul > li.s_title > span")!!.text().toInt() element.selectFirst("#season > ul > li.s_title > span")!!.text().toInt()
element.select("div.episode-wrap").map { episode -> element.select("div.episode-wrap").map { episode ->
@ -147,10 +155,12 @@ class FilmpertuttiProvider : MainAPI() {
} else { } else {
val urls0 = document.select("div.embed-player") val urls0 = document.select("div.embed-player")
val urls = if (urls0.isNotEmpty()){ val urls = if (urls0.isNotEmpty()) {
urls0.map { it.attr("data-id") }.toJson() urls0.map { it.attr("data-id") }.toJson()
} else {
document.select("#info > ul > li ").mapNotNull { it.selectFirst("a")?.attr("href") }
.toJson()
} }
else{ document.select("#info > ul > li ").mapNotNull { it.selectFirst("a")?.attr("href") }.toJson() }
return newMovieLoadResponse( return newMovieLoadResponse(
title, title,
@ -168,46 +178,49 @@ class FilmpertuttiProvider : MainAPI() {
} }
} }
// to be updated when UnshortenUrl is ready // to be updated when UnshortenUrl is ready
suspend fun unshorten_linkup(uri: String): String { suspend fun unshorten_linkup(uri: String): String {
var r: NiceResponse? = null var r: NiceResponse? = null
var uri = uri var uri = uri
when{ when {
uri.contains("/tv/") -> uri = uri.replace("/tv/", "/tva/") uri.contains("/tv/") -> uri = uri.replace("/tv/", "/tva/")
uri.contains("delta") -> uri = uri.replace("/delta/", "/adelta/") uri.contains("delta") -> uri = uri.replace("/delta/", "/adelta/")
(uri.contains("/ga/") || uri.contains("/ga2/")) -> uri = base64Decode(uri.split('/').last()).trim() (uri.contains("/ga/") || uri.contains("/ga2/")) -> uri =
uri.contains("/speedx/") -> uri = uri.replace("http://linkup.pro/speedx", "http://speedvideo.net") base64Decode(uri.split('/').last()).trim()
uri.contains("/speedx/") -> uri =
uri.replace("http://linkup.pro/speedx", "http://speedvideo.net")
else -> { else -> {
r = app.get(uri, allowRedirects = true) r = app.get(uri, allowRedirects = true)
uri = r.url uri = r.url
val link = val link =
Regex("<iframe[^<>]*src=\\'([^'>]*)\\'[^<>]*>").find(r.text)?.value ?: Regex("<iframe[^<>]*src=\\'([^'>]*)\\'[^<>]*>").find(r.text)?.value
Regex("""action="(?:[^/]+.*?/[^/]+/([a-zA-Z0-9_]+))">""").find(r.text)?.value ?: ?: Regex("""action="(?:[^/]+.*?/[^/]+/([a-zA-Z0-9_]+))">""").find(r.text)?.value
Regex("""href","((.|\\n)*?)"""").findAll(r.text).elementAtOrNull(1)?.groupValues?.get(1) ?: Regex("""href","((.|\\n)*?)"""").findAll(r.text)
.elementAtOrNull(1)?.groupValues?.get(1)
if (link!=null) { if (link != null) {
uri = link uri = link
} }
} }
} }
val short = Regex("""^https?://.*?(https?://.*)""").find(uri)?.value val short = Regex("""^https?://.*?(https?://.*)""").find(uri)?.value
if (short!=null){ if (short != null) {
uri = short uri = short
} }
if (r==null){ if (r == null) {
r = app.get( r = app.get(
uri, uri,
allowRedirects = false) allowRedirects = false
if (r.headers["location"]!= null){ )
if (r.headers["location"] != null) {
uri = r.headers["location"].toString() uri = r.headers["location"].toString()
} }
} }
if (uri.contains("snip.")) { if (uri.contains("snip.")) {
if (uri.contains("out_generator")) { if (uri.contains("out_generator")) {
uri = Regex("url=(.*)\$").find(uri)!!.value uri = Regex("url=(.*)\$").find(uri)!!.value
} } else if (uri.contains("/decode/")) {
else if (uri.contains("/decode/")) {
uri = app.get(uri, allowRedirects = true).url uri = app.get(uri, allowRedirects = true).url
} }
} }
@ -222,16 +235,14 @@ class FilmpertuttiProvider : MainAPI() {
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
): Boolean { ): Boolean {
tryParseJson<List<String>>(data)?.apmap { id -> tryParseJson<List<String>>(data)?.apmap { id ->
if (id.contains("buckler")){ if (id.contains("buckler")) {
val id2 = unshorten_linkup(id).trim().replace("/v/","/e/").replace("/f/","/e/") val id2 = unshorten_linkup(id).trim().replace("/v/", "/e/").replace("/f/", "/e/")
loadExtractor(id2, data, subtitleCallback, callback) loadExtractor(id2, data, subtitleCallback, callback)
} } else if (id.contains("isecure")) {
else if (id.contains("isecure")){
val doc1 = app.get(id).document val doc1 = app.get(id).document
val id2 = doc1.selectFirst("iframe")!!.attr("src") val id2 = doc1.selectFirst("iframe")!!.attr("src")
loadExtractor(id2, data, subtitleCallback, callback) loadExtractor(id2, data, subtitleCallback, callback)
} } else {
else{
loadExtractor(id, data, subtitleCallback, callback) loadExtractor(id, data, subtitleCallback, callback)
} }
} }

View file

@ -2,7 +2,6 @@ package com.lagradost.cloudstream3.movieproviders
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.animeproviders.GogoanimeProvider
import com.lagradost.cloudstream3.animeproviders.GogoanimeProvider.Companion.extractVidstream import com.lagradost.cloudstream3.animeproviders.GogoanimeProvider.Companion.extractVidstream
import com.lagradost.cloudstream3.metaproviders.TmdbLink import com.lagradost.cloudstream3.metaproviders.TmdbLink
import com.lagradost.cloudstream3.metaproviders.TmdbProvider import com.lagradost.cloudstream3.metaproviders.TmdbProvider

View file

@ -25,7 +25,8 @@ class PeliSmartProvider: MainAPI() {
Pair("$mainUrl/documentales/", "Documentales"), Pair("$mainUrl/documentales/", "Documentales"),
) )
for ((url, name) in urls) { // has no inf loading
urls.apmap { (url, name) ->
try { try {
val soup = app.get(url).document val soup = app.get(url).document
val home = soup.select(".description-off").map { val home = soup.select(".description-off").map {

View file

@ -2,7 +2,6 @@ package com.lagradost.cloudstream3.movieproviders
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.utils.AppUtils.parseJson import com.lagradost.cloudstream3.utils.AppUtils.parseJson
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.Qualities import com.lagradost.cloudstream3.utils.Qualities
@ -19,14 +18,18 @@ class SoaptwoDayProvider : MainAPI() {
TvType.TvSeries, TvType.TvSeries,
) )
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse { override val mainPage = mainPageOf(
val items = ArrayList<HomePageList>() Pair("$mainUrl/movielist?page=", "Movies"),
val urls = listOf( Pair("$mainUrl/tvlist?page=", "TV Series"),
Pair("$mainUrl/movielist/", "Movies"),
Pair("$mainUrl/tvlist/", "TV Series"),
) )
for ((url, name) in urls) {
try { override suspend fun getMainPage(
page: Int,
categoryName: String,
categoryData: String
): HomePageResponse {
val url = categoryData + page
val soup = app.get(url).document val soup = app.get(url).document
val home = val home =
soup.select("div.container div.row div.col-sm-12.col-lg-12 div.row div.col-sm-12.col-lg-12 .col-xs-6") soup.select("div.container div.row div.col-sm-12.col-lg-12 div.row div.col-sm-12.col-lg-12 .col-xs-6")
@ -43,13 +46,7 @@ class SoaptwoDayProvider : MainAPI() {
null, null,
) )
} }
return newHomePageResponse(categoryName, home)
items.add(HomePageList(name, home))
} catch (e: Exception) {
logError(e)
}
}
return HomePageResponse(items)
} }
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {

View file

@ -1,10 +1,9 @@
package com.lagradost.cloudstream3.movieproviders package com.lagradost.cloudstream3.movieproviders
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.utils.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
class TantifilmProvider : MainAPI() { class TantifilmProvider : MainAPI() {
@ -18,15 +17,18 @@ class TantifilmProvider : MainAPI() {
TvType.TvSeries, TvType.TvSeries,
) )
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse { override val mainPage = mainPageOf(
val items = ArrayList<HomePageList>() Pair("$mainUrl/watch-genre/serie-tv/page/", "Serie Tv"),
val urls = listOf( Pair("$mainUrl/watch-genre/azione/page/", "Azione"),
Pair("$mainUrl/watch-genre/serie-tv/", "Serie Tv"), Pair("$mainUrl/watch-genre/avventura/page/", "Avventura"),
Pair("$mainUrl/watch-genre/azione/", "Azione"),
Pair("$mainUrl/watch-genre/avventura/", "Avventura"),
) )
for ((url, name) in urls) {
try { override suspend fun getMainPage(
page: Int,
categoryName: String,
categoryData: String
): HomePageResponse {
val url = categoryData + page
val soup = app.get(url).document val soup = app.get(url).document
val home = soup.select("div.media3").map { val home = soup.select("div.media3").map {
val title = it.selectFirst("p")!!.text().substringBefore("(") val title = it.selectFirst("p")!!.text().substringBefore("(")
@ -41,14 +43,7 @@ class TantifilmProvider : MainAPI() {
null, null,
) )
} }
return newHomePageResponse(categoryName, home)
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<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {
@ -125,7 +120,7 @@ class TantifilmProvider : MainAPI() {
val episodeList = ArrayList<Episode>() val episodeList = ArrayList<Episode>()
for ((season,seasonurl) in list) { for ((season, seasonurl) in list) {
val seasonDocument = app.get(seasonurl).document val seasonDocument = app.get(seasonurl).document
val episodes = seasonDocument.select("nav.second_nav > select > option") val episodes = seasonDocument.select("nav.second_nav > select > option")
if (episodes.isNotEmpty()) { if (episodes.isNotEmpty()) {
@ -147,11 +142,12 @@ class TantifilmProvider : MainAPI() {
title, title,
url, url,
type, type,
episodeList) { episodeList
this.posterUrl= fixUrlNull(poster) ) {
this.posterUrl = fixUrlNull(poster)
this.year = year.toIntOrNull() this.year = year.toIntOrNull()
this.plot= descipt[0] this.plot = descipt[0]
this.rating= rating this.rating = rating
this.recommendations = recomm this.recommendations = recomm
addTrailer(trailerurl) addTrailer(trailerurl)
} }

View file

@ -119,8 +119,10 @@ object SubtitleHelper {
private val flagRegex = Regex("[\uD83C\uDDE6-\uD83C\uDDFF]{2}") private val flagRegex = Regex("[\uD83C\uDDE6-\uD83C\uDDFF]{2}")
fun getFlagFromIso(inp: String?): String? { fun getFlagFromIso(inp: String?): String? {
if (inp.isNullOrBlank() || inp.length < 2) return null
try { try {
val ret = getFlagFromIsoShort(flags[inp ?: return null]) val ret = getFlagFromIsoShort(flags[inp])
?: getFlagFromIsoShort(inp.uppercase()) ?: return null ?: getFlagFromIsoShort(inp.uppercase()) ?: return null
return if (flagRegex.matches(ret)) { return if (flagRegex.matches(ret)) {
@ -135,8 +137,9 @@ object SubtitleHelper {
} }
private fun getFlagFromIsoShort(flagAscii: String?): String? { private fun getFlagFromIsoShort(flagAscii: String?): String? {
if (flagAscii.isNullOrBlank() || flagAscii.length < 2) return null
try { try {
val firstChar: Int = Character.codePointAt(flagAscii ?: return null, 0) + offset val firstChar: Int = Character.codePointAt(flagAscii, 0) + offset
val secondChar: Int = Character.codePointAt(flagAscii, 1) + offset val secondChar: Int = Character.codePointAt(flagAscii, 1) + offset
return (String(Character.toChars(firstChar)) + String(Character.toChars(secondChar))) return (String(Character.toChars(firstChar)) + String(Character.toChars(secondChar)))