mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
parent
f48fe37baa
commit
97339447c7
4 changed files with 198 additions and 0 deletions
26
Kinoger/build.gradle.kts
Normal file
26
Kinoger/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=kinoger.com&sz=%size%"
|
||||
}
|
2
Kinoger/src/main/AndroidManifest.xml
Normal file
2
Kinoger/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="com.hexated"/>
|
155
Kinoger/src/main/kotlin/com/hexated/Kinoger.kt
Normal file
155
Kinoger/src/main/kotlin/com/hexated/Kinoger.kt
Normal file
|
@ -0,0 +1,155 @@
|
|||
package com.hexated
|
||||
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.extractors.Chillx
|
||||
import com.lagradost.cloudstream3.utils.AppUtils
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLinkType
|
||||
import com.lagradost.cloudstream3.utils.Qualities
|
||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||
import org.jsoup.nodes.Element
|
||||
|
||||
class Kinoger : MainAPI() {
|
||||
override var name = "Kinoger"
|
||||
override var mainUrl = "https://kinoger.com"
|
||||
override var lang = "de"
|
||||
override val hasMainPage = true
|
||||
override val supportedTypes = setOf(TvType.TvSeries, TvType.Movie)
|
||||
|
||||
override val mainPage = mainPageOf(
|
||||
"" to "Alle Filme",
|
||||
"stream/action" to "Action",
|
||||
"stream/fantasy" to "Fantasy",
|
||||
"stream/drama" to "Drama",
|
||||
"stream/mystery" to "Mystery",
|
||||
"stream/romance" to "Romance",
|
||||
"stream/animation" to "Animation",
|
||||
"stream/horror" to "Horror",
|
||||
"stream/familie" to "Familie",
|
||||
"stream/komdie" to "Komdie",
|
||||
)
|
||||
|
||||
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
||||
val document = app.get("$mainUrl/${request.data}/page/$page").document
|
||||
val home = document.select("div#dle-content div.short").mapNotNull {
|
||||
it.toSearchResult()
|
||||
}
|
||||
return newHomePageResponse(request.name, home)
|
||||
}
|
||||
|
||||
private fun getProperLink(uri: String): String {
|
||||
return if (uri.contains("-episode-")) {
|
||||
"$mainUrl/series/" + Regex("$mainUrl/(.+)-ep.+").find(uri)?.groupValues?.get(1)
|
||||
} else {
|
||||
uri
|
||||
}
|
||||
}
|
||||
|
||||
private fun Element.toSearchResult(): SearchResponse? {
|
||||
val href = getProperLink(this.selectFirst("a")?.attr("href") ?: return null)
|
||||
val title = this.selectFirst("a")?.text() ?: this.selectFirst("img")?.attr("alt")
|
||||
?: this.selectFirst("a")?.attr("title") ?: return null
|
||||
val posterUrl = fixUrlNull(
|
||||
(this.nextElementSibling()?.selectFirst("div.content_text img") ?: this.selectFirst("div.content_text img") ?: this.selectFirst("img"))?.getImageAttr()
|
||||
)
|
||||
|
||||
return newTvSeriesSearchResponse(title, href, TvType.AsianDrama) {
|
||||
this.posterUrl = posterUrl
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun search(query: String): List<SearchResponse> {
|
||||
return app.get("$mainUrl/?do=search&subaction=search&titleonly=3&story=$query&x=0&y=0&submit=submit").document.select(
|
||||
"div#dle-content div.titlecontrol"
|
||||
).mapNotNull { it.toSearchResult() }
|
||||
}
|
||||
|
||||
override suspend fun load(url: String): LoadResponse {
|
||||
val document = app.get(url).document
|
||||
val title = document.selectFirst("h1#news-title")?.text() ?: ""
|
||||
val poster = fixUrlNull(document.selectFirst("div.images-border img")?.getImageAttr())
|
||||
val description = document.select("div.images-border").text()
|
||||
val year = """\((\d{4})\)""".toRegex().find(title)?.groupValues?.get(1)?.toIntOrNull()
|
||||
val type = if (document.selectFirst("label[title=Stream HD+]")
|
||||
?.hasText() == true
|
||||
) TvType.Movie else TvType.TvSeries
|
||||
|
||||
val recommendations = document.select("ul.ul_related li").mapNotNull {
|
||||
it.toSearchResult()
|
||||
}
|
||||
|
||||
val script = document.selectFirst("script:containsData(pw.show)")?.data()
|
||||
?.substringAfter("[")?.substringBeforeLast("]")?.replace("\'", "\"")
|
||||
val json = AppUtils.tryParseJson<List<List<String>>>("[$script]")
|
||||
|
||||
val episodes = json?.flatMapIndexed { season: Int, iframes: List<String> ->
|
||||
iframes.mapIndexed { episode, iframe ->
|
||||
Episode(
|
||||
iframe.trim(),
|
||||
season = season + 1,
|
||||
episode = episode + 1
|
||||
)
|
||||
}
|
||||
} ?: emptyList()
|
||||
|
||||
return newTvSeriesLoadResponse(title, url, type, episodes) {
|
||||
this.posterUrl = poster
|
||||
this.year = year
|
||||
this.plot = description
|
||||
this.recommendations = recommendations
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun loadLinks(
|
||||
data: String,
|
||||
isCasting: Boolean,
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
loadCustomExtractor(data, "$mainUrl/", subtitleCallback, callback)
|
||||
return true
|
||||
}
|
||||
|
||||
private suspend fun loadCustomExtractor(
|
||||
url: String,
|
||||
referer: String? = null,
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit,
|
||||
quality: Int? = null,
|
||||
) {
|
||||
loadExtractor(url, referer, subtitleCallback) { link ->
|
||||
if(link.quality == Qualities.Unknown.value) {
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
link.source,
|
||||
link.name,
|
||||
link.url,
|
||||
link.referer,
|
||||
when (link.type) {
|
||||
ExtractorLinkType.M3U8 -> link.quality
|
||||
else -> quality ?: link.quality
|
||||
},
|
||||
link.type,
|
||||
link.headers,
|
||||
link.extractorData
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun Element.getImageAttr(): String? {
|
||||
return when {
|
||||
this.hasAttr("data-src") -> this.attr("data-src")
|
||||
this.hasAttr("data-lazy-src") -> this.attr("data-lazy-src")
|
||||
this.hasAttr("srcset") -> this.attr("srcset").substringBefore(" ")
|
||||
else -> this.attr("src")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Kinogeru : Chillx() {
|
||||
override val name = "Kinoger"
|
||||
override val mainUrl = "https://kinoger.ru"
|
||||
}
|
15
Kinoger/src/main/kotlin/com/hexated/KinogerPlugin.kt
Normal file
15
Kinoger/src/main/kotlin/com/hexated/KinogerPlugin.kt
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
package com.hexated
|
||||
|
||||
import com.lagradost.cloudstream3.plugins.CloudstreamPlugin
|
||||
import com.lagradost.cloudstream3.plugins.Plugin
|
||||
import android.content.Context
|
||||
|
||||
@CloudstreamPlugin
|
||||
class KinogerPlugin: Plugin() {
|
||||
override fun load(context: Context) {
|
||||
// All providers should be added in this manner. Please don't edit the providers list directly.
|
||||
registerMainAPI(Kinoger())
|
||||
registerExtractorAPI(Kinogeru())
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue