mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
close #347
This commit is contained in:
parent
442b79be85
commit
ee89e90282
4 changed files with 222 additions and 0 deletions
26
Cinemathek/build.gradle.kts
Normal file
26
Cinemathek/build.gradle.kts
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// use an integer for version numbers
|
||||||
|
version = 1
|
||||||
|
|
||||||
|
|
||||||
|
cloudstream {
|
||||||
|
language = "de"
|
||||||
|
// All of these properties are optional, you can safely remove them
|
||||||
|
|
||||||
|
// description = "Lorem Ipsum"
|
||||||
|
authors = listOf("Hexated")
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Status int as the following:
|
||||||
|
* 0: Down
|
||||||
|
* 1: Ok
|
||||||
|
* 2: Slow
|
||||||
|
* 3: Beta only
|
||||||
|
* */
|
||||||
|
status = 1 // will be 3 if unspecified
|
||||||
|
tvTypes = listOf(
|
||||||
|
"TvSeries",
|
||||||
|
"Movie",
|
||||||
|
)
|
||||||
|
|
||||||
|
iconUrl = "https://www.google.com/s2/favicons?domain=cinemathek.net&sz=%size%"
|
||||||
|
}
|
2
Cinemathek/src/main/AndroidManifest.xml
Normal file
2
Cinemathek/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest package="com.hexated"/>
|
180
Cinemathek/src/main/kotlin/com/hexated/Cinemathek.kt
Normal file
180
Cinemathek/src/main/kotlin/com/hexated/Cinemathek.kt
Normal file
|
@ -0,0 +1,180 @@
|
||||||
|
package com.hexated
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
import com.lagradost.cloudstream3.*
|
||||||
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
|
||||||
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
||||||
|
import com.lagradost.cloudstream3.utils.*
|
||||||
|
import org.jsoup.nodes.Element
|
||||||
|
|
||||||
|
class Cinemathek : MainAPI() {
|
||||||
|
override var mainUrl = "https://cinemathek.net"
|
||||||
|
override var name = "Cinemathek"
|
||||||
|
override val hasMainPage = true
|
||||||
|
override var lang = "de"
|
||||||
|
override val supportedTypes = setOf(
|
||||||
|
TvType.Movie,
|
||||||
|
TvType.TvSeries,
|
||||||
|
)
|
||||||
|
|
||||||
|
override val mainPage = mainPageOf(
|
||||||
|
"filme" to "Filme",
|
||||||
|
"serien" to "TV Shows",
|
||||||
|
"episoden" to "Episodes",
|
||||||
|
)
|
||||||
|
|
||||||
|
override suspend fun getMainPage(
|
||||||
|
page: Int,
|
||||||
|
request: MainPageRequest
|
||||||
|
): HomePageResponse {
|
||||||
|
val document = app.get("$mainUrl/${request.data}/page/$page/").document
|
||||||
|
val home =
|
||||||
|
document.select("div.items.full article, div#archive-content article").mapNotNull {
|
||||||
|
it.toSearchResult()
|
||||||
|
}
|
||||||
|
return newHomePageResponse(
|
||||||
|
list = HomePageList(
|
||||||
|
name = request.name,
|
||||||
|
list = home,
|
||||||
|
request.data == "episoden"
|
||||||
|
),
|
||||||
|
hasNext = true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getProperLink(uri: String): String {
|
||||||
|
return when {
|
||||||
|
uri.contains("/episoden/") -> {
|
||||||
|
uri.replace(Regex("-\\d+x\\d+"), "").replace("/episoden/", "/serien/")
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
uri
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Element.toSearchResult(): SearchResponse {
|
||||||
|
val title = this.selectFirst("h3 > a")!!.text()
|
||||||
|
val href = getProperLink(this.selectFirst("h3 > a")!!.attr("href"))
|
||||||
|
val posterUrl = this.select("div.poster > img").attr("src").toString()
|
||||||
|
val quality = getQualityFromString(this.select("span.quality").text())
|
||||||
|
return newMovieSearchResponse(title, href, TvType.Movie) {
|
||||||
|
this.posterUrl = posterUrl
|
||||||
|
this.quality = quality
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun search(query: String): List<SearchResponse> {
|
||||||
|
val document = app.get("$mainUrl/search/$query").document
|
||||||
|
return document.select("div.result-item").map {
|
||||||
|
val title = it.selectFirst("div.title > a")!!.text()
|
||||||
|
val href = getProperLink(it.selectFirst("div.title > a")!!.attr("href"))
|
||||||
|
val posterUrl = it.selectFirst("img")!!.attr("src").toString()
|
||||||
|
newMovieSearchResponse(title, href, TvType.TvSeries) {
|
||||||
|
this.posterUrl = posterUrl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun load(url: String): LoadResponse {
|
||||||
|
val document = app.get(url).document
|
||||||
|
val title = document.selectFirst("div.data > h1")?.text() ?: ""
|
||||||
|
val poster = document.select("div.poster > img").attr("src").toString()
|
||||||
|
val tags = document.select("div.sgeneros > a").map { it.text() }
|
||||||
|
|
||||||
|
val year = Regex(",\\s?(\\d+)").find(
|
||||||
|
document.select("span.date").text().trim()
|
||||||
|
)?.groupValues?.get(1).toString().toIntOrNull()
|
||||||
|
val tvType = if (document.select("ul#section > li:nth-child(1)").text().contains("Episodes")
|
||||||
|
) TvType.TvSeries else TvType.Movie
|
||||||
|
val description = document.select("div.wp-content > p").text().trim()
|
||||||
|
val trailer = document.selectFirst("div.embed iframe")?.attr("src")
|
||||||
|
val rating =
|
||||||
|
document.selectFirst("span.dt_rating_vgs")?.text()?.toRatingInt()
|
||||||
|
val actors = document.select("div.persons > div[itemprop=actor]").map {
|
||||||
|
Actor(it.select("meta[itemprop=name]").attr("content"), it.select("img").attr("src"))
|
||||||
|
}
|
||||||
|
|
||||||
|
val recommendations = document.select("div.owl-item").map {
|
||||||
|
val recName =
|
||||||
|
it.selectFirst("a")!!.attr("href").toString().removeSuffix("/").split("/").last()
|
||||||
|
val recHref = it.selectFirst("a")!!.attr("href")
|
||||||
|
val recPosterUrl = it.selectFirst("img")?.attr("src").toString()
|
||||||
|
newTvSeriesSearchResponse(recName, recHref, TvType.TvSeries) {
|
||||||
|
this.posterUrl = recPosterUrl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return if (tvType == TvType.TvSeries) {
|
||||||
|
val episodes = document.select("ul.episodios > li").map {
|
||||||
|
val href = it.select("a").attr("href")
|
||||||
|
val name = fixTitle(it.select("div.episodiotitle > a").text().trim())
|
||||||
|
val image = it.select("div.imagen > img").attr("src")
|
||||||
|
val episode = it.select("div.numerando").text().replace(" ", "").split("-").last()
|
||||||
|
.toIntOrNull()
|
||||||
|
val season = it.select("div.numerando").text().replace(" ", "").split("-").first()
|
||||||
|
.toIntOrNull()
|
||||||
|
Episode(
|
||||||
|
href,
|
||||||
|
name,
|
||||||
|
season,
|
||||||
|
episode,
|
||||||
|
image
|
||||||
|
)
|
||||||
|
}
|
||||||
|
newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) {
|
||||||
|
this.posterUrl = poster
|
||||||
|
this.year = year
|
||||||
|
this.plot = description
|
||||||
|
this.tags = tags
|
||||||
|
this.rating = rating
|
||||||
|
addActors(actors)
|
||||||
|
this.recommendations = recommendations
|
||||||
|
addTrailer(trailer)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newMovieLoadResponse(title, url, TvType.Movie, url) {
|
||||||
|
this.posterUrl = poster
|
||||||
|
this.year = year
|
||||||
|
this.plot = description
|
||||||
|
this.tags = tags
|
||||||
|
this.rating = rating
|
||||||
|
addActors(actors)
|
||||||
|
this.recommendations = recommendations
|
||||||
|
addTrailer(trailer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun loadLinks(
|
||||||
|
data: String,
|
||||||
|
isCasting: Boolean,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit
|
||||||
|
): Boolean {
|
||||||
|
val document = app.get(data).document
|
||||||
|
document.select("ul#playeroptionsul > li").map {
|
||||||
|
Triple(
|
||||||
|
it.attr("data-post"),
|
||||||
|
it.attr("data-nume"),
|
||||||
|
it.attr("data-type")
|
||||||
|
)
|
||||||
|
}.apmap { (id, nume, type) ->
|
||||||
|
val iframe = app.get(
|
||||||
|
url = "$mainUrl/wp-json/dooplayer/v2/$id/$type/$nume",
|
||||||
|
referer = data,
|
||||||
|
headers = mapOf("Accept" to "*/*", "X-Requested-With" to "XMLHttpRequest")
|
||||||
|
).parsedSafe<ResponseHash>()?.embedUrl ?: return@apmap
|
||||||
|
|
||||||
|
if (!iframe.contains("youtube")) loadExtractor(iframe, "$mainUrl/", subtitleCallback, callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
data class ResponseHash(
|
||||||
|
@JsonProperty("embed_url") val embedUrl: String,
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
14
Cinemathek/src/main/kotlin/com/hexated/CinemathekPlugin.kt
Normal file
14
Cinemathek/src/main/kotlin/com/hexated/CinemathekPlugin.kt
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
package com.hexated
|
||||||
|
|
||||||
|
import com.lagradost.cloudstream3.plugins.CloudstreamPlugin
|
||||||
|
import com.lagradost.cloudstream3.plugins.Plugin
|
||||||
|
import android.content.Context
|
||||||
|
|
||||||
|
@CloudstreamPlugin
|
||||||
|
class CinemathekPlugin: Plugin() {
|
||||||
|
override fun load(context: Context) {
|
||||||
|
// All providers should be added in this manner. Please don't edit the providers list directly.
|
||||||
|
registerMainAPI(Cinemathek())
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue