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 val hasQuickSearch = false
override val hasMainPage = true
@ -178,7 +178,6 @@ class GogoanimeProvider : MainAPI() {
TvType.OVA
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
val headers = mapOf(
"authority" to "ajax.gogo-load.com",
"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 =
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("2", "Recent Release - Dub"),
Pair("3", "Recent Release - Chinese"),
)
val items = ArrayList<HomePageList>()
for (i in urls) {
try {
val params = mapOf("page" to "1", "type" to i.first)
override suspend fun getMainPage(
page: Int,
categoryName: String,
categoryData: String
): HomePageResponse {
val params = mapOf("page" to page.toString(), "type" to categoryData)
val html = app.get(
"https://ajax.gogo-load.com/ajax/page-recent-release.html",
headers = headers,
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 isSub = listOf(1, 3).contains(i.first.toInt())
newAnimeSearchResponse(title, link) {
this.posterUrl = poster
addDubStatus(!isSub, epNum.toIntOrNull())
}
}).toList()))
} catch (e: Exception) {
e.printStackTrace()
}
}
if (items.size <= 0) throw ErrorLoadingException()
return HomePageResponse(items)
}.toList()
return newHomePageResponse(categoryName, home)
}
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 com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
@ -18,14 +17,18 @@ class AltadefinizioneProvider : MainAPI() {
TvType.Movie
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
val items = ArrayList<HomePageList>()
val urls = listOf(
Pair("$mainUrl/azione/", "Azione"),
Pair("$mainUrl/avventura/", "Avventura"),
override val mainPage = mainPageOf(
Pair("$mainUrl/azione/page/", "Azione"),
Pair("$mainUrl/avventura/page/", "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 home = soup.select("div.box").map {
val title = it.selectFirst("img")!!.attr("alt")
@ -44,14 +47,7 @@ class AltadefinizioneProvider : MainAPI() {
quality,
)
}
items.add(HomePageList(name, home))
} catch (e: Exception) {
logError(e)
}
}
if (items.size <= 0) throw ErrorLoadingException()
return HomePageResponse(items)
return newHomePageResponse(categoryName, home)
}
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.extractors.Cinestart
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.utils.ExtractorLink
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 suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
val items = ArrayList<HomePageList>()
val urls = listOf(
Pair("$mainUrl/ver-serie/", "Series"),
Pair("$mainUrl/", "Peliculas"),
Pair("$mainUrl/genero-de-la-pelicula/peliculas-en-calidad-4k/", "4K UHD"),
override val mainPage = mainPageOf(
Pair("$mainUrl/ver-serie/page/", "Series"),
Pair("$mainUrl/page/", "Peliculas"),
Pair("$mainUrl/genero-de-la-pelicula/peliculas-en-calidad-4k/page/", "4K UHD"),
)
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 home = soup.select(".item.movies").map {
val title = it.selectFirst("div.in_title")!!.text()
@ -44,14 +46,7 @@ class CinecalidadProvider : MainAPI() {
)
}
items.add(HomePageList(name, home))
} catch (e: Exception) {
logError(e)
}
}
if (items.size <= 0) throw ErrorLoadingException()
return HomePageResponse(items)
return newHomePageResponse(categoryName, home)
}
override suspend fun search(query: String): List<SearchResponse> {

View file

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

View file

@ -1,13 +1,13 @@
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.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
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.tryParseJson
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
import com.lagradost.nicehttp.NiceResponse
import org.jsoup.nodes.Element
@ -23,42 +23,41 @@ class FilmpertuttiProvider : MainAPI() {
TvType.TvSeries
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
val items = ArrayList<HomePageList>()
val urls = listOf(
Pair("$mainUrl/category/serie-tv/", "Serie Tv"),
Pair("$mainUrl/category/film/azione/", "Azione"),
Pair("$mainUrl/category/film/avventura/", "Avventura"),
override val mainPage = mainPageOf(
Pair("$mainUrl/category/serie-tv/page/", "Serie Tv"),
Pair("$mainUrl/category/film/azione/page/", "Azione"),
Pair("$mainUrl/category/film/avventura/page/", "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 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 image = it.selectFirst("a")!!.attr("data-thumbnail")
val qualitydata = it.selectFirst("div.hd")
val quality = if (qualitydata != null) {
getQualityFromString(qualitydata?.text())
}
else {
getQualityFromString(qualitydata.text())
} else {
null
}
newTvSeriesSearchResponse(
title,
link) {
link
) {
this.posterUrl = image
this.quality = quality
}
}
items.add(HomePageList(name, home))
} catch (e: Exception) {
logError(e)
}
}
if (items.size <= 0) throw ErrorLoadingException()
return HomePageResponse(items)
return newHomePageResponse(categoryName, home)
}
override suspend fun search(query: String): List<SearchResponse> {
@ -66,7 +65,8 @@ class FilmpertuttiProvider : MainAPI() {
val url = "$mainUrl/?s=$queryformatted"
val doc = app.get(url).document
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 image = it.selectFirst("a")!!.attr("data-thumbnail")
val quality = getQualityFromString(it.selectFirst("div.hd")?.text())
@ -90,28 +90,36 @@ class FilmpertuttiProvider : MainAPI() {
val title = document.selectFirst("#content > h1")!!.text().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 year =
document.selectFirst("#content > h1")?.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()
document.selectFirst("#content > h1")?.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 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"
}
if (type == TvType.TvSeries) {
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 =
element.selectFirst("#season > ul > li.s_title > span")!!.text().toInt()
element.select("div.episode-wrap").map { episode ->
@ -149,8 +157,10 @@ class FilmpertuttiProvider : MainAPI() {
val urls0 = document.select("div.embed-player")
val urls = if (urls0.isNotEmpty()) {
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(
title,
@ -175,15 +185,18 @@ class FilmpertuttiProvider : MainAPI() {
when {
uri.contains("/tv/") -> uri = uri.replace("/tv/", "/tva/")
uri.contains("delta") -> uri = uri.replace("/delta/", "/adelta/")
(uri.contains("/ga/") || uri.contains("/ga2/")) -> uri = base64Decode(uri.split('/').last()).trim()
uri.contains("/speedx/") -> uri = uri.replace("http://linkup.pro/speedx", "http://speedvideo.net")
(uri.contains("/ga/") || uri.contains("/ga2/")) -> uri =
base64Decode(uri.split('/').last()).trim()
uri.contains("/speedx/") -> uri =
uri.replace("http://linkup.pro/speedx", "http://speedvideo.net")
else -> {
r = app.get(uri, allowRedirects = true)
uri = r.url
val link =
Regex("<iframe[^<>]*src=\\'([^'>]*)\\'[^<>]*>").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("<iframe[^<>]*src=\\'([^'>]*)\\'[^<>]*>").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)
if (link != null) {
uri = link
@ -198,7 +211,8 @@ class FilmpertuttiProvider : MainAPI() {
if (r == null) {
r = app.get(
uri,
allowRedirects = false)
allowRedirects = false
)
if (r.headers["location"] != null) {
uri = r.headers["location"].toString()
}
@ -206,8 +220,7 @@ class FilmpertuttiProvider : MainAPI() {
if (uri.contains("snip.")) {
if (uri.contains("out_generator")) {
uri = Regex("url=(.*)\$").find(uri)!!.value
}
else if (uri.contains("/decode/")) {
} else if (uri.contains("/decode/")) {
uri = app.get(uri, allowRedirects = true).url
}
}
@ -225,13 +238,11 @@ class FilmpertuttiProvider : MainAPI() {
if (id.contains("buckler")) {
val id2 = unshorten_linkup(id).trim().replace("/v/", "/e/").replace("/f/", "/e/")
loadExtractor(id2, data, subtitleCallback, callback)
}
else if (id.contains("isecure")){
} else if (id.contains("isecure")) {
val doc1 = app.get(id).document
val id2 = doc1.selectFirst("iframe")!!.attr("src")
loadExtractor(id2, data, subtitleCallback, callback)
}
else{
} else {
loadExtractor(id, data, subtitleCallback, callback)
}
}

View file

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

View file

@ -25,7 +25,8 @@ class PeliSmartProvider: MainAPI() {
Pair("$mainUrl/documentales/", "Documentales"),
)
for ((url, name) in urls) {
// has no inf loading
urls.apmap { (url, name) ->
try {
val soup = app.get(url).document
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.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.Qualities
@ -19,14 +18,18 @@ class SoaptwoDayProvider : MainAPI() {
TvType.TvSeries,
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
val items = ArrayList<HomePageList>()
val urls = listOf(
Pair("$mainUrl/movielist/", "Movies"),
Pair("$mainUrl/tvlist/", "TV Series"),
override val mainPage = mainPageOf(
Pair("$mainUrl/movielist?page=", "Movies"),
Pair("$mainUrl/tvlist?page=", "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 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")
@ -43,13 +46,7 @@ class SoaptwoDayProvider : MainAPI() {
null,
)
}
items.add(HomePageList(name, home))
} catch (e: Exception) {
logError(e)
}
}
return HomePageResponse(items)
return newHomePageResponse(categoryName, home)
}
override suspend fun search(query: String): List<SearchResponse> {

View file

@ -1,10 +1,9 @@
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.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
class TantifilmProvider : MainAPI() {
@ -18,15 +17,18 @@ class TantifilmProvider : MainAPI() {
TvType.TvSeries,
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
val items = ArrayList<HomePageList>()
val urls = listOf(
Pair("$mainUrl/watch-genre/serie-tv/", "Serie Tv"),
Pair("$mainUrl/watch-genre/azione/", "Azione"),
Pair("$mainUrl/watch-genre/avventura/", "Avventura"),
override val mainPage = mainPageOf(
Pair("$mainUrl/watch-genre/serie-tv/page/", "Serie Tv"),
Pair("$mainUrl/watch-genre/azione/page/", "Azione"),
Pair("$mainUrl/watch-genre/avventura/page/", "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 home = soup.select("div.media3").map {
val title = it.selectFirst("p")!!.text().substringBefore("(")
@ -41,14 +43,7 @@ class TantifilmProvider : MainAPI() {
null,
)
}
items.add(HomePageList(name, home))
} catch (e: Exception) {
logError(e)
}
}
if (items.size <= 0) throw ErrorLoadingException()
return HomePageResponse(items)
return newHomePageResponse(categoryName, home)
}
override suspend fun search(query: String): List<SearchResponse> {
@ -147,7 +142,8 @@ class TantifilmProvider : MainAPI() {
title,
url,
type,
episodeList) {
episodeList
) {
this.posterUrl = fixUrlNull(poster)
this.year = year.toIntOrNull()
this.plot = descipt[0]

View file

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