Fix CalcioStreaming, Starlive and Domain changes (#77)

Co-authored-by: contusionglory <102427829+contusionglory@users.noreply.github.com>
This commit is contained in:
antonydp 2023-01-26 13:19:32 +01:00 committed by GitHub
parent e9ff7909ff
commit e9247d553f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 118 additions and 101 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 1
version = 2
cloudstream {

View file

@ -2,7 +2,7 @@ package com.lagradost
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.utils.*
import org.jsoup.nodes.Document
class CalcioStreamingProvider : MainAPI() {
override var lang = "it"
@ -58,12 +58,21 @@ class CalcioStreamingProvider : MainAPI() {
poster,
plot = Matchstart
)
}
private fun matchFound(document: Document) : Boolean {
return Regex(""""((.|\n)*?).";""").containsMatchIn(
getAndUnpack(
document.toString()
))
}
private fun getUrl(document: Document):String{
return Regex(""""((.|\n)*?).";""").find(
getAndUnpack(
document.toString()
))!!.value.replace("""src="""", "").replace(""""""", "").replace(";", "")
}
private suspend fun extractVideoLinks(
url: String,
@ -71,25 +80,28 @@ class CalcioStreamingProvider : MainAPI() {
) {
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
)
)
var link = button.attr("data-link")
var oldLink = link
var videoNotFound = true
while (videoNotFound) {
val doc = app.get(link).document
link = doc.selectFirst("iframe")?.attr("src") ?: break
val newpage = app.get(fixUrl(link), referer = oldLink).document
oldLink = link
if (newpage.select("script").size >= 6 && matchFound(newpage)){
videoNotFound = false
callback(
ExtractorLink(
this.name,
button.text(),
getUrl(newpage),
fixUrl(link),
quality = 0,
true
)
)
}
}
}
}

View file

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 2
version = 3
cloudstream {

View file

@ -10,7 +10,7 @@ import org.jsoup.nodes.Element
class CineBlog01Provider : MainAPI() {
override var lang = "it"
override var mainUrl = "https://www.cineblog01.moe"
override var mainUrl = "https://www.cineblog01.mom"
override var name = "CineBlog01"
override val hasMainPage = true
override val hasChromecastSupport = true

View file

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 2
version = 3
cloudstream {
language = "it"

View file

@ -11,7 +11,7 @@ import org.jsoup.nodes.Element
class EurostreamingProvider : MainAPI() {
override var lang = "it"
override var mainUrl = "https://eurostreaming.taxi"
override var mainUrl = "https://eurostreaming.expert"
override var name = "Eurostreaming"
override val hasMainPage = true
override val hasChromecastSupport = true

View file

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 4
version = 5
cloudstream {

View file

@ -16,7 +16,7 @@ import com.lagradost.cloudstream3.network.CloudflareKiller
class FilmpertuttiProvider : MainAPI() {
override var lang = "it"
override var mainUrl = "https://filmpertutti.skin"
override var mainUrl = "https://filmpertutti.tips"
override var name = "FilmPerTutti"
override val hasMainPage = true
override val hasChromecastSupport = true

View file

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 1
version = 2
cloudstream {

View file

@ -2,9 +2,11 @@ package com.lagradost
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.network.CloudflareKiller
import com.lagradost.cloudstream3.utils.*
import com.lagradost.cloudstream3.utils.AppUtils.toJson
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import org.jsoup.nodes.Element
class StarLiveProvider : MainAPI() {
override var mainUrl = "https://starlive.xyz"
@ -13,72 +15,51 @@ class StarLiveProvider : MainAPI() {
override var lang = "it"
override val hasChromecastSupport = true
override val supportedTypes = setOf(TvType.Live)
private data class LinkParser(
@JsonProperty("link") val link: String,
@JsonProperty("lang") val language: String,
@JsonProperty("name") val name: String
)
private data class MatchDataParser(
@JsonProperty("time") val time: String,
@JsonProperty("poster") val poster: String
)
private data class MatchParser(
@JsonProperty("linkData") val linkData: List<LinkParser>,
@JsonProperty("matchData") val MatchData: MatchDataParser
)
private val interceptor = CloudflareKiller()
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
val document = app.get(mainUrl).document
val sections = document.select("div.panel")
val document = app.get(mainUrl, interceptor = interceptor).document
val sections = document.select("div.panel").groupBy { it.selectFirst("h4 b")?.text() }.values
if (sections.isEmpty()) throw ErrorLoadingException()
val prova = sections.map {elements ->
val home = elements.mapNotNull { it.toMainPageResult() }
HomePageList(elements.first()?.selectFirst("h4 b")?.text()?:"Altro", home)
}
return HomePageResponse(prova)
}
return HomePageResponse(sections.mapNotNull { sport ->
val dayMatch = sport.previousElementSiblings().toList().first { it.`is`("h3") }.text()
val categoryName = sport.selectFirst("h4")?.text() ?: "Other"
val showsList = sport.select("tr").takeWhile { it.text().contains("Player").not() }
.filter { it.hasAttr("class") }.drop(1)
val shows = showsList.groupBy { it.text().substringBeforeLast(" ") }.map { matchs ->
val posterUrl = fixUrl(
sport.selectFirst("h4")?.attr("style")
?.substringAfter("(")?.substringBefore(")") ?: ""
)
val hasDate = matchs.key.contains(":")
val matchName = if (hasDate) { matchs.key.substringAfter(" ")}
else { matchs.key }
val href = matchs.value.map { match ->
val linkUrl = fixUrl(match.selectFirst("a")?.attr("href") ?: return@mapNotNull null)
val lang = match.attr("class")
LinkParser(linkUrl, lang, matchName)
}
val date = if (hasDate) {
dayMatch + " - " + matchs.key.substringBefore(" ")
} else {
dayMatch
}
LiveSearchResponse(
matchName,
MatchParser(href, MatchDataParser(date, posterUrl)).toJson(),
this@StarLiveProvider.name,
TvType.Live,
posterUrl,
)
}
HomePageList(
categoryName,
shows
)
})
private fun Element.toMainPageResult() : LiveSearchResponse {
val name = this.selectFirst("b")?.text()?:"Altro"
val links = this.select("tr")
.toList()
.filter { it.hasAttr("class") && it.attr("class") !in listOf("", "audio") }
.map { LinkParser(
fixUrl(it.selectFirst("a")?.attr("href")?:""),
it.attr("class"),
it.selectFirst("span")?.text()?:""
) }
val dayMatch = this.previousElementSiblings().toList().firstOrNull() { it.`is`("h3") }?.text()
val matchData = MatchDataParser(
dayMatch?.plus(" - ".plus(this.selectFirst("#evento")?.text()?.substringBefore(" ")))?:"no data",
fixUrl(
this.selectFirst("h4")?.attr("style")
?.substringAfter("(")?.substringBefore(")") ?: ""
),
this.selectFirst("#evento")?.text()?.substringAfter(" ")?:"Match in $name || $dayMatch"
)
val href = MatchParser(links, matchData)
return LiveSearchResponse(
this.selectFirst("#evento")?.text()?.substringAfter(" ")?:"Match in $name",
href.toJson(),
this@StarLiveProvider.name,
TvType.Live,
fixUrl(
this.selectFirst("h4")?.attr("style")
?.substringAfter("(")?.substringBefore(")") ?: ""
),
posterHeaders = interceptor.getCookieHeaders(mainUrl).toMap()
)
}
override suspend fun load(url: String): LoadResponse {
@ -88,10 +69,11 @@ class StarLiveProvider : MainAPI() {
return LiveStreamLoadResponse(
dataUrl = url,
url = matchdata?.linkData?.firstOrNull()?.link ?: mainUrl,
name = matchdata?.linkData?.firstOrNull()?.name ?: "No name",
name = matchdata?.MatchData?.name ?: "No name",
posterUrl = poster,
plot = matchstart,
apiName = this@StarLiveProvider.name
apiName = this@StarLiveProvider.name,
posterHeaders = interceptor.getCookieHeaders(mainUrl).toMap()
)
}
@ -99,11 +81,10 @@ class StarLiveProvider : MainAPI() {
data: LinkParser,
callback: (ExtractorLink) -> Unit
) {
val linktoStream = fixUrl(app.get(data.link).document.selectFirst("iframe")!!.attr("src"))
val linktoStream = fixUrl(app.get(data.link, interceptor = interceptor).document.selectFirst("iframe")!!.attr("src"))
val referrerLink = if (linktoStream.contains("starlive")) {
app.get(linktoStream, referer = data.link).document.selectFirst("iframe")?.attr("src")
?: return
app.get(linktoStream, referer = data.link, interceptor = interceptor).document.selectFirst("iframe")?.attr("src")
?: linktoStream
} else {
linktoStream
}
@ -115,7 +96,13 @@ class StarLiveProvider : MainAPI() {
false -> app.get(linktoStream, referer = data.link).document.select("script")
.select("script").toString()
}
val streamUrl = getAndUnpack(packed).substringAfter("var src=\"").substringBefore("\"")
var streamUrl = getAndUnpack(packed).substringAfter("var src=\"").substringBefore("\"")
if (streamUrl.contains("allowedDomains")){streamUrl = packed.substringAfter("source:'").substringBefore("'")}
if (!streamUrl.contains("m3u8")){
val script = app.get(linktoStream, referer = data.link, interceptor = interceptor).document.selectFirst("body")?.selectFirst("script").toString()
streamUrl = Regex("source: [\\\"'](.*?)[\\\"']").find(script)?.groupValues?.last()?:""
}
callback(
ExtractorLink(
source = this.name,
@ -142,4 +129,22 @@ class StarLiveProvider : MainAPI() {
return true
}
private data class LinkParser(
@JsonProperty("link") val link: String,
@JsonProperty("lang") val language: String,
@JsonProperty("name") val name: String
)
private data class MatchDataParser(
@JsonProperty("time") val time: String,
@JsonProperty("poster") val poster: String,
@JsonProperty("name") val name: String
)
private data class MatchParser(
@JsonProperty("linkData") val linkData: List<LinkParser>,
@JsonProperty("matchData") val MatchData: MatchDataParser
)
}

View file

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 4
version = 5
cloudstream {

View file

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