updated mainapi

This commit is contained in:
LagradOst 2022-07-31 17:02:22 +02:00
parent 65804d7739
commit 4dd72058c2
85 changed files with 143 additions and 123 deletions

View file

@ -382,6 +382,11 @@ data class MainPageData(
val data: String,
)
data class MainPageRequest(
val name: String,
val data: String,
)
/** return list of MainPageData with url to name, make for more readable code */
fun mainPageOf(vararg elements: Pair<String, String>): List<MainPageData> {
return elements.map { (url, name) -> MainPageData(name = name, data = url) }
@ -462,8 +467,7 @@ abstract class MainAPI {
@WorkerThread
open suspend fun getMainPage(
page: Int,
categoryName: String,
categoryData: String
request: MainPageRequest,
): HomePageResponse? {
throw NotImplementedError()
}
@ -957,6 +961,7 @@ interface LoadResponse {
var comingSoon: Boolean
var syncData: MutableMap<String, String>
var posterHeaders: Map<String, String>?
var backgroundPosterUrl: String?
companion object {
private val malIdPrefix = malApi.idPrefix
@ -1100,9 +1105,30 @@ data class NextAiring(
val unixTime: Long,
)
data class SeasonData(
val season: Int,
val name: String? = null,
)
interface EpisodeResponse {
var showStatus: ShowStatus?
var nextAiring: NextAiring?
var seasonNames: List<SeasonData>?
}
@JvmName("addSeasonNamesString")
fun EpisodeResponse.addSeasonNames(names: List<String>) {
this.seasonNames = if (names.isEmpty()) null else names.mapIndexed { index, s ->
SeasonData(
season = index + 1,
s
)
}
}
@JvmName("addSeasonNamesSeasonData")
fun EpisodeResponse.addSeasonNames(names: List<SeasonData>) {
this.seasonNames = names.ifEmpty { null }
}
data class TorrentLoadResponse(
@ -1124,6 +1150,7 @@ data class TorrentLoadResponse(
override var comingSoon: Boolean = false,
override var syncData: MutableMap<String, String> = mutableMapOf(),
override var posterHeaders: Map<String, String>? = null,
override var backgroundPosterUrl: String? = null,
) : LoadResponse
data class AnimeLoadResponse(
@ -1153,6 +1180,8 @@ data class AnimeLoadResponse(
override var syncData: MutableMap<String, String> = mutableMapOf(),
override var posterHeaders: Map<String, String>? = null,
override var nextAiring: NextAiring? = null,
override var seasonNames: List<SeasonData>? = null,
override var backgroundPosterUrl: String? = null,
) : LoadResponse, EpisodeResponse
fun AnimeLoadResponse.addEpisodes(status: DubStatus, episodes: List<Episode>?) {
@ -1200,6 +1229,7 @@ data class LiveStreamLoadResponse(
override var comingSoon: Boolean = false,
override var syncData: MutableMap<String, String> = mutableMapOf(),
override var posterHeaders: Map<String, String>? = null,
override var backgroundPosterUrl: String? = null,
) : LoadResponse
data class MovieLoadResponse(
@ -1222,6 +1252,7 @@ data class MovieLoadResponse(
override var comingSoon: Boolean = false,
override var syncData: MutableMap<String, String> = mutableMapOf(),
override var posterHeaders: Map<String, String>? = null,
override var backgroundPosterUrl: String? = null,
) : LoadResponse
suspend fun <T> MainAPI.newMovieLoadResponse(
@ -1344,6 +1375,8 @@ data class TvSeriesLoadResponse(
override var syncData: MutableMap<String, String> = mutableMapOf(),
override var posterHeaders: Map<String, String>? = null,
override var nextAiring: NextAiring? = null,
override var seasonNames: List<SeasonData>? = null,
override var backgroundPosterUrl: String? = null,
) : LoadResponse, EpisodeResponse
suspend fun MainAPI.newTvSeriesLoadResponse(

View file

@ -104,7 +104,7 @@ class AllAnimeProvider : MainAPI() {
@JsonProperty("__typename") val _typename: String? = null
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val items = ArrayList<HomePageList>()
val urls = listOf(
// Pair(

View file

@ -114,7 +114,7 @@ class AniPlayProvider : MainAPI() {
@JsonProperty("videoUrl") val url: String
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val response = app.get("$mainUrl/api/home/latest-episodes?page=0").parsed<List<ApiMainPageAnime>>()
val results = response.map{

View file

@ -44,7 +44,7 @@ class AniflixProvider : MainAPI() {
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val items = ArrayList<HomePageList>()
val soup = app.get(mainUrl).document
val elements = listOf(

View file

@ -62,7 +62,7 @@ class AnimeIndoProvider : MainAPI() {
}
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = request(mainUrl).document
val homePageList = ArrayList<HomePageList>()

View file

@ -58,7 +58,7 @@ class AnimePaheProvider : MainAPI() {
TvType.OVA
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
data class Data(
@JsonProperty("id") val id: Int,
@JsonProperty("anime_id") val animeId: Int,

View file

@ -47,7 +47,7 @@ class AnimeSailProvider : MainAPI() {
)
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = request(mainUrl).document
val homePageList = ArrayList<HomePageList>()

View file

@ -64,7 +64,7 @@ class AnimeSaturnProvider : MainAPI() {
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = app.get(mainUrl).document
val list = ArrayList<HomePageList>()
document.select("div.container:has(span.badge-saturn)").forEach {

View file

@ -130,7 +130,7 @@ class AnimeWorldProvider : MainAPI() {
}
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = request(mainUrl).document
val list = ArrayList<HomePageList>()

View file

@ -30,7 +30,7 @@ class AnimefenixProvider:MainAPI() {
else DubStatus.Subbed
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val urls = listOf(
Pair("$mainUrl/", "Animes"),
Pair("$mainUrl/animes?type[]=movie&order=default", "Peliculas", ),

View file

@ -22,7 +22,7 @@ class AnimeflvIOProvider:MainAPI() {
TvType.OVA,
TvType.Anime,
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val items = ArrayList<HomePageList>()
val urls = listOf(
Pair("$mainUrl/series", "Series actualizadas",),

View file

@ -34,7 +34,7 @@ class AnimeflvnetProvider : MainAPI() {
TvType.Anime,
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val urls = listOf(
Pair("$mainUrl/browse?type[]=movie&order=updated", "Películas"),
Pair("$mainUrl/browse?status[]=2&order=default", "Animes"),

View file

@ -26,7 +26,7 @@ class AnimekisaProvider : MainAPI() {
@JsonProperty("html") val html: String
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val urls = listOf(
Pair("$mainUrl/ajax/list/views?type=all", "All animes"),
Pair("$mainUrl/ajax/list/views?type=day", "Trending now"),

View file

@ -96,7 +96,7 @@ class DubbedAnimeProvider : MainAPI() {
}
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val trendingUrl = "$mainUrl/xz/trending.php?_=$unixTimeMS"
val lastEpisodeUrl = "$mainUrl/xz/epgrid.php?p=1&_=$unixTimeMS"
val recentlyAddedUrl = "$mainUrl/xz/gridgrabrecent.php?p=1&_=$unixTimeMS"

View file

@ -202,16 +202,15 @@ class GogoanimeProvider : MainAPI() {
override suspend fun getMainPage(
page: Int,
categoryName: String,
categoryData: String
request : MainPageRequest
): HomePageResponse {
val params = mapOf("page" to page.toString(), "type" to categoryData)
val params = mapOf("page" to page.toString(), "type" to request.data)
val html = app.get(
"https://ajax.gogo-load.com/ajax/page-recent-release.html",
headers = headers,
params = params
)
val isSub = listOf(1, 3).contains(categoryData.toInt())
val isSub = listOf(1, 3).contains(request.data.toInt())
val home = parseRegex.findAll(html.text).map {
val (link, epNum, title, poster) = it.destructured
@ -221,7 +220,7 @@ class GogoanimeProvider : MainAPI() {
}
}.toList()
return newHomePageResponse(categoryName, home)
return newHomePageResponse(request.name, home)
}
override suspend fun search(query: String): ArrayList<SearchResponse> {

View file

@ -46,7 +46,7 @@ class GomunimeProvider : MainAPI() {
@JsonProperty("html") val html: String
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val urls = listOf(
Pair("e", "Episode Baru"),
Pair("c", "Completed"),

View file

@ -32,7 +32,7 @@ class JKAnimeProvider : MainAPI() {
TvType.Anime,
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val urls = listOf(
Pair(
"$mainUrl/directorio/?filtro=fecha&tipo=TV&estado=1&fecha=none&temporada=none&orden=desc",

View file

@ -14,7 +14,7 @@ class KawaiifuProvider : MainAPI() {
override val supportedTypes = setOf(TvType.Anime, TvType.AnimeMovie)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val items = ArrayList<HomePageList>()
val resp = app.get(mainUrl).text

View file

@ -17,7 +17,7 @@ class KimCartoonProvider : MainAPI() {
return if (url.startsWith("/")) mainUrl + url else url
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val doc = app.get(mainUrl).document.select("#container")
val response = mutableListOf(
HomePageList(

View file

@ -38,7 +38,7 @@ class KuramanimeProvider : MainAPI() {
}
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = app.get(mainUrl).document
val homePageList = ArrayList<HomePageList>()

View file

@ -39,7 +39,7 @@ class KuronimeProvider : MainAPI() {
}
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = app.get(mainUrl).document
val homePageList = ArrayList<HomePageList>()

View file

@ -34,7 +34,7 @@ class MonoschinosProvider : MainAPI() {
TvType.Anime,
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val urls = listOf(
Pair("$mainUrl/emision", "En emisión"),
Pair(

View file

@ -23,7 +23,7 @@ class MundoDonghuaProvider : MainAPI() {
TvType.Anime,
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val urls = listOf(
Pair("$mainUrl/lista-donghuas", "Donghuas"),
)

View file

@ -40,7 +40,7 @@ class NeonimeProvider : MainAPI() {
}
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = app.get(mainUrl).document
val homePageList = ArrayList<HomePageList>()

View file

@ -148,10 +148,9 @@ class NineAnimeProvider : MainAPI() {
override suspend fun getMainPage(
page: Int,
categoryName: String,
categoryData: String
request: MainPageRequest
): HomePageResponse {
val url = categoryData + page
val url = request.data + page
val home = Jsoup.parse(
app.get(
url
@ -175,7 +174,7 @@ class NineAnimeProvider : MainAPI() {
}
}
return newHomePageResponse(categoryName, home)
return newHomePageResponse(request.name, home)
}
data class Response(
@ -238,9 +237,10 @@ class NineAnimeProvider : MainAPI() {
val title = (info.selectFirst(".title") ?: info.selectFirst(".d-title"))?.text()
?: throw ErrorLoadingException("Could not find title")
val body =
app.get("$mainUrl/ajax/episode/list/$id?vrf=${encodeVrf(id, cipherKey)}")
.parsed<Response>().html
val vrf = encodeVrf(id, cipherKey)
val req = app.get("$mainUrl/ajax/episode/list/$id?vrf=$vrf")
val body = req.parsedSafe<Response>()?.html
?: throw ErrorLoadingException("Could not parse json with cipherKey=$cipherKey code=${req.code}")
val subEpisodes = ArrayList<Episode>()
val dubEpisodes = ArrayList<Episode>()

View file

@ -40,7 +40,7 @@ class NontonAnimeIDProvider : MainAPI() {
}
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = app.get(mainUrl).document
val homePageList = ArrayList<HomePageList>()

View file

@ -40,7 +40,7 @@ class OploverzProvider : MainAPI() {
}
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = app.get(mainUrl).document
val homePageList = ArrayList<HomePageList>()

View file

@ -7,7 +7,6 @@ import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.Jsoup
import org.jsoup.nodes.Element
import java.util.ArrayList
class OtakudesuProvider : MainAPI() {
override var mainUrl = "https://otakudesu.watch"
@ -38,7 +37,7 @@ class OtakudesuProvider : MainAPI() {
}
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = app.get(mainUrl).document
val homePageList = ArrayList<HomePageList>()

View file

@ -44,7 +44,7 @@ class TenshiProvider : MainAPI() {
}
}*/
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val items = ArrayList<HomePageList>()
val soup = app.get(mainUrl, interceptor = ddosGuardKiller).document
for (section in soup.select("#content > section")) {

View file

@ -39,7 +39,7 @@ class TocanimeProvider : MainAPI() {
}
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = app.get(mainUrl).document
val homePageList = ArrayList<HomePageList>()

View file

@ -30,7 +30,7 @@ class WcoProvider : MainAPI() {
TvType.OVA
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val urls = listOf(
Pair("$mainUrl/ajax/list/recently_updated?type=tv", "Recently Updated Anime"),
Pair("$mainUrl/ajax/list/recently_updated?type=movie", "Recently Updated Movies"),

View file

@ -77,7 +77,7 @@ class ZoroProvider : MainAPI() {
}
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val html = app.get("$mainUrl/home").text
val document = Jsoup.parse(html)

View file

@ -37,7 +37,7 @@ class EjaTv : MainAPI() {
)
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
// Maybe this based on app language or as setting?
val language = "English"
val dataMap = mapOf(

View file

@ -196,7 +196,7 @@ open class TmdbProvider : MainAPI() {
}
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
// SAME AS DISCOVER IT SEEMS
// val popularSeries = tmdb.tvService().popular(1, "en-US").execute().body()?.results?.map {

View file

@ -34,7 +34,7 @@ class AkwamProvider : MainAPI() {
)
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
// Title, Url
val moviesUrl = listOf(
"Movies" to "$mainUrl/movies",

View file

@ -27,7 +27,7 @@ class AllMoviesForYouProvider : MainAPI() {
TvType.TvSeries
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val items = ArrayList<HomePageList>()
val soup = app.get(mainUrl).document
val urls = listOf(

View file

@ -23,12 +23,8 @@ class AltadefinizioneProvider : MainAPI() {
Pair("$mainUrl/cinema/page/", "Ora al cinema")
)
override suspend fun getMainPage(
page: Int,
categoryName: String,
categoryData: String
): HomePageResponse {
val url = categoryData + page
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
val url = request.data + page
val soup = app.get(url).document
val home = soup.select("div.box").map {
@ -48,7 +44,7 @@ class AltadefinizioneProvider : MainAPI() {
quality,
)
}
return newHomePageResponse(categoryName, home)
return newHomePageResponse(request.name, home)
}
override suspend fun search(query: String): List<SearchResponse> {

View file

@ -110,7 +110,7 @@ class AsiaFlixProvider : MainAPI() {
)
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val headers = mapOf("X-Requested-By" to "asiaflix-web")
val response = app.get("$apiUrl/dashboard", headers = headers).text

View file

@ -23,7 +23,7 @@ open class BflixProvider : MainAPI() {
//override val uniqueId: Int by lazy { "BflixProvider".hashCode() }
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val items = ArrayList<HomePageList>()
val soup = app.get("$mainUrl/home").document
val testa = listOf(

View file

@ -41,7 +41,7 @@ class CimaNowProvider : MainAPI() {
)
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val doc = app.get("$mainUrl/home", headers = mapOf("user-agent" to "MONKE")).document
val pages = doc.select("section").not("section:contains(أختر وجهتك المفضلة)").not("section:contains(تم اضافته حديثاً)").apmap {

View file

@ -26,10 +26,9 @@ class CineblogProvider : MainAPI() {
override suspend fun getMainPage(
page: Int,
categoryName: String,
categoryData: String
request : MainPageRequest
): HomePageResponse {
val url = categoryData.replace("number", page.toString())
val url = request.data.replace("number", page.toString())
val soup = app.get(url, referer = url.substringBefore("page")).document
val home = soup.select("article.item").map {
val title = it.selectFirst("div.data > h3 > a")!!.text().substringBefore("(")
@ -46,7 +45,7 @@ class CineblogProvider : MainAPI() {
quality = quality
)
}
return newHomePageResponse(categoryName, home)
return newHomePageResponse(request.name, home)
}
override suspend fun search(query: String): List<SearchResponse> {

View file

@ -26,10 +26,9 @@ class CinecalidadProvider : MainAPI() {
override suspend fun getMainPage(
page: Int,
categoryName: String,
categoryData: String
request : MainPageRequest
): HomePageResponse {
val url = categoryData + page
val url = request.data + page
val soup = app.get(url).document
val home = soup.select(".item.movies").map {
@ -46,7 +45,7 @@ class CinecalidadProvider : MainAPI() {
)
}
return newHomePageResponse(categoryName, home)
return newHomePageResponse(request.name, home)
}
override suspend fun search(query: String): List<SearchResponse> {

View file

@ -19,7 +19,7 @@ class CuevanaProvider : MainAPI() {
TvType.TvSeries,
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val items = ArrayList<HomePageList>()
val urls = listOf(
Pair(mainUrl, "Recientemente actualizadas"),

View file

@ -31,7 +31,7 @@ class DoramasYTProvider : MainAPI() {
TvType.AsianDrama,
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val urls = listOf(
Pair("$mainUrl/emision", "En emisión"),
Pair(

View file

@ -14,7 +14,7 @@ class DramaSeeProvider : MainAPI() {
override val hasDownloadSupport = true
override val supportedTypes = setOf(TvType.AsianDrama)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val headers = mapOf("X-Requested-By" to mainUrl)
val document = app.get(mainUrl, headers = headers).document
val mainbody = document.getElementsByTag("body")

View file

@ -30,7 +30,7 @@ class DramaidProvider : MainAPI() {
}
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = app.get(mainUrl).document
val homePageList = ArrayList<HomePageList>()

View file

@ -41,7 +41,7 @@ class EgyBestProvider : MainAPI() {
)
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
// url, title
val doc = app.get(mainUrl).document
val pages = arrayListOf<HomePageList>()

View file

@ -15,7 +15,7 @@ class ElifilmsProvider : MainAPI() {
TvType.Movie,
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val items = ArrayList<HomePageList>()
val newest = app.get(mainUrl).document.selectFirst("a.fav_link.premiera")?.attr("href")
val urls = listOf(

View file

@ -25,10 +25,9 @@ class EntrepeliculasyseriesProvider : MainAPI() {
override suspend fun getMainPage(
page: Int,
categoryName: String,
categoryData: String
request : MainPageRequest
): HomePageResponse {
val url = categoryData + page
val url = request.data + page
val soup = app.get(url).document
val home = soup.select("ul.list-movie li").map {
@ -45,7 +44,7 @@ class EntrepeliculasyseriesProvider : MainAPI() {
)
}
return newHomePageResponse(categoryName, home)
return newHomePageResponse(request.name, home)
}
override suspend fun search(query: String): List<SearchResponse> {

View file

@ -28,7 +28,7 @@ class EstrenosDoramasProvider : MainAPI() {
TvType.AsianDrama,
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val urls = listOf(
Pair(mainUrl, "Últimas series"),
Pair("$mainUrl/category/peliculas", "Películas"),

View file

@ -35,7 +35,7 @@ class FaselHDProvider : MainAPI() {
)
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
// Title, Url
val moviesUrl = listOf(
Pair("Movies", "$mainUrl/all-movies/page/"+(0..10).random()),

View file

@ -18,7 +18,7 @@ class FilmanProvider : MainAPI() {
TvType.TvSeries
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = app.get(mainUrl).document
val lists = document.select("#item-list,#series-list")
val categories = ArrayList<HomePageList>()

View file

@ -9,7 +9,6 @@ import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.ShortLink
import com.lagradost.cloudstream3.utils.loadExtractor
import com.lagradost.nicehttp.NiceResponse
import org.jsoup.nodes.Element
@ -32,10 +31,9 @@ class FilmpertuttiProvider : MainAPI() {
override suspend fun getMainPage(
page: Int,
categoryName: String,
categoryData: String
request: MainPageRequest
): HomePageResponse {
val url = categoryData + page
val url = request.data + page
val soup = app.get(url).document
val home = soup.select("ul.posts > li").map {
@ -58,7 +56,7 @@ class FilmpertuttiProvider : MainAPI() {
}
}
return newHomePageResponse(categoryName, home)
return newHomePageResponse(request.name, home)
}
override suspend fun search(query: String): List<SearchResponse> {

View file

@ -232,7 +232,7 @@ class FrenchStreamProvider : MainAPI() {
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse? {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse? {
val document = app.get(mainUrl).document
val docs = document.select("div.sect")
val returnList = docs.mapNotNull {

View file

@ -69,7 +69,7 @@ class HDMProvider : MainAPI() {
)
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val html = app.get(mainUrl, timeout = 25).text
val document = Jsoup.parse(html)
val all = ArrayList<HomePageList>()

View file

@ -19,7 +19,7 @@ class HDMovie5 : MainAPI() {
TvType.TvSeries,
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val doc = app.get(mainUrl).document.select("div.content")
val list = mapOf(
"Featured Movies" to "featured",

View file

@ -28,7 +28,7 @@ class HDrezkaProvider : MainAPI() {
TvType.AsianDrama
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val items = ArrayList<HomePageList>()

View file

@ -14,7 +14,7 @@ class IHaveNoTvProvider : MainAPI() {
override val supportedTypes = setOf(TvType.Documentary)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
// Uhh, I am too lazy to scrape the "latest documentaries" and "recommended documentaries",
// so I am just scraping 3 random categories
val allCategories = listOf(

View file

@ -22,7 +22,7 @@ class IdlixProvider : MainAPI() {
TvType.TvSeries,
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = app.get(mainUrl).document
val homePageList = ArrayList<HomePageList>()

View file

@ -26,7 +26,7 @@ class KdramaHoodProvider : MainAPI() {
@JsonProperty("file") val file: String
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val doc = app.get("$mainUrl/home2").document
val home = ArrayList<HomePageList>()

View file

@ -21,7 +21,7 @@ class LayarKacaProvider : MainAPI() {
TvType.AsianDrama
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = app.get(mainUrl).document
val homePageList = ArrayList<HomePageList>()

View file

@ -22,7 +22,7 @@ class MultiplexProvider : MainAPI() {
TvType.AsianDrama
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = app.get(mainUrl).document
val homePageList = ArrayList<HomePageList>()

View file

@ -44,7 +44,7 @@ class MyCimaProvider : MainAPI() {
)
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
// Title, Url
val moviesUrl = listOf(
"Movies" to "$mainUrl/movies/page/" + (0..25).random(),

View file

@ -212,7 +212,7 @@ class NginxProvider : MainAPI() {
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val authHeader =
getAuthHeader() // call again because it isn't reloaded if in main class and storedCredentials loads after

View file

@ -17,7 +17,7 @@ class PeliSmartProvider: MainAPI() {
)
override val vpnStatus = VPNStatus.MightBeNeeded //Due to evoload sometimes not loading
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val items = ArrayList<HomePageList>()
val urls = listOf(
Pair("$mainUrl/peliculas/", "Peliculas"),

View file

@ -18,7 +18,7 @@ class PelisflixProvider : MainAPI() {
TvType.TvSeries,
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val items = ArrayList<HomePageList>()
val urls = listOf(
Pair("$mainUrl/ver-peliculas-online-gratis-fullhdc3/", "Películas"),

View file

@ -16,7 +16,7 @@ class PelisplusHDProvider:MainAPI() {
TvType.Movie,
TvType.TvSeries,
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val items = ArrayList<HomePageList>()
val document = app.get(mainUrl).document
val map = mapOf(

View file

@ -142,7 +142,7 @@ open class PelisplusProviderTemplate : MainAPI() {
// This loads the homepage, which is basically a collection of search results with labels.
// Optional function, but make sure to enable hasMainPage if you program this.
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val urls = homePageUrlList
val homePageList = ArrayList<HomePageList>()
// .pmap {} is used to fetch the different pages in parallel

View file

@ -23,7 +23,7 @@ class PhimmoichillProvider : MainAPI() {
TvType.AsianDrama
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = app.get(mainUrl).document
val homePageList = ArrayList<HomePageList>()

View file

@ -15,7 +15,7 @@ class PinoyHDXyzProvider : MainAPI() {
override val hasMainPage = true
override val hasQuickSearch = false
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val all = ArrayList<HomePageList>()
val document = app.get(mainUrl, referer = mainUrl).document
val mainbody = document.getElementsByTag("body")

View file

@ -16,7 +16,7 @@ class PinoyMoviePediaProvider : MainAPI() {
override val hasMainPage = true
override val hasQuickSearch = false
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val all = ArrayList<HomePageList>()
val document = app.get(mainUrl).document
val mainbody = document.getElementsByTag("body")

View file

@ -90,7 +90,7 @@ class PinoyMoviesEsProvider : MainAPI() {
return all
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val all = ArrayList<HomePageList>()
val document = app.get(mainUrl).document
val mainbody = document.getElementsByTag("body")

View file

@ -27,7 +27,7 @@ class RebahinProvider : MainAPI() {
TvType.AsianDrama
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val urls = listOf(
Pair("Featured", "xtab1"),
Pair("Film Terbaru", "xtab2"),

View file

@ -18,7 +18,7 @@ class SeriesflixProvider : MainAPI() {
TvType.TvSeries,
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val items = ArrayList<HomePageList>()
val urls = listOf(
Pair("$mainUrl/ver-series-online/", "Series"),

View file

@ -43,7 +43,7 @@ open class SflixProvider : MainAPI() {
)
override val vpnStatus = VPNStatus.None
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val html = app.get("$mainUrl/home").text
val document = Jsoup.parse(html)

View file

@ -25,10 +25,9 @@ class SoaptwoDayProvider : MainAPI() {
override suspend fun getMainPage(
page: Int,
categoryName: String,
categoryData: String
request : MainPageRequest
): HomePageResponse {
val url = categoryData + page
val url = request.data + page
val soup = app.get(url).document
val home =
@ -46,7 +45,7 @@ class SoaptwoDayProvider : MainAPI() {
null,
)
}
return newHomePageResponse(categoryName, home)
return newHomePageResponse(request.name, home)
}
override suspend fun search(query: String): List<SearchResponse> {

View file

@ -174,7 +174,7 @@ class StreamingcommunityProvider : MainAPI() {
val posterMap = hashMapOf<String, String>()
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val items = ArrayList<HomePageList>()
val document = app.get(mainUrl).document
document.select("slider-title").subList(0, 3).map { it ->

View file

@ -25,10 +25,9 @@ class TantifilmProvider : MainAPI() {
override suspend fun getMainPage(
page: Int,
categoryName: String,
categoryData: String
request : MainPageRequest
): HomePageResponse {
val url = categoryData + page
val url = request.data + page
val soup = app.get(url).document
val home = soup.select("div.media3").map {
val title = it.selectFirst("p")!!.text().substringBefore("(")
@ -43,7 +42,7 @@ class TantifilmProvider : MainAPI() {
null,
)
}
return newHomePageResponse(categoryName, home)
return newHomePageResponse(request.name, home)
}
override suspend fun search(query: String): List<SearchResponse> {

View file

@ -143,7 +143,7 @@ class TheFlixToProvider : MainAPI() {
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val items = ArrayList<HomePageList>()
val doc = app.get(mainUrl).document
val scriptText = doc.selectFirst("script[type=application/json]")!!.data()

View file

@ -23,7 +23,7 @@ class UakinoProvider : MainAPI() {
TvType.Anime
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = app.get(mainUrl).document
val homePageList = ArrayList<HomePageList>()

View file

@ -210,7 +210,7 @@ open class VidstreamProviderTemplate : MainAPI() {
// This loads the homepage, which is basically a collection of search results with labels.
// Optional function, but make sure to enable hasMainPage if you program this.
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val urls = homePageUrlList
val homePageList = ArrayList<HomePageList>()
// .pmap {} is used to fetch the different pages in parallel

View file

@ -18,7 +18,7 @@ class WatchAsianProvider : MainAPI() {
override val hasDownloadSupport = true
override val supportedTypes = setOf(TvType.AsianDrama)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val headers = mapOf("X-Requested-By" to mainUrl)
val doc = app.get(mainUrl, headers = headers).document
val rowPair = mutableListOf<Pair<String, String>>()

View file

@ -40,7 +40,7 @@ class XcineProvider : MainAPI() {
)
}
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = app.get(mainUrl).document
val sections = document.select("div.group-film")
return HomePageResponse(sections.mapNotNull { section ->

View file

@ -19,7 +19,7 @@ class YomoviesProvider : MainAPI() {
TvType.TvSeries,
)
override suspend fun getMainPage(page: Int, categoryName: String, categoryData: String): HomePageResponse {
override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse {
val document = app.get(mainUrl).document
val homePageList = ArrayList<HomePageList>()

View file

@ -63,9 +63,9 @@ class APIRepository(val api: MainAPI) {
suspend fun getMainPage(page: Int, nameIndex: Int? = null): Resource<List<HomePageResponse?>> {
return safeApiCall {
nameIndex?.let { api.mainPage.getOrNull(it) }?.let { data ->
listOf(api.getMainPage(page, data.name, data.data))
listOf(api.getMainPage(page, MainPageRequest(data.name, data.data)))
} ?: api.mainPage.apmap { data ->
api.getMainPage(page, data.name, data.data)
api.getMainPage(page, MainPageRequest(data.name, data.data))
}
}
}