EurostreamingProvider

This commit is contained in:
Antony 2022-08-26 21:28:53 +02:00
parent 2e0cc911a4
commit 3794da7a6a
4 changed files with 151 additions and 0 deletions

View file

@ -0,0 +1,26 @@
// use an integer for version numbers
version = 1
cloudstream {
language = "it"
// 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(
"TvSeries"
)
iconUrl = "https://www.google.com/s2/favicons?domain=eurostreaming.social&sz=%size%"
}

View file

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

View file

@ -0,0 +1,109 @@
package com.lagradost
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
import com.lagradost.cloudstream3.utils.AppUtils.toJson
class EurostreamingProvider : MainAPI() {
override var lang = "it"
override var mainUrl = "https://eurostreaming.social"
override var name = "Eurostreaming"
override val hasMainPage = true
override val hasChromecastSupport = true
override val supportedTypes = setOf(
TvType.TvSeries
)
override val mainPage = mainPageOf(
Pair("$mainUrl/serie-tv-archive/page/", "Ultime serie Tv"),
Pair("$mainUrl/animazione/page/", "Ultime serie Animazione"),
)
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.post-thumb").map {
val title = it.selectFirst("img")!!.attr("alt")
val link = it.selectFirst("a")!!.attr("href")
val image = fixUrl(it.selectFirst("img")!!.attr("src"))
MovieSearchResponse(
title,
link,
this.name,
TvType.Movie,
image
)
}
return newHomePageResponse(request.name, home)
}
override suspend fun search(query: String): List<SearchResponse> {
val doc = app.post(
"$mainUrl/index.php", data = mapOf(
"do" to "search",
"subaction" to "search",
"story" to query,
"sortby" to "news_read"
)
).document
return doc.select("div.post-thumb").map {
val title = it.selectFirst("img")!!.attr("alt")
val link = it.selectFirst("a")!!.attr("href")
val image = mainUrl + it.selectFirst("img")!!.attr("src")
MovieSearchResponse(
title,
link,
this.name,
TvType.Movie,
image
)
}
}
override suspend fun load(url: String): LoadResponse {
val page = app.get(url)
val document = page.document
val title = document.selectFirst("h2")!!.text().replace("^([1-9+]]$","")
val style = document.selectFirst("div.entry-cover")!!.attr("style")
val poster = fixUrl(Regex("(/upload.+\\))").find(style)!!.value.dropLast(1))
val episodeList = ArrayList<Episode>()
document.select("div.tab-pane.fade").map { element ->
val season = element.attr("id").filter { it.isDigit() }.toInt()
element.select("li").map{episode ->
val data = episode.select("div.mirrors > a").map { it.attr("data-link") }.toJson()
val epTitle = episode.selectFirst("a")!!.attr("data-title")
episodeList.add(
Episode(
data,
epTitle,
season
)
)
}
}
return newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodeList) {
posterUrl = poster
}
}
override suspend fun loadLinks(
data: String,
isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
parseJson<List<String>>(data).map { videoUrl ->
loadExtractor(videoUrl, data, subtitleCallback, 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 EurostreamingProviderPlugin: Plugin() {
override fun load(context: Context) {
// All providers should be added in this manner. Please don't edit the providers list directly.
registerMainAPI(EurostreamingProvider())
}
}