Fixes and new italian Providers (#1)

This commit is contained in:
antonydp 2022-08-19 19:09:38 +02:00 committed by Cloudburst
parent 8e0cde9e7b
commit d17452609f
17 changed files with 771 additions and 12 deletions

View file

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

View file

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

View file

@ -0,0 +1,107 @@
package com.lagradost
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.utils.*
class CalcioStreamingProvider : MainAPI() {
override var lang = "it"
override var mainUrl = "https://calciostreaming.live"
override var name = "CalcioStreaming"
override val hasMainPage = true
override val hasChromecastSupport = true
override val supportedTypes = setOf(
TvType.Live,
)
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
val document = app.get(mainUrl+"/partite-streaming.html").document
val sections = document.select("div.slider-title").filter {it -> it.select("div.item").isNotEmpty()}
if (sections.isEmpty()) throw ErrorLoadingException()
return HomePageResponse(sections.map { it ->
val categoryname = it.selectFirst("h2 > strong")!!.text()
val shows = it.select("div.item").map {
val href = it.selectFirst("a")!!.attr("href")
val name = it.selectFirst("a > div > h1")!!.text()
val posterurl = fixUrl(it.selectFirst("a > img")!!.attr("src"))
LiveSearchResponse(
name,
href,
this@CalcioStreamingProvider.name,
TvType.Live,
posterurl,
)
}
HomePageList(
categoryname,
shows,
isHorizontalImages = true
)
})
}
override suspend fun load(url: String): LoadResponse {
val document = app.get(url).document
val poster = fixUrl(document.select("#title-single > div").attr("style").substringAfter("url(").substringBeforeLast(")"))
val Matchstart = document.select("div.info-wrap > div").textNodes().joinToString("").trim()
return LiveStreamLoadResponse(
document.selectFirst(" div.info-t > h1")!!.text(),
url,
this.name,
url,
poster,
plot = Matchstart
)
}
private suspend fun extractVideoLinks(
url: String,
callback: (ExtractorLink) -> Unit
) {
val document = app.get(url).document
document.select("button.btn").forEach { button ->
val link1 = button.attr("data-link")
val doc2 = app.get(link1).document
val truelink = doc2.selectFirst("iframe")!!.attr("src")
val newpage = app.get(truelink, referer = link1).document
val streamurl = Regex(""""((.|\n)*?).";""").find(
getAndUnpack(
newpage.select("script")[6].childNode(0).toString()
))!!.value.replace("""src="""", "").replace(""""""", "").replace(";", "")
callback(
ExtractorLink(
this.name,
button.text(),
streamurl,
truelink,
quality = 0,
true
)
)
}
}
override suspend fun loadLinks(
data: String,
isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
extractVideoLinks(data, callback)
return true
}
}

View file

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