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,52 +178,50 @@ 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\"", "accept" to "text/html, */*; q=0.01",
"accept" to "text/html, */*; q=0.01", "dnt" to "1",
"dnt" to "1", "sec-ch-ua-mobile" to "?0",
"sec-ch-ua-mobile" to "?0", "user-agent" to "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
"user-agent" to "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36", "origin" to mainUrl,
"origin" to mainUrl, "sec-fetch-site" to "cross-site",
"sec-fetch-site" to "cross-site", "sec-fetch-mode" to "cors",
"sec-fetch-mode" to "cors", "sec-fetch-dest" to "empty",
"sec-fetch-dest" to "empty", "referer" to "$mainUrl/"
"referer" to "$mainUrl/" )
) 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
val html = app.get( ): HomePageResponse {
"https://ajax.gogo-load.com/ajax/page-recent-release.html", val params = mapOf("page" to page.toString(), "type" to categoryData)
headers = headers, val html = app.get(
params = params "https://ajax.gogo-load.com/ajax/page-recent-release.html",
) headers = headers,
items.add(HomePageList(i.second, (parseRegex.findAll(html.text).map { params = params
val (link, epNum, title, poster) = it.destructured )
val isSub = listOf(1, 3).contains(i.first.toInt()) val isSub = listOf(1, 3).contains(categoryData.toInt())
newAnimeSearchResponse(title, link) {
this.posterUrl = poster val home = parseRegex.findAll(html.text).map {
addDubStatus(!isSub, epNum.toIntOrNull()) val (link, epNum, title, poster) = it.destructured
} newAnimeSearchResponse(title, link) {
}).toList())) this.posterUrl = poster
} catch (e: Exception) { addDubStatus(!isSub, epNum.toIntOrNull())
e.printStackTrace()
} }
} }.toList()
if (items.size <= 0) throw ErrorLoadingException()
return HomePageResponse(items) return newHomePageResponse(categoryName, home)
} }
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,40 +17,37 @@ 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 {
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( override suspend fun getMainPage(
title, page: Int,
link, categoryName: String,
this.name, categoryData: String
TvType.Movie, ): HomePageResponse {
image, val url = categoryData + page
null,
null,
quality,
)
}
items.add(HomePageList(name, home)) val soup = app.get(url).document
} catch (e: Exception) { val home = soup.select("div.box").map {
logError(e) 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,
)
} }
if (items.size <= 0) throw ErrorLoadingException() return newHomePageResponse(categoryName, home)
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,39 +18,35 @@ 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,
val soup = app.get(url).document categoryName: String,
val home = soup.select(".item.movies").map { categoryData: String
val title = it.selectFirst("div.in_title")!!.text() ): HomePageResponse {
val link = it.selectFirst("a")!!.attr("href") val url = categoryData + page
TvSeriesSearchResponse(
title,
link,
this.name,
if (link.contains("/ver-pelicula/")) TvType.Movie else TvType.TvSeries,
it.selectFirst(".poster.custom img")!!.attr("data-src"),
null,
null,
)
}
items.add(HomePageList(name, home)) val soup = app.get(url).document
} catch (e: Exception) { val home = soup.select(".item.movies").map {
logError(e) val title = it.selectFirst("div.in_title")!!.text()
} val link = it.selectFirst("a")!!.attr("href")
TvSeriesSearchResponse(
title,
link,
this.name,
if (link.contains("/ver-pelicula/")) TvType.Movie else TvType.TvSeries,
it.selectFirst(".poster.custom img")!!.attr("data-src"),
null,
null,
)
} }
if (items.size <= 0) throw ErrorLoadingException() return newHomePageResponse(categoryName, home)
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,39 +17,35 @@ 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,
val soup = app.get(url).document categoryName: String,
val home = soup.select("ul.list-movie li").map { categoryData: String
val title = it.selectFirst("a.link-title h2")!!.text() ): HomePageResponse {
val link = it.selectFirst("a")!!.attr("href") val url = categoryData + page
TvSeriesSearchResponse(
title,
link,
this.name,
if (link.contains("/pelicula/")) TvType.Movie else TvType.TvSeries,
it.selectFirst("a.poster img")!!.attr("src"),
null,
null,
)
}
items.add(HomePageList(name, home)) val soup = app.get(url).document
} catch (e: Exception) { val home = soup.select("ul.list-movie li").map {
logError(e) val title = it.selectFirst("a.link-title h2")!!.text()
} val link = it.selectFirst("a")!!.attr("href")
TvSeriesSearchResponse(
title,
link,
this.name,
if (link.contains("/pelicula/")) TvType.Movie else TvType.TvSeries,
it.selectFirst("a.poster img")!!.attr("src"),
null,
null,
)
} }
if (items.size <= 0) throw ErrorLoadingException() return newHomePageResponse(categoryName, home)
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,9 +163,10 @@ 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
).okhttpResponse.headers.values("location").apmap { ).okhttpResponse.headers.values("location").apmap {
loadExtractor(it, data, subtitleCallback, callback) loadExtractor(it, data, subtitleCallback, callback)

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 {
val soup = app.get(url).document
val home = soup.select("ul.posts > li").map {
val title = it.selectFirst("div.title")!!.text().substringBeforeLast("(").substringBeforeLast("[")
val link = it.selectFirst("a")!!.attr("href")
val image = it.selectFirst("a")!!.attr("data-thumbnail")
val qualitydata = it.selectFirst("div.hd")
val quality = if (qualitydata!= null) {
getQualityFromString(qualitydata?.text())
}
else {
null
}
newTvSeriesSearchResponse(
title,
link) {
this.posterUrl = image
this.quality = quality
}
}
items.add(HomePageList(name, home)) override suspend fun getMainPage(
} catch (e: Exception) { page: Int,
logError(e) categoryName: String,
categoryData: String
): HomePageResponse {
val url = categoryData + page
val soup = app.get(url).document
val home = soup.select("ul.posts > li").map {
val title = it.selectFirst("div.title")!!.text().substringBeforeLast("(")
.substringBeforeLast("[")
val link = it.selectFirst("a")!!.attr("href")
val image = it.selectFirst("a")!!.attr("data-thumbnail")
val qualitydata = it.selectFirst("div.hd")
val quality = if (qualitydata != null) {
getQualityFromString(qualitydata.text())
} else {
null
}
newTvSeriesSearchResponse(
title,
link
) {
this.posterUrl = image
this.quality = quality
} }
} }
if (items.size <= 0) throw ErrorLoadingException()
return HomePageResponse(items) return newHomePageResponse(categoryName, home)
} }
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,50 +90,58 @@ 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 =
"https://www.youtube.com/watch?v=$urldata" document.selectFirst("div.youtube-player")?.attr("data-id")?.let { 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")
val season = .filter { it.selectFirst("#season > ul > li.s_title > span")!!.text().isNotEmpty() }
element.selectFirst("#season > ul > li.s_title > span")!!.text().toInt() .map { element ->
element.select("div.episode-wrap").map { episode -> val season =
val href = element.selectFirst("#season > ul > li.s_title > span")!!.text().toInt()
episode.select("#links > div > div > table > tbody:nth-child(2) > tr") element.select("div.episode-wrap").map { episode ->
.map { it.selectFirst("a")!!.attr("href") }.toJson() val href =
val epNum = episode.selectFirst("li.season-no")!!.text().substringAfter("x") episode.select("#links > div > div > table > tbody:nth-child(2) > tr")
.filter { it.isDigit() }.toIntOrNull() .map { it.selectFirst("a")!!.attr("href") }.toJson()
val epTitle = episode.selectFirst("li.other_link > a")?.text() val epNum = episode.selectFirst("li.season-no")!!.text().substringAfter("x")
.filter { it.isDigit() }.toIntOrNull()
val epTitle = episode.selectFirst("li.other_link > a")?.text()
val posterUrl = episode.selectFirst("figure > img")?.attr("data-src") val posterUrl = episode.selectFirst("figure > img")?.attr("data-src")
episodeList.add( episodeList.add(
Episode( Episode(
href, href,
epTitle, epTitle,
season, season,
epNum, epNum,
posterUrl, posterUrl,
)
) )
) }
} }
}
return newTvSeriesLoadResponse( return newTvSeriesLoadResponse(
title, title,
url, type, episodeList url, type, episodeList
@ -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 {
else{ document.select("#info > ul > li ").mapNotNull { it.selectFirst("a")?.attr("href") }.toJson() } 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,37 +18,35 @@ 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 {
val soup = app.get(url).document
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")
.map {
val title = it.selectFirst("h5 a")!!.text()
val link = it.selectFirst("a")!!.attr("href")
TvSeriesSearchResponse(
title,
link,
this.name,
TvType.TvSeries,
fixUrl(it.selectFirst("img")!!.attr("src")),
null,
null,
)
}
items.add(HomePageList(name, home)) override suspend fun getMainPage(
} catch (e: Exception) { page: Int,
logError(e) categoryName: String,
} categoryData: String
} ): HomePageResponse {
return HomePageResponse(items) val url = categoryData + page
val soup = app.get(url).document
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")
.map {
val title = it.selectFirst("h5 a")!!.text()
val link = it.selectFirst("a")!!.attr("href")
TvSeriesSearchResponse(
title,
link,
this.name,
TvType.TvSeries,
fixUrl(it.selectFirst("img")!!.attr("src")),
null,
null,
)
}
return newHomePageResponse(categoryName, home)
} }
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,37 +17,33 @@ 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 {
val soup = app.get(url).document
val home = soup.select("div.media3").map {
val title = it.selectFirst("p")!!.text().substringBefore("(")
val link = it.selectFirst("a")!!.attr("href")
TvSeriesSearchResponse(
title,
link,
this.name,
TvType.Movie,
it.selectFirst("img")!!.attr("src"),
null,
null,
)
}
items.add(HomePageList(name, home)) override suspend fun getMainPage(
} catch (e: Exception) { page: Int,
logError(e) categoryName: String,
} categoryData: String
): HomePageResponse {
val url = categoryData + page
val soup = app.get(url).document
val home = soup.select("div.media3").map {
val title = it.selectFirst("p")!!.text().substringBefore("(")
val link = it.selectFirst("a")!!.attr("href")
TvSeriesSearchResponse(
title,
link,
this.name,
TvType.Movie,
it.selectFirst("img")!!.attr("src"),
null,
null,
)
} }
if (items.size <= 0) throw ErrorLoadingException() return newHomePageResponse(categoryName, home)
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)))