Skip to content

Commit

Permalink
Merge pull request #2 from ArixAR/master
Browse files Browse the repository at this point in the history
update cinemathek provider
  • Loading branch information
ne1work authored Jul 28, 2024
2 parents 6e3e818 + 94f681e commit 5a07461
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cinemathek/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cloudstream {
// All of these properties are optional, you can safely remove them

// description = "Lorem Ipsum"
authors = listOf("Hexated")
authors = listOf("fiveskill")

/**
* Status int as the following:
Expand Down
4 changes: 2 additions & 2 deletions Cinemathek/src/main/kotlin/com/hexated/Cinemathek.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Cinemathek : MainAPI() {
): HomePageResponse {
val document = app.get("$mainUrl/${request.data}/page/$page/").document
val home =
document.select("div.items.full article, div#archive-content article").mapNotNull {
document.select("div.items.items article, div#contenedor article").mapNotNull {
it.toSearchResult()
}
return newHomePageResponse(
Expand All @@ -47,7 +47,7 @@ class Cinemathek : MainAPI() {
private fun getProperLink(uri: String): String {
return when {
uri.contains("/episoden/") -> {
uri.replace(Regex("-\\d+x\\d+"), "").replace("/episoden/", "/serien/")
uri.replace(Regex("-\\d{4}-\\d+x\\d+"), "").replace("/episoden/", "/serien/")
}

else -> {
Expand Down
23 changes: 15 additions & 8 deletions Kinoger/src/main/kotlin/com/ne1work/Kinoger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,30 @@ class Kinoger : MainAPI() {
it.toSearchResult()
}

val script = document.selectFirst("script:containsData(pw)")?.data()
?: document.selectFirst("script:containsData(fsst)")?.data()
?: document.selectFirst("script:containsData(ollhd)")?.data()
val scripts = document.select("script").mapNotNull { script ->
val scriptContent = script.data()
val showPattern = Regex("""show\s*\(\s*\d+\s*,\s*(\[\[.*?\]\])\s*(,\s*.*?)*\s*\)""")
val match = showPattern.find(scriptContent)
match?.groupValues?.get(1)?.replace("'", "\"")
}

val jsonData = scripts.flatMap { data ->
val parsedData = AppUtils.tryParseJson<List<List<String>>>(data)
parsedData ?: emptyList()
}

val data = script?.substringAfter("[")?.substringBeforeLast("]")?.replace("\'", "\"")
val json = AppUtils.tryParseJson<List<List<String>>>("[$data]")
val type = if (document.select("script").any { it.data().contains("0.2") }) TvType.Movie else TvType.TvSeries

val type = if(script?.substringBeforeLast(")")?.substringAfterLast(",") == "0.2") TvType.Movie else TvType.TvSeries
val episodes = json?.flatMapIndexed { season: Int, iframes: List<String> ->
val episodes = jsonData.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
Expand Down

0 comments on commit 5a07461

Please sign in to comment.