Merge remote-tracking branch 'upstream/master'

This commit is contained in:
antonydp 2023-01-23 21:34:08 +01:00
commit 5d3c9bda8c
14 changed files with 690 additions and 388 deletions

View File

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 2 version = 3
cloudstream { cloudstream {
@ -22,4 +22,5 @@ cloudstream {
"Movie", "Movie",
) )
iconUrl = "https://www.google.com/s2/favicons?domain=casacinema.lol&sz=%size%"
} }

View File

@ -23,42 +23,143 @@ class CasaCinemaProvider : MainAPI() { // all providers must be an instance of M
private val interceptor = CloudflareKiller() private val interceptor = CloudflareKiller()
override val mainPage = override val mainPage =
mainPageOf( mainPageOf(
"$mainUrl/category/serie-tv/page/" to "Ultime Serie Tv", "$mainUrl/category/serie-tv/page/" to "Ultime Serie Tv",
"$mainUrl/category/film/page/" to "Ultimi Film", "$mainUrl/category/film/page/" to "Ultimi Film",
) )
private fun fixTitle(element: Element?): String {
return element?.text()
?.trim()
?.substringBefore("Streaming")
?.replace("[HD]", "")
?.replace("\\(\\d{4}\\)".toRegex(), "")
?: "No Title found"
}
private fun Element?.isMovie(): Boolean {
return (this
?.text() ?: "")
.contains("\\(\\d{4}\\)".toRegex())
}
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse { override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
val url = request.data + page val url = request.data + page
val soup = app.get(url).document val soup = app.get(url, referer = mainUrl).document
val home = soup.select("ul.posts>li").mapNotNull { it.toSearchResult() } val home = soup.select("ul.posts>li").mapNotNull { it.toSearchResult() }
val hasNext = soup.select("div.navigation>ul>li>a").last()?.text() == "Pagina successiva »" val hasNext = soup.select("div.navigation>ul>li>a").last()?.text() == "Pagina successiva »"
return newHomePageResponse(arrayListOf(HomePageList(request.name, home)), hasNext = hasNext) return newHomePageResponse(arrayListOf(HomePageList(request.name, home)), hasNext = hasNext)
} }
override suspend fun search(query: String): List<SearchResponse> {
val queryFormatted = query.replace(" ", "+")
val url = "$mainUrl/?s=$queryFormatted"
val doc = app.get(url, referer = mainUrl, interceptor = interceptor).document
return doc.select("ul.posts>li").map { it.toSearchResult() }
}
private fun Element.toSearchResult(): SearchResponse { private fun Element.toSearchResult(): SearchResponse {
val title = val title = fixTitle(this.selectFirst(".title"))
this.selectFirst(".title")?.text()?.replace("[HD]", "")?.substringBefore("(") val isMovie = this.selectFirst(".title").isMovie()
?: "No title"
val isMovie = (this.selectFirst(".title")?.text() ?: "").contains("\\(\\d{4}\\)".toRegex())
val link = val link =
this.selectFirst("a")?.attr("href") ?: throw ErrorLoadingException("No Link found") this.selectFirst("a")?.attr("href") ?: throw ErrorLoadingException("No Link found")
val quality = this.selectFirst("div.hd")?.text() val quality = this.selectFirst("div.hd")?.text()
val posterUrl = this.selectFirst("a")?.attr("data-thumbnail") val posterUrl = this.selectFirst("a")?.attr("data-thumbnail")
if (isMovie) { return if (isMovie) {
return newMovieSearchResponse(title, link, TvType.Movie) { newMovieSearchResponse(title, link, TvType.Movie) {
addPoster(posterUrl)
quality?.let { addQuality(it) }
}
} else {
newTvSeriesSearchResponse(title, link, TvType.TvSeries) {
addPoster(posterUrl)
quality?.let { addQuality(it) }
}
}
}
override suspend fun load(url: String): LoadResponse {
val document = app.get(url, referer = mainUrl).document
val type =
if (document.select("div.seasons-wraper").isNotEmpty()) TvType.TvSeries
else TvType.Movie
val title = fixTitle(document.selectFirst("div.row > h1"))
val description = document.select("div.element").last()?.text()
val year = document.selectFirst("div.element>a.tag")
?.text()
?.substringBefore("-")
?.substringAfter(",")
?.filter { it.isDigit() }
val poster = document.selectFirst("img.thumbnail")?.attr("src")
val rating = document.selectFirst("div.rating>div.value")?.text()?.trim()?.toRatingInt()
val recomm = document.select("div.crp_related>ul>li").map { it.toRecommendResult() }
if (type == TvType.TvSeries) {
val episodeList =
document.select("div.accordion>div.accordion-item")
.map { element ->
val season =
element.selectFirst("li.s_title>span.season-title")
?.text()
?.toIntOrNull()
?: 0
element.select("div.episode-wrap").map { episode ->
episode.toEpisode(season)
}
}
.flatten()
return newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodeList) {
this.year = year?.toIntOrNull()
this.plot = description
this.recommendations = recomm
addPoster(poster)
addRating(rating)
}
} else {
val actors: List<ActorData> =
document.select("div.cast_wraper>ul>li").map { actordata ->
val actorName = actordata.selectFirst("strong")?.text() ?: ""
val actorImage: String =
actordata.selectFirst("figure>img")?.attr("src") ?: ""
ActorData(actor = Actor(actorName, image = actorImage))
}
val data = document.select(".embed-player").map { it.attr("data-id") }.toJson()
return newMovieLoadResponse(title, data, TvType.Movie, data) {
this.year = year?.toIntOrNull()
this.plot = description
this.actors = actors
this.recommendations = recomm
addPoster(poster)
addRating(rating)
}
}
}
private fun Element.toRecommendResult(): SearchResponse {
val title =
fixTitle(this.selectFirst("span.crp_title"))
val isMovie = this.selectFirst("span.crp_title").isMovie()
val link =
this.selectFirst("a")?.attr("href") ?: throw ErrorLoadingException("No Link found")
val quality =
this.selectFirst("span.crp_title")?.text()?.substringAfter("[")?.substringBefore("]")
val posterUrl = this.selectFirst("img")?.attr("src")
return if (isMovie) {
newMovieSearchResponse(title, link, TvType.Movie) {
addPoster(posterUrl) addPoster(posterUrl)
if (quality != null) { if (quality != null) {
addQuality(quality) addQuality(quality)
} }
} }
} else { } else {
return newTvSeriesSearchResponse(title, link, TvType.TvSeries) { newTvSeriesSearchResponse(title, link, TvType.TvSeries) {
addPoster(posterUrl) addPoster(posterUrl)
if (quality != null) { if (quality != null) {
addQuality(quality) addQuality(quality)
@ -69,82 +170,31 @@ class CasaCinemaProvider : MainAPI() { // all providers must be an instance of M
private fun Element.toEpisode(season: Int): Episode { private fun Element.toEpisode(season: Int): Episode {
val data = val data =
this.select("div.fix-table>table>tbody>tr>td>a[target=_blank]") this.select("div.fix-table>table>tbody>tr>td>a[target=_blank]")
.map { it.attr("href") } .map { it.attr("href") }
.toJson() // isecure.link .toJson() // isecure.link
val epTitle = this.selectFirst("li.other_link>a")?.text() ?: "No Ep. Title 0" val epNum =
val epNum = epTitle.substringAfter("Episodio ").toInt() this.selectFirst("li.season-no")
return Episode(data, epTitle, season, epNum) ?.text()
} ?.substringAfter("x")
?.substringBefore(" ")
?.filter { it.isDigit() }
.orEmpty().ifBlank { "0" }
override suspend fun search(query: String): List<SearchResponse> { val epTitle =
val queryFormatted = query.replace(" ", "+") this.selectFirst("li.other_link>a")?.text().orEmpty().ifBlank {
val url = "$mainUrl/?s=$queryFormatted" "Episodio $epNum"
val doc = app.get(url, referer = mainUrl, interceptor = interceptor).document
return doc.select("ul.posts>li").map { it.toSearchResult() }
}
override suspend fun load(url: String): LoadResponse {
val document = app.get(url).document
val type =
if (document.selectFirst("h3")?.text() == "Altri Film:") TvType.Movie
else TvType.TvSeries
val title =
document.selectFirst("div.row > h1")
?.text()
?.replace("[HD]", "")
?.substringBefore("(")
?: "No Title found"
val description = document.select("div.element").last()?.text()
val year = document.selectFirst("div.element>a.tag")?.text()?.substringBefore("-")
val poster = document.selectFirst("img.thumbnail")?.attr("src")
val rating = document.selectFirst("div.rating>div.value")?.text()?.trim()?.toRatingInt()
if (type == TvType.TvSeries) {
val episodeList =
document.select("div.accordion>div.accordion-item")
.map { element ->
val season =
element.selectFirst("li.s_title>span.season-title")
?.text()
?.toIntOrNull()
?: 0
element.select("div.episode-wrap").map { episode ->
episode.toEpisode(season)
}
}
.flatten()
return newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodeList) {
this.year = year?.toIntOrNull()
this.plot = description
addPoster(poster)
addRating(rating)
} }
} else { val posterUrl = this.selectFirst("figure>img")?.attr("src")
val actors: List<ActorData> = return Episode(data, epTitle, season, epNum.toInt(), posterUrl = posterUrl)
document.select("div.cast_wraper>ul>li").map { actordata ->
val actorName = actordata.selectFirst("strong")?.text() ?: ""
val actorImage: String? =
actordata.selectFirst("figure>img")?.attr("src") ?: ""
ActorData(actor = Actor(actorName, image = actorImage))
}
val data = document.select(".embed-player").map { it.attr("data-id") }.toJson()
return newMovieLoadResponse(title, data, TvType.Movie, data) {
this.year = year?.toIntOrNull()
this.plot = description
this.actors = actors
addPoster(poster)
addRating(rating)
}
}
} }
override suspend fun loadLinks( override suspend fun loadLinks(
data: String, data: String,
isCasting: Boolean, isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit, subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
): Boolean { ): Boolean {
parseJson<List<String>>(data).map { videoUrl -> parseJson<List<String>>(data).map { videoUrl ->
loadExtractor(unshorten(videoUrl), data, subtitleCallback, callback) loadExtractor(unshorten(videoUrl), data, subtitleCallback, callback)

View File

@ -34,6 +34,15 @@ class IlGenioDelloStreamingProvider : MainAPI() {
) )
private val interceptor = CloudflareKiller() private val interceptor = CloudflareKiller()
private fun fixTitle(element: Element?): String {
return element?.text()
?.trim()
?.substringBefore("Streaming")
?.replace("[HD]", "")
?.replace("\\(\\d{4}\\)".toRegex(), "")
?: "No Title found"
}
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse { override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
val url = request.data + page val url = request.data + page
@ -45,12 +54,7 @@ class IlGenioDelloStreamingProvider : MainAPI() {
private fun Element.toMainPageResult(): SearchResponse { private fun Element.toMainPageResult(): SearchResponse {
val title = val title =
this.selectFirst("div.data>h3") fixTitle(this.selectFirst("div.data>h3"))
?.text()
?.trim()
?.replace("[HD]", "")
?.replace("\\(\\d{4}\\)".toRegex(), "")
?: "No title"
val isMovie = val isMovie =
(this.selectFirst("div.data>h3")?.text() ?: "").contains("\\(\\d{4}\\)".toRegex()) (this.selectFirst("div.data>h3")?.text() ?: "").contains("\\(\\d{4}\\)".toRegex())
val link = val link =
@ -82,12 +86,7 @@ class IlGenioDelloStreamingProvider : MainAPI() {
private fun Element.toSearchResult(): SearchResponse { private fun Element.toSearchResult(): SearchResponse {
val title = val title =
this.selectFirst("div.title>a") fixTitle(this.selectFirst("div.title>a"))
?.text()
?.trim()
?.replace("[HD]", "")
?.replace("\\(\\d{4}\\)".toRegex(), "")
?: "No title"
val isMovie = val isMovie =
(this.selectFirst("div.title>a")?.text() ?: "").contains("\\(\\d{4}\\)".toRegex()) (this.selectFirst("div.title>a")?.text() ?: "").contains("\\(\\d{4}\\)".toRegex())
val link = val link =
@ -122,13 +121,7 @@ class IlGenioDelloStreamingProvider : MainAPI() {
else TvType.Movie else TvType.Movie
val title = val title =
document.selectFirst("div.data > h1") fixTitle(document.selectFirst("div.data > h1"))
?.text()
?.trim()
?.substringBefore("Streaming")
?.replace("[HD]", "")
?.replace("\\(\\d{4}\\)".toRegex(), "")
?: "No Title found"
val description = val description =
document.selectFirst("div#info") document.selectFirst("div#info")
?.text() ?.text()
@ -143,11 +136,11 @@ class IlGenioDelloStreamingProvider : MainAPI() {
val poster = document.selectFirst("div.poster>img")?.attr("src") val poster = document.selectFirst("div.poster>img")?.attr("src")
val rating = document.selectFirst("span.valor>strong")?.text()?.toRatingInt() val rating = document.selectFirst("span.valor>strong")?.text()?.toRatingInt()
val trailer = val trailer =
"https://www.youtube.com/watch?v=" + document.selectFirst("img.youtube__img")
document.selectFirst("img.youtube__img") ?.attr("src")
?.attr("src") ?.substringAfter("vi/")
?.substringAfter("vi/") ?.substringBefore("/")
?.substringBefore("/") ?.let { "https://www.youtube.com/watch?v=$it" }
val recomm = document.select("article.w_item_b").map { it.toRecommendResult() } val recomm = document.select("article.w_item_b").map { it.toRecommendResult() }
if (type == TvType.TvSeries) { if (type == TvType.TvSeries) {
val episodeList = val episodeList =
@ -176,7 +169,7 @@ class IlGenioDelloStreamingProvider : MainAPI() {
val actors: List<ActorData> = val actors: List<ActorData> =
document.select("div.cast_wraper>ul>li").map { actordata -> document.select("div.cast_wraper>ul>li").map { actordata ->
val actorName = actordata.selectFirst("strong")?.text() ?: "" val actorName = actordata.selectFirst("strong")?.text() ?: ""
val actorImage: String? = val actorImage: String =
actordata.selectFirst("figure>img")?.attr("src") ?: "" actordata.selectFirst("figure>img")?.attr("src") ?: ""
ActorData(actor = Actor(actorName, image = actorImage)) ActorData(actor = Actor(actorName, image = actorImage))
} }
@ -195,12 +188,7 @@ class IlGenioDelloStreamingProvider : MainAPI() {
private fun Element.toRecommendResult(): SearchResponse { private fun Element.toRecommendResult(): SearchResponse {
val title = val title =
this.selectFirst("div.data>h3") fixTitle(this.selectFirst("div.data>h3"))
?.text()
?.trim()
?.replace("[HD]", "")
?.replace("\\(\\d{4}\\)".toRegex(), "")
?: "No title"
val isMovie = val isMovie =
(this.selectFirst("div.data>h3")?.text() ?: "").contains("\\(\\d{4}\\)".toRegex()) (this.selectFirst("div.data>h3")?.text() ?: "").contains("\\(\\d{4}\\)".toRegex())
val link = val link =
@ -237,6 +225,8 @@ class IlGenioDelloStreamingProvider : MainAPI() {
?.text() ?.text()
?.substringAfter("x") ?.substringAfter("x")
?.substringBefore(" ") ?.substringBefore(" ")
?.filter { it.isDigit() }
.orEmpty().ifBlank { "0" }
val epTitle = val epTitle =
this.selectFirst("li.other_link>a")?.text().orEmpty().ifBlank { this.selectFirst("li.other_link>a")?.text().orEmpty().ifBlank {

View File

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 1 version = 2
cloudstream { cloudstream {
@ -23,4 +23,4 @@ cloudstream {
) )
iconUrl = "https://www.google.com/s2/favicons?domain=www.mundodonghua.com&sz=%size%" iconUrl = "https://www.google.com/s2/favicons?domain=www.mundodonghua.com&sz=%size%"
} }

View File

@ -36,9 +36,10 @@ class MundoDonghuaProvider : MainAPI() {
val title = it.selectFirst("h5")?.text() ?: "" val title = it.selectFirst("h5")?.text() ?: ""
val poster = it.selectFirst(".fit-1 img")?.attr("src") val poster = it.selectFirst(".fit-1 img")?.attr("src")
val epRegex = Regex("(\\/(\\d+)\$)") val epRegex = Regex("(\\/(\\d+)\$)")
val url = it.selectFirst("a")?.attr("href")?.replace(epRegex,"")?.replace("/ver/","/donghua/")
val epnumRegex = Regex("((\\d+)$)") val epnumRegex = Regex("((\\d+)$)")
val epNum = epnumRegex.find(title)?.value?.toIntOrNull() val epNum = epnumRegex.find(title)?.value?.toIntOrNull()
val epNumRemoveRegex = Regex("/" + epNum.toString() + "/.*")
val url = it.selectFirst("a")?.attr("href")?.replace(epRegex,"")?.replace("/ver/","/donghua/")?.replace(epNumRemoveRegex,"")
val dubstat = if (title.contains("Latino") || title.contains("Castellano")) DubStatus.Dubbed else DubStatus.Subbed val dubstat = if (title.contains("Latino") || title.contains("Castellano")) DubStatus.Dubbed else DubStatus.Subbed
newAnimeSearchResponse(title.replace(Regex("Episodio|(\\d+)"),"").trim(), fixUrl(url ?: "")) { newAnimeSearchResponse(title.replace(Regex("Episodio|(\\d+)"),"").trim(), fixUrl(url ?: "")) {
this.posterUrl = fixUrl(poster ?: "") this.posterUrl = fixUrl(poster ?: "")
@ -214,4 +215,4 @@ class MundoDonghuaProvider : MainAPI() {
} }
return true return true
} }
} }

View File

@ -0,0 +1,25 @@
// use an integer for version numbers
version = 5
cloudstream {
// All of these properties are optional, you can safely remove them
// description = "Lorem Ipsum"
language= "en"
authors = listOf("Forthe")
/**
* Status int as the following:
* 0: Down
* 1: Ok
* 2: Slow
* 3: Beta only
* */
status = 1 // will be 3 if unspecified
tvTypes = listOf(
"Others",
)
iconUrl = "https://www.google.com/s2/favicons?domain=skillshare.com&sz=%size%"
}

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.lagradost"/>

View File

@ -0,0 +1,254 @@
package com.lagradost
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.MainAPI
import com.lagradost.cloudstream3.SearchResponse
import com.lagradost.cloudstream3.TvType
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
import com.lagradost.cloudstream3.utils.AppUtils.toJson
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.Qualities
import com.lagradost.nicehttp.RequestBodyTypes
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody.Companion.toRequestBody
class SkillShareProvider : MainAPI() { // all providers must be an instance of MainAPI
override var mainUrl = "https://www.skillshare.com"
override var name = "SkillShare"
private val apiUrl = "https://www.skillshare.com/api/graphql"
private val bypassApiUrl = "https://skillshare.techtanic.xyz/id"
private val bypassApiUrlFallback = "https://skillshare-api.heckernohecking.repl.co"
override val supportedTypes = setOf(TvType.Others)
override val hasChromecastSupport = true
override var lang = "en"
override val hasMainPage = true
private var cursor = mutableMapOf("SIX_MONTHS_ENGAGEMENT" to "", "ML_TRENDINESS" to "")
override val mainPage =
mainPageOf(
"SIX_MONTHS_ENGAGEMENT" to "Popular Classes",
"ML_TRENDINESS" to "Trending Classes",
)
private suspend fun queryMovieApi(payload: String): String {
val req = payload.toRequestBody(RequestBodyTypes.JSON.toMediaTypeOrNull())
return app.post(apiUrl, requestBody = req, referer = "$mainUrl/", timeout = 30).text
}
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
val sortAttribute = request.data
if (page == 1) //reset the cursor to "" if the first page is requested
cursor[sortAttribute] = ""
val payload=
"""
{
"query":"query GetClassesByType(${'$'}filter: ClassFilters!, ${'$'}pageSize: Int, ${'$'}cursor: String, ${'$'}type: ClassListType!, ${'$'}sortAttribute: ClassListByTypeSortAttribute) {
classListByType(type: ${'$'}type, where: ${'$'}filter, first: ${'$'}pageSize, after: ${'$'}cursor, sortAttribute: ${'$'}sortAttribute) {
nodes {
id
title
url
sku
smallCoverUrl
largeCoverUrl
}
}
}",
"variables":{
"type":"TRENDING_CLASSES",
"filter":{
"subCategory":"",
"classLength":[]
},
"pageSize":30,
"cursor":"${cursor[sortAttribute]}",
"sortAttribute":"$sortAttribute"
},
"operationName":"GetClassesByType"
}
""".replace(Regex("\n")," ")
val responseBody = queryMovieApi(payload)
val parsedJson = parseJson<ApiData>(responseBody).data.classListByType.nodes
val home = parsedJson.map {
it.toSearchResult()
}
cursor[sortAttribute] = parsedJson.lastOrNull()?.id ?: "" //set the right cursor for the nextPage to work
return newHomePageResponse(
arrayListOf(HomePageList(request.name, home, isHorizontalImages = true)),
hasNext = home.isNotEmpty(),
)
}
override suspend fun search(query: String): List<SearchResponse> {
val payload =
"""
{
"query":"fragment ClassFields on Class {
id
smallCoverUrl
largeCoverUrl
sku
title
url
}
query GetClassesQuery(${"$"}query: String!, ${"$"}where: SearchFilters!, ${"$"}after: String!, ${"$"}first: Int!) {
search(query: ${"$"}query, where: ${"$"}where, analyticsTags: [\"src:browser\", \"src:browser:search\"], after: ${"$"}after, first: ${"$"}first) {
edges {
node {
...ClassFields
}
}
}
}",
"variables":{
"query":"$query",
"where":{
"level":
["ALL_LEVELS","BEGINNER","INTERMEDIATE","ADVANCED"]
},
"after":"-1",
"first":30
},
"operationName":"GetClassesQuery"
}
""".replace(Regex("\n")," ")
val responseBody = queryMovieApi(payload)
val home = parseJson<SearchApiData>(responseBody).data.search.edges.map {
it.node.toSearchResult()
}
return home
}
private fun ApiNode.toSearchResult(): SearchResponse {
val title = this.title ?: ""
val posterUrl = this.smallCoverUrl
return newTvSeriesSearchResponse(
title,
Data(
title = this.title,
courseId = this.courseId,
largeCoverUrl = this.largeCoverUrl
).toJson(),
TvType.TvSeries
) {
addPoster(posterUrl)
}
}
override suspend fun load(url: String): LoadResponse? {
val data = parseJson<Data>(url)
val document = app.get(bypassApiUrl + "/${data.courseId}")
.parsedSafe<BypassApiData>() ?: app.get(bypassApiUrlFallback + "/${data.courseId}/0")
.parsedSafe<BypassApiData>() ?: throw ErrorLoadingException("Invalid Json Response")
val title = data.title ?: ""
val poster = data.largeCoverUrl
val episodeList = document.lessons.mapIndexed { index, episode ->
Episode(episode.url ?: "", episode.title, 1, index)
}
return newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodeList) {
addPoster(poster)
}
}
override suspend fun loadLinks(
data: String,
isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
callback.invoke(
ExtractorLink(
name,
name,
data,
isM3u8 = false,
referer = "$mainUrl/",
quality = Qualities.Unknown.value
)
)
return true
}
data class ApiNode(
//mainpage and search page
@JsonProperty("id") var id: String? = null,
@JsonProperty("title") var title: String? = null,
@JsonProperty("url") var url: String? = null,
@JsonProperty("sku") var courseId: String? = null,
@JsonProperty("smallCoverUrl") var smallCoverUrl: String? = null,
@JsonProperty("largeCoverUrl") var largeCoverUrl: String? = null,
)
data class ApiNodes( //mainpage
@JsonProperty("nodes") var nodes: ArrayList<ApiNode> = arrayListOf()
)
data class ApiClassListByType( //mainpage
@JsonProperty("classListByType") var classListByType: ApiNodes = ApiNodes()
)
data class ApiData( //mainpage
@JsonProperty("data") var data: ApiClassListByType = ApiClassListByType()
)
data class SearchApiNodes( //search
@JsonProperty("node") var node: ApiNode = ApiNode()
)
data class SearchApiEdges( //search
@JsonProperty("edges") var edges: ArrayList<SearchApiNodes> = arrayListOf()
)
data class SearchApiSearch( //search
@JsonProperty("search") var search: SearchApiEdges = SearchApiEdges()
)
data class SearchApiData( //search
@JsonProperty("data") var data: SearchApiSearch = SearchApiSearch()
)
data class BypassApiLesson( //bypass
@JsonProperty("title") var title: String? = null,
@JsonProperty("url") var url: String? = null
)
data class BypassApiData( //bypass
@JsonProperty("class") var title: String? = null,
@JsonProperty("class_thumbnail") var largeCoverUrl: String? = null,
@JsonProperty("lessons") var lessons: ArrayList<BypassApiLesson> = arrayListOf()
)
data class Data(
//for loading
val title: String? = null,
val courseId: String? = null,
val largeCoverUrl: String? = null,
)
}

View File

@ -0,0 +1,14 @@
package com.lagradost
import android.content.Context
import com.lagradost.cloudstream3.plugins.CloudstreamPlugin
import com.lagradost.cloudstream3.plugins.Plugin
@CloudstreamPlugin
class SkillShareProviderPlugin : Plugin() {
override fun load(context: Context) {
// All providers should be added in this manner. Please don't edit the providers list
// directly.
registerMainAPI(SkillShareProvider())
}
}

View File

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 1 version = 2
cloudstream { cloudstream {
@ -7,7 +7,7 @@ cloudstream {
// All of these properties are optional, you can safely remove them // All of these properties are optional, you can safely remove them
description = "Provider che utilizza tmdb. Non tutti i links sono funzionanti" description = "Provider che utilizza tmdb. Non tutti i links sono funzionanti"
authors = listOf("Adippe") authors = listOf("Adippe", "Forthe")
/** /**
* Status int as the following: * Status int as the following:

View File

@ -4,6 +4,7 @@ import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.utils.* import com.lagradost.cloudstream3.utils.*
import com.lagradost.cloudstream3.utils.AppUtils.parseJson import com.lagradost.cloudstream3.utils.AppUtils.parseJson
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import com.lagradost.cloudstream3.utils.ShortLink.unshorten
import com.lagradost.nicehttp.Requests import com.lagradost.nicehttp.Requests
object SoraItalianExtractor : SoraItalianStream() { object SoraItalianExtractor : SoraItalianStream() {
@ -17,14 +18,13 @@ object SoraItalianExtractor : SoraItalianStream() {
"https://guardahd.stream/movie/$id", "https://guardahd.stream/movie/$id",
referer = "/" referer = "/"
).document ).document
res.select("ul._player-mirrors > li").map { source -> res.select("ul._player-mirrors > li").forEach { source ->
loadExtractor( loadExtractor(
fixUrl(source.attr("data-link")), fixUrl(source.attr("data-link")),
"$/", "https://guardahd.stream",
subtitleCallback, subtitleCallback,
callback callback
) )
println("LINK DI Guardare " + fixUrl(source.attr("data-link")))
} }
} }
@ -42,18 +42,18 @@ object SoraItalianExtractor : SoraItalianStream() {
"story" to id!! "story" to id!!
) )
).document.selectFirst("h2>a")?.attr("href") ?: return ).document.selectFirst("h2>a")?.attr("href") ?: return
val document = app.get(url).document val document = app.get(url).document
document.select("div.tab-content > div").mapIndexed { seasonData, data -> document.select("div.tab-content > div").forEachIndexed { seasonData, data ->
data.select("li").mapIndexed { epNum, epData -> data.select("li").forEachIndexed { epNum, epData ->
if (season == seasonData + 1 && episode == epNum + 1) { if (season == seasonData + 1 && episode == epNum + 1) {
epData.select("div.mirrors > a").map { epData.select("div.mirrors > a.mr").forEach {
loadExtractor( loadExtractor(
fixUrl(it.attr("data-link")), fixUrl(it.attr("data-link")),
"$/", guardaserieUrl,
subtitleCallback, subtitleCallback,
callback callback
) )
println("LINK DI guardaserie " + it.attr("data-link"))
} }
} }
} }
@ -79,121 +79,102 @@ object SoraItalianExtractor : SoraItalianStream() {
.filter { it != filmpertuttiUrl } .filter { it != filmpertuttiUrl }
links.apmap { links.apmap {
val doc = app.get(it).document val doc = app.get(it).document
if (id == doc.selectFirst(" div.rating > p > a")?.attr("href") if (id == doc.selectFirst("div.rating > p > a") //check if corresponds to the imdb id
?.attr("href")
?.substringAfterLast("/") ?.substringAfterLast("/")
) { ) {
if (type == "tv") { if (type == "tv") {
val seasonData = doc.select("div.accordion-item").filter { a -> val seasonData = doc.select("div.accordion-item").filter { a ->
a.selectFirst("#season > ul > li.s_title > span")!!.text().isNotEmpty() a.selectFirst("#season > ul > li.s_title > span")!!
.text()
.isNotEmpty()
}.find { }.find {
season == it.selectFirst("#season > ul > li.s_title > span")!!.text() season == it.selectFirst("#season > ul > li.s_title > span")!!
.text()
.toInt() .toInt()
} }
val episodeData = seasonData?.select("div.episode-wrap")?.find { val episodeData = seasonData?.select("div.episode-wrap")?.find {
episode == it.selectFirst("li.season-no")!!.text().substringAfter("x") episode == it.selectFirst("li.season-no")!!.text()
.substringAfter("x")
.substringBefore(" ")
.filter { it.isDigit() }.toIntOrNull() .filter { it.isDigit() }.toIntOrNull()
} }
episodeData?.select("#links > div > div > table > tbody:nth-child(2) > tr") episodeData?.select("#links > div > div > table > tbody:nth-child(2) > tr")
?.map { ?.forEach {
val unshortenLink = unshorten(it.selectFirst("a")?.attr("href") ?: "")
loadExtractor( loadExtractor(
it.selectFirst("a")!!.attr("href") ?: "", unshortenLink,
filmpertuttiUrl, filmpertuttiUrl,
subtitleCallback, subtitleCallback,
callback callback
) )
println("FIlmpetutti " + it.selectFirst("a")!!.attr("href") ?: "")
}
} else {
val urls0 = doc.select("div.embed-player")
if (urls0.isNotEmpty()) {
urls0.map {
loadExtractor(
it.attr("data-id"),
filmpertuttiUrl,
subtitleCallback,
callback
)
println("LINK DI FIlmpetutti " + it.attr("data-id"))
}
} else {
doc.select("#info > ul > li ").mapNotNull {
val link = it.selectFirst("a")?.attr("href") ?: ""
loadExtractor(
ShortLink.unshorten(link).trim().replace("/v/", "/e/")
.replace("/f/", "/e/"),
"$/",
subtitleCallback,
callback
)
println("LINK DI FIlmpetutti " + it.selectFirst("a")?.attr("href"))
} }
} else { //movie
doc.select("#info > ul > li").forEach {
val unshortenLink = unshorten(it.selectFirst("a")?.attr("href") ?: "")
loadExtractor(
unshortenLink,
filmpertuttiUrl,
subtitleCallback,
callback
)
} }
} }
} }
} }
} }
suspend fun invoAltadefinizione(
id: String? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val url = app.get(
"$altadefinizioneUrl/index.php?story=$id&do=search&subaction=search"
).document.selectFirst("div.cover_kapsul > a")?.attr("href") ?: return
val document = app.get(url).document
document.select("ul.host>a").map {
loadExtractor(
fixUrl(it.attr("data-link")),
altadefinizioneUrl,
subtitleCallback,
callback
)
println("LINK DI altadefinizione " + fixUrl(it.attr("data-link")))
}
}
suspend fun invoCb01( suspend fun invoCb01(
title: String?, title: String?,
year: Int?, year: Int?,
subtitleCallback: (SubtitleFile) -> Unit, subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
) { ) {
val res = app.get("$cb01Url/search/$title $year/feed").text
val res = app.get("$cb01Url/search/$title%20$year/feed").text
val links = Regex("<link>(.*)</link>").findAll(res).map { it.groupValues.last() }.toList() val links = Regex("<link>(.*)</link>").findAll(res).map { it.groupValues.last() }.toList()
.filter { it != cb01Url && it != "$cb01Url/" } .filter { it != cb01Url && it != "$cb01Url/" }
if (links.size != 1) return if (links.size != 1) return
links.apmap { links.apmap {
val doc = app.get(it).document val doc = app.get(it).document
doc.select("tr > td > a").mapNotNull { doc.select("tr > td > a[href*='stayonline.pro']").forEach {
val link = it.selectFirst("a")?.attr("href") ?: "" val link = it.selectFirst("a")?.attr("href") ?: ""
val url = ShortLink.unshorten(link).trim().replace("/v/", "/e/") val apiPostId = link.substringAfter("/l/")
.replace("/f/", "/e/") .substringBefore("/") //https://stayonline.pro/l/abcdef/ -> abcdef
val processedUrl = if (url.contains("mixdrop.club")){ val apiBodyBypass = app.post(
fixUrl(app.get(url).document.selectFirst("iframe")?.attr("src")?:"") "https://stayonline.pro/ajax/linkView.php",
} data = mapOf("id" to apiPostId)
else{url} ).text
var bypassedUrl =
apiBodyBypass.substringAfter("\"value\": \"").substringBefore("\"")
.replace("\\", "") //bypass stayonline link
if (bypassedUrl.contains("mixdrop.club")) //https://mixdrop.club/f/lllllllll/2/abcdefghilmn.mp4 (fake mp4 url) -> https://mixdrop.ch/e/lllllllll
bypassedUrl = bypassedUrl.replace("mixdrop.club", "mixdrop.ch")
.substringBeforeLast("/")
.substringBeforeLast("/")
.replace("/f/", "/e/")
else
bypassedUrl = unshorten(bypassedUrl)
loadExtractor( loadExtractor(
processedUrl, bypassedUrl,
"$/", cb01Url,
subtitleCallback, subtitleCallback,
callback callback
) )
println("LINK DI CB01 " + url)
} }
} }
} }
suspend fun invoAnimeWorld( suspend fun invoAnimeWorld(
malId: String?, malId: String?,
title: String?, title: String?,
episode: Int?, episode: Int?,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
) { ) {
val pagedata = app.get("$animeworldUrl/search?keyword=$title").document val pagedata = app.get("$animeworldUrl/search?keyword=$title").document
@ -202,13 +183,13 @@ object SoraItalianExtractor : SoraItalianStream() {
fixUrl(it.select("a.name").firstOrNull()?.attr("href") ?: "", animeworldUrl) fixUrl(it.select("a.name").firstOrNull()?.attr("href") ?: "", animeworldUrl)
}.apmap { }.apmap {
val document = app.get(it).document val document = app.get(it).document
val malID = document.select("#mal-button").attr("href") val pageMalId = document.select("#mal-button").attr("href")
.split('/').last().toString() .split('/').last().toString()
if (malId == malID) { if (malId == pageMalId) {
val servers = document.select(".widget.servers") val servers = document.select(".widget.servers")
servers.select(".server[data-name=\"9\"] .episode > a").toList() servers.select(".server[data-name=\"9\"] .episode > a").toList()
.filter { it.attr("data-episode-num").toIntOrNull()?.equals(episode) ?: false } .filter { it.attr("data-episode-num").toIntOrNull()?.equals(episode) ?: false }
.map { id -> .forEach { id ->
val url = tryParseJson<AnimeWorldJson>( val url = tryParseJson<AnimeWorldJson>(
app.get("$animeworldUrl/api/episode/info?id=${id.attr("data-id")}").text app.get("$animeworldUrl/api/episode/info?id=${id.attr("data-id")}").text
)?.grabber )?.grabber
@ -229,12 +210,11 @@ object SoraItalianExtractor : SoraItalianStream() {
ExtractorLink( ExtractorLink(
"AnimeWorld", "AnimeWorld",
nameData, nameData,
url?:"", url ?: "",
referer = animeworldUrl, referer = animeworldUrl,
quality = Qualities.Unknown.value quality = Qualities.Unknown.value
) )
) )
println("LINK DI Animeworld " + url)
} }
} }
} }
@ -245,7 +225,6 @@ object SoraItalianExtractor : SoraItalianStream() {
title: String?, title: String?,
episode: Int?, episode: Int?,
year: Int?, year: Int?,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
) { ) {
val response = val response =
@ -266,7 +245,6 @@ object SoraItalianExtractor : SoraItalianStream() {
val streamUrl = val streamUrl =
parseJson<AniPlayApiEpisodeUrl>(app.get(episodeUrl).text).url parseJson<AniPlayApiEpisodeUrl>(app.get(episodeUrl).text).url
callback.invoke( callback.invoke(
ExtractorLink( ExtractorLink(
name, name,
AnimeName, AnimeName,
@ -276,16 +254,16 @@ object SoraItalianExtractor : SoraItalianStream() {
isM3u8 = streamUrl.contains(".m3u8"), isM3u8 = streamUrl.contains(".m3u8"),
) )
) )
} } else {
else { val seasonid = response.seasons.sortedBy { it.episodeStart }
val seasonid = response.seasons.sortedBy { it.episodeStart }.last { it.episodeStart < episode!!} .last { it.episodeStart < episode!! }
val episodesData = val episodesData =
tryParseJson<List<AniplayApiEpisode>>( tryParseJson<List<AniplayApiEpisode>>(
app.get( app.get(
"$url/season/${seasonid.id}" "$url/season/${seasonid.id}"
).text ).text
) )
val episodeData = episodesData?.find { it.number == episode.toString() }?.id val episodeData = episodesData?.find { it.number == episode.toString() }?.id
if (episodeData != null) { if (episodeData != null) {
val streamUrl = val streamUrl =
parseJson<AniPlayApiEpisodeUrl>(app.get("$aniplayUrl/api/episode/${episodeData}").text).url parseJson<AniPlayApiEpisodeUrl>(app.get("$aniplayUrl/api/episode/${episodeData}").text).url
@ -299,7 +277,6 @@ object SoraItalianExtractor : SoraItalianStream() {
isM3u8 = streamUrl.contains(".m3u8"), isM3u8 = streamUrl.contains(".m3u8"),
) )
) )
println("LINK DI aniplay " + streamUrl)
} }
} }
} }
@ -310,10 +287,10 @@ object SoraItalianExtractor : SoraItalianStream() {
malId: String?, malId: String?,
title: String?, title: String?,
episode: Int?, episode: Int?,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
) { ) {
val document = app.get("$animesaturnUrl/animelist?search=${title?.replace("-"," ")}").document val document =
app.get("$animesaturnUrl/animelist?search=${title?.replace("-", " ")}").document
val links = document.select("div.item-archivio").map { val links = document.select("div.item-archivio").map {
it.select("a.badge-archivio").first()!!.attr("href") it.select("a.badge-archivio").first()!!.attr("href")
} }
@ -324,53 +301,48 @@ object SoraItalianExtractor : SoraItalianStream() {
} else { } else {
"AnimeSaturn SUB" "AnimeSaturn SUB"
} }
var malID : String? = null var malID: String?
response.select("[rel=\"noopener noreferrer\"]").forEach { response.select("a[href*=myanimelist]").forEach {
if(it.attr("href").contains("myanimelist")) malID = it.attr("href").substringBeforeLast("/")
malID = it.attr("href").removeSuffix("/").split('/').last() .substringAfterLast("/") //https://myanimelist.net/anime/19/ -> 19
if (malId == malID){ if (malId == malID) {
val link = response.select("a.bottone-ep").find { it.text().split(" ")[1] == episode.toString() }?.attr("href") val link = response.select("a.bottone-ep")
if (link != null) { .find { it.text().substringAfter("Episodio ") == episode.toString() }
val page = app.get(link).document ?.attr("href")
val episodeLink = page.select("div.card-body > a[href]").find { it1 -> if (link?.isBlank() == false) { //links exists
it1.attr("href").contains("watch?") val page = app.get(link).document
}?.attr("href") ?: throw ErrorLoadingException("No link Found") val episodeLink = page.select("div.card-body > a[href*=watch]").attr("href")
?: throw ErrorLoadingException("No link Found")
val episodePage = app.get(episodeLink).document val episodePage = app.get(episodeLink).document
val episodeUrl: String? val episodeUrl: String? = episodePage.select("video.afterglow > source")
var isM3U8 = false .let { // Old player
it.first()?.attr("src")
}
?: //new player
Regex("\"(https[A-z0-9\\/\\:\\.]*\\.m3u8)\",").find(
episodePage.select("script").find {
it.toString().contains("jwplayer('player_hls').setup({")
}.toString()
)?.value
if (episodePage.select("video.afterglow > source").isNotEmpty()) // Old player callback.invoke(
episodeUrl = ExtractorLink(
episodePage.select("video.afterglow > source").first()!!.attr("src") name,
else { // New player AnimeName,
val script = episodePage.select("script").find { episodeUrl!!,
it.toString().contains("jwplayer('player_hls').setup({") isM3u8 = episodeUrl.contains(".m3u8"),
}!!.toString() referer = "https://www.animesaturn.io/", //Some servers need the old host as referer, and the new ones accept it too
episodeUrl = script.split(" ") quality = Qualities.Unknown.value
.find { it.contains(".m3u8") and !it.contains(".replace") }!! )
.replace("\"", "").replace(",", "") )
isM3U8 = true
} }
callback.invoke(
ExtractorLink(
name,
AnimeName,
episodeUrl!!,
isM3u8 = isM3U8,
referer = "https://www.animesaturn.io/", //Some servers need the old host as referer, and the new ones accept it too
quality = Qualities.Unknown.value
)
)
println("LINK DI animesaturn " + episodeUrl)
} }
} }
}
} }
} }
} }
@ -397,6 +369,4 @@ fun fixUrl(url: String, domain: String): String {
return "$domain/$url" return "$domain/$url"
} }
} }

View File

@ -5,7 +5,6 @@ import com.lagradost.SoraItalianExtractor.invoGuardare
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.metaproviders.TmdbProvider import com.lagradost.cloudstream3.metaproviders.TmdbProvider
import com.lagradost.SoraItalianExtractor.invoAltadefinizione
import com.lagradost.SoraItalianExtractor.invoAniPlay import com.lagradost.SoraItalianExtractor.invoAniPlay
import com.lagradost.SoraItalianExtractor.invoAnimeSaturn import com.lagradost.SoraItalianExtractor.invoAnimeSaturn
import com.lagradost.SoraItalianExtractor.invoAnimeWorld import com.lagradost.SoraItalianExtractor.invoAnimeWorld
@ -37,8 +36,7 @@ open class SoraItalianStream : TmdbProvider() {
private const val apiKey = "71f37e6dff3b879fa4656f19547c418c" // PLEASE DON'T STEAL private const val apiKey = "71f37e6dff3b879fa4656f19547c418c" // PLEASE DON'T STEAL
const val guardaserieUrl = "https://guardaserie.app" const val guardaserieUrl = "https://guardaserie.app"
const val filmpertuttiUrl = "https://www.filmpertutti.skin" const val filmpertuttiUrl = "https://www.filmpertutti.skin"
const val altadefinizioneUrl = "https://altadefinizione01.autos" const val cb01Url = "https://cb01.tours/"
const val cb01Url = "https://cb01.delivery"
const val animeworldUrl = "https://www.animeworld.tv" const val animeworldUrl = "https://www.animeworld.tv"
const val aniplayUrl = "https://aniplay.it" const val aniplayUrl = "https://aniplay.it"
const val animesaturnUrl = "https://www.animesaturn.in" const val animesaturnUrl = "https://www.animesaturn.in"
@ -69,6 +67,12 @@ open class SoraItalianStream : TmdbProvider() {
return api.chunked(4).map { base64Decode(it) }.reversed().joinToString("") return api.chunked(4).map { base64Decode(it) }.reversed().joinToString("")
} }
fun containsJapaneseCharacters(str: String?): Boolean { //sometimes the it-It translation of names gives the japanese name of the anime
val japaneseCharactersRegex =
Regex("[\\u3000-\\u303f\\u3040-\\u309f\\u30a0-\\u30ff\\uff00-\\uff9f\\u4e00-\\u9faf\\u3400-\\u4dbf]")
return str?.let { japaneseCharactersRegex.containsMatchIn(it) } == true
}
} }
@ -119,22 +123,13 @@ open class SoraItalianStream : TmdbProvider() {
} }
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse>? {
val searchResponse = mutableListOf<SearchResponse>() return app.get(
val mainResponse = app.get(
"$tmdbAPI/search/multi?api_key=$apiKey&language=it-IT&query=$query&page=1&include_adult=false" "$tmdbAPI/search/multi?api_key=$apiKey&language=it-IT&query=$query&page=1&include_adult=false"
).parsedSafe<Results>()?.results?.mapNotNull { media -> )
media.toSearchResponse() .parsedSafe<Results>()?.results?.mapNotNull { media ->
} media.toSearchResponse()
if (mainResponse?.isNotEmpty() == true) searchResponse.addAll(mainResponse) }
// val animeResponse =
// app.get("$mainServerAPI/search/anime/$query?_data=routes/search/anime/\$animeKeyword")
// .parsedSafe<SearchAnime>()?.searchResults?.results?.mapNotNull { anime -> anime.toSearchResponse() }
// if (animeResponse?.isNotEmpty() == true) searchResponse.addAll(animeResponse)
return searchResponse
} }
@ -143,16 +138,16 @@ open class SoraItalianStream : TmdbProvider() {
val type = getType(data.type) val type = getType(data.type)
val typename = when(type){ val typename = data.type
TvType.TvSeries-> "tv"
TvType.Movie -> "movie"
else -> ""
}
val res = var res =
app.get("$tmdbAPI/$typename/${data.id}?api_key=$apiKey&language=it-IT&append_to_response=external_ids,credits,recommendations,videos") app.get("$tmdbAPI/$typename/${data.id}?api_key=$apiKey&language=it-IT&append_to_response=external_ids,credits,recommendations,videos")
.parsedSafe<MovieDetails>() ?: throw ErrorLoadingException("Invalid Json Response") .parsedSafe<MovieDetails>() ?: throw ErrorLoadingException("Invalid Json Response")
if (containsJapaneseCharacters(res.name)) {
res =
app.get("$tmdbAPI/$typename/${data.id}?api_key=$apiKey&language=en-US&append_to_response=external_ids,credits,recommendations,videos")
.parsedSafe() ?: throw ErrorLoadingException("Invalid Json Response")
}
val title = res.name ?: res.title ?: return null val title = res.name ?: res.title ?: return null
val orgTitle = res.originalName ?: res.originalTitle ?: return null val orgTitle = res.originalName ?: res.originalTitle ?: return null
@ -175,81 +170,67 @@ open class SoraItalianStream : TmdbProvider() {
res.videos?.results?.map { "https://www.youtube.com/watch?v=${it.key}" } res.videos?.results?.map { "https://www.youtube.com/watch?v=${it.key}" }
?.randomOrNull() ?.randomOrNull()
if (res.genres?.map { it.id }?.contains(16) == true && type == TvType.TvSeries) { val isAnime = res.genres?.any { it.id == 16L } == true
val episodes = mutableListOf<Episode>() return if (type == TvType.Movie) { //can be a movie or a anime movie
res.seasons?.filter { it.seasonNumber != 0L }?.apmap { season -> newMovieLoadResponse(
val seasonData = app.get("$tmdbAPI/${data.type}/${data.id}/season/${season.seasonNumber}?api_key=$apiKey&language=it-IT")
.parsedSafe<MediaDetailEpisodes>()?.episodes
val seasonID = if (season.seasonNumber!! > 1 && seasonData?.isNotEmpty() == true && seasonData?.first()?.episodeNumber != 1){ 1 } else { season.seasonNumber }.toInt()
seasonData?.map { eps ->
episodes.add(Episode(
LinkData(
data.id,
res.externalIds?.imdbId,
data.type,
seasonID,
eps.episodeNumber,
title = title,
year = year,
orgTitle = orgTitle,
isAnime = true
).toJson(),
name = eps.name,
season = eps.seasonNumber,
episode = eps.episodeNumber,
posterUrl = getImageUrl(eps.stillPath),
rating = eps.voteAverage?.times(10)?.roundToInt(),
description = eps.overview
).apply {
this.addDate(eps.airDate)
})
}
}
return newTvSeriesLoadResponse(
title, title,
url, url,
TvType.TvSeries, TvType.Movie,
episodes LinkData(
data.id,
res.externalIds?.imdbId,
data.type,
title = title,
year = year,
orgTitle = orgTitle,
isAnime = isAnime
).toJson(),
) { ) {
this.posterUrl = getOriImageUrl(res.backdropPath) this.posterUrl = getOriImageUrl(res.backdropPath)
this.year = year this.year = year
this.plot = res.overview this.plot = res.overview
this.tags = res.genres?.mapNotNull { it.name } this.tags = res.genres?.mapNotNull { it.name }
this.showStatus = getStatus(res.status)
this.recommendations = recommendations this.recommendations = recommendations
this.actors = actors this.actors = actors
addTrailer(trailer) addTrailer(trailer)
} }
} else { //can be anime series or tv series
}
return if (type == TvType.TvSeries) {
val episodes = mutableListOf<Episode>() val episodes = mutableListOf<Episode>()
res.seasons?.filter { it.seasonNumber != 0L }?.apmap { season -> var seasonNum = 0
val seasonDataList = res.seasons?.filter { it.seasonNumber != 0 }?.apmap { season ->
app.get("$tmdbAPI/${data.type}/${data.id}/season/${season.seasonNumber}?api_key=$apiKey&language=it-IT") app.get("$tmdbAPI/${data.type}/${data.id}/season/${season.seasonNumber}?api_key=$apiKey&language=it-IT")
.parsedSafe<MediaDetailEpisodes>()?.episodes?.map { eps -> .parsedSafe<MediaDetailEpisodes>()?.episodes
episodes.add(Episode( }
LinkData(
data.id, res.seasons?.filter { it.seasonNumber != 0 }?.forEachIndexed { index, season ->
res.externalIds?.imdbId, val seasonData = seasonDataList?.get(index)
data.type, if (seasonData?.first()?.episodeNumber == 1)
eps.seasonNumber, seasonNum += 1
eps.episodeNumber,
title = title, seasonData?.forEach { eps ->
year = season.airDate?.split("-")?.first()?.toIntOrNull(), episodes.add(Episode(
orgTitle = orgTitle, LinkData(
isAnime = false data.id,
).toJson(), res.externalIds?.imdbId,
name = eps.name, data.type,
season = eps.seasonNumber, seasonNum,
episode = eps.episodeNumber, eps.episodeNumber,
posterUrl = getImageUrl(eps.stillPath), title = title,
rating = eps.voteAverage?.times(10)?.roundToInt(), year = year ?: season.airDate?.split("-")?.first()?.toIntOrNull(),
description = eps.overview orgTitle = orgTitle,
).apply { isAnime = isAnime
this.addDate(eps.airDate) ).toJson(),
}) name = eps.name,
} season = seasonNum,
episode = eps.episodeNumber,
posterUrl = getImageUrl(eps.stillPath),
rating = eps.voteAverage?.times(10)?.roundToInt(),
description = eps.overview
).apply {
this.addDate(eps.airDate)
})
}
} }
newTvSeriesLoadResponse( newTvSeriesLoadResponse(
title, title,
@ -267,30 +248,6 @@ open class SoraItalianStream : TmdbProvider() {
addTrailer(trailer) addTrailer(trailer)
} }
} }
else {
newMovieLoadResponse(
title,
url,
TvType.Movie,
LinkData(
data.id,
res.externalIds?.imdbId,
data.type,
title = title,
year = year,
orgTitle = orgTitle,
isAnime = res.genres?.map { it.id }?.contains(16)?:false
).toJson(),
) {
this.posterUrl = getOriImageUrl(res.backdropPath)
this.year = year
this.plot = res.overview
this.tags = res.genres?.mapNotNull { it.name }
this.recommendations = recommendations
this.actors = actors
addTrailer(trailer)
}
}
} }
override suspend fun loadLinks( override suspend fun loadLinks(
@ -304,28 +261,60 @@ open class SoraItalianStream : TmdbProvider() {
val malID = app.get("$tmdb2mal/?id=${res.id}&s=${res.season}").text.trim() val malID = app.get("$tmdb2mal/?id=${res.id}&s=${res.season}").text.trim()
argamap( argamap(
{ {
if (res.isAnime ) invoAnimeWorld(malID, res.title, res.episode, subtitleCallback, callback) if (res.isAnime) invoAnimeWorld(
malID,
res.title,
res.episode,
callback
)
}, },
{ {
if (res.isAnime) invoAniPlay(malID, res.title, res.episode, res.year, subtitleCallback, callback) if (res.isAnime) invoAniPlay(
malID,
res.title,
res.episode,
res.year,
callback
)
}, },
{ {
if (res.isAnime) invoAnimeSaturn(malID, res.title, res.episode, subtitleCallback, callback) if (res.isAnime) invoAnimeSaturn(
malID,
res.title,
res.episode,
callback
)
}, },
{ {
invoGuardare(res.imdbId, subtitleCallback, callback) if (res.type == "movie") invoGuardare(
res.imdbId,
subtitleCallback,
callback
) //just movies/anime movie
}, },
{ {
if (malID == "") invoGuardaserie(res.imdbId, res.season, res.episode, subtitleCallback, callback) if (res.type == "tv") invoGuardaserie( //has tv series and anime
res.imdbId,
res.season,
res.episode,
subtitleCallback,
callback
)
}, },
{ {
if (!res.isAnime) invoFilmpertutti(res.imdbId,res.title, res.type, res.season, res.episode, res.year, subtitleCallback, callback) invoFilmpertutti( //has tv series, film and some anime
res.imdbId,
res.title,
res.type,
res.season,
res.episode,
res.year,
subtitleCallback,
callback
)
}, },
{ {
if (!res.isAnime) invoAltadefinizione(res.imdbId, subtitleCallback, callback) if (res.type == "movie") invoCb01(res.title, res.year, subtitleCallback, callback)
},
{
if (!res.isAnime) invoCb01(res.title, res.year, subtitleCallback, callback)
} }
) )
@ -335,7 +324,7 @@ open class SoraItalianStream : TmdbProvider() {
private data class LinkData( private data class LinkData(
val id: Int? = null, val id: Int? = null,
val imdbId: String? = null, val imdbId: String? = null,
val type: String? = null, val type: String? = null, //movie or tv
val season: Int? = null, val season: Int? = null,
val episode: Int? = null, val episode: Int? = null,
val aniId: String? = null, val aniId: String? = null,
@ -343,7 +332,7 @@ open class SoraItalianStream : TmdbProvider() {
val title: String? = null, val title: String? = null,
val year: Int? = null, val year: Int? = null,
val orgTitle: String? = null, val orgTitle: String? = null,
val isAnime : Boolean val isAnime: Boolean
) )
data class Data( data class Data(
@ -415,7 +404,7 @@ open class SoraItalianStream : TmdbProvider() {
) )
data class MovieDetails ( data class MovieDetails(
val adult: Boolean? = null, val adult: Boolean? = null,
@JsonProperty("first_air_date") val tvDate: String? = null, @JsonProperty("first_air_date") val tvDate: String? = null,
@JsonProperty("release_date") val movieDate: String? = null, @JsonProperty("release_date") val movieDate: String? = null,
@ -442,19 +431,19 @@ open class SoraItalianStream : TmdbProvider() {
@JsonProperty("external_ids") val externalIds: ExternalIds? = null @JsonProperty("external_ids") val externalIds: ExternalIds? = null
) )
data class Recommendations ( data class Recommendations(
@JsonProperty("results") val results: List<Media>? = null, @JsonProperty("results") val results: List<Media>? = null,
) )
data class Credits ( data class Credits(
val cast: List<Cast>? = null, val cast: List<Cast>? = null,
) )
data class ExternalIds ( data class ExternalIds(
@JsonProperty("imdb_id") val imdbId: String? = null @JsonProperty("imdb_id") val imdbId: String? = null
) )
data class Videos ( data class Videos(
val results: List<Trailers>? = null, val results: List<Trailers>? = null,
) )
@ -462,19 +451,19 @@ open class SoraItalianStream : TmdbProvider() {
@JsonProperty("key") val key: String? = null, @JsonProperty("key") val key: String? = null,
) )
data class Genre ( data class Genre(
val id: Long? = null, val id: Long? = null,
val name: String? = null val name: String? = null
) )
data class Season ( data class Season(
@JsonProperty("air_date") val airDate: String? = null, @JsonProperty("air_date") val airDate: String? = null,
@JsonProperty("episode_count") val episodeCount: Long? = null, @JsonProperty("episode_count") val episodeCount: Int? = null,
val id: Long? = null, val id: Long? = null,
val name: String? = null, val name: String? = null,
val overview: String? = null, val overview: String? = null,
@JsonProperty("poster_path") val posterPath: String? = null, @JsonProperty("poster_path") val posterPath: String? = null,
@JsonProperty("season_number") val seasonNumber: Long? = null @JsonProperty("season_number") val seasonNumber: Int? = null
) )
data class AnimeWorldJson( data class AnimeWorldJson(
@ -482,30 +471,36 @@ open class SoraItalianStream : TmdbProvider() {
@JsonProperty("name") val name: String, @JsonProperty("name") val name: String,
@JsonProperty("target") val target: String, @JsonProperty("target") val target: String,
) )
data class AniPlayApiSearchResult( data class AniPlayApiSearchResult(
@JsonProperty("id") val id: Int, @JsonProperty("id") val id: Int,
@JsonProperty("listWebsites") val websites: List<AniPlayWebsites> @JsonProperty("listWebsites") val websites: List<AniPlayWebsites>
) )
data class AniPlayWebsites( data class AniPlayWebsites(
@JsonProperty("url") val url: String? = null, @JsonProperty("url") val url: String? = null,
@JsonProperty("listWebsiteId") val websitesId: Int? = null @JsonProperty("listWebsiteId") val websitesId: Int? = null
) )
data class AniplayApiAnime( data class AniplayApiAnime(
@JsonProperty("episodes") val episodes: List<AniplayApiEpisode>, @JsonProperty("episodes") val episodes: List<AniplayApiEpisode>,
@JsonProperty("seasons") val seasons: List<AniplayApiSeason>?, @JsonProperty("seasons") val seasons: List<AniplayApiSeason>?,
@JsonProperty("title") val title: String? @JsonProperty("title") val title: String?
) )
data class AniplayApiEpisode( data class AniplayApiEpisode(
@JsonProperty("id") val id: Int, @JsonProperty("id") val id: Int,
@JsonProperty("title") val title: String?, @JsonProperty("title") val title: String?,
@JsonProperty("episodeNumber") val number: String, @JsonProperty("episodeNumber") val number: String,
) )
data class AniplayApiSeason( data class AniplayApiSeason(
@JsonProperty("id") val id: Int, @JsonProperty("id") val id: Int,
@JsonProperty("name") val name: String, @JsonProperty("name") val name: String,
@JsonProperty("episodeStart") val episodeStart: Int @JsonProperty("episodeStart") val episodeStart: Int
) )
data class AniPlayApiEpisodeUrl( data class AniPlayApiEpisodeUrl(
@JsonProperty("videoUrl") val url: String @JsonProperty("videoUrl") val url: String
) )
} }

View File

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 3 version = 4
cloudstream { cloudstream {
@ -23,5 +23,5 @@ cloudstream {
) )
iconUrl = "https://www.google.com/s2/favicons?domain=tantifilm.yachts&sz=%size%" iconUrl = "https://www.google.com/s2/favicons?domain=tantifilm.mobi&sz=%size%"
} }

View File

@ -9,7 +9,7 @@ import com.lagradost.cloudstream3.network.CloudflareKiller
class TantifilmProvider : MainAPI() { class TantifilmProvider : MainAPI() {
override var lang = "it" override var lang = "it"
override var mainUrl = "https://tantifilm.delivery" override var mainUrl = "https://tantifilm.mobi"
override var name = "Tantifilm" override var name = "Tantifilm"
override val hasMainPage = true override val hasMainPage = true
override val hasChromecastSupport = true override val hasChromecastSupport = true