More Indonesia Provider (#1079)

* Add files via upload

* Add files via upload

* Update MainAPI.kt

* - Add NontonAnimeID and Kuramanime
 - refactoring code

* add GomunimeProvider, add some source, fix minor code

* add sources

* add KuronimeProvider, add sources

* small fix, (ready to merge..)

* add indonesia provider, add extractor, add source, small fix

* small fix (ready to merge)

* fix
This commit is contained in:
Hexated 2022-05-23 17:55:13 +07:00 committed by GitHub
parent 9813b824e8
commit 0af3c60c90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 762 additions and 167 deletions

View file

@ -88,6 +88,8 @@ object APIHolder {
StreamingcommunityProvider(),
TantifilmProvider(),
HDMovie5(),
RebahinProvider(),
LayarKaca21Provider(),
// Metadata providers
//TmdbProvider(),
@ -628,6 +630,8 @@ fun getQualityFromString(string: String?): SearchQuality? {
"dvdscr" -> SearchQuality.DVD
"blueray" -> SearchQuality.BlueRay
"bluray" -> SearchQuality.BlueRay
"blu" -> SearchQuality.BlueRay
"fhd" -> SearchQuality.HD
"br" -> SearchQuality.BlueRay
"standard" -> SearchQuality.SD
"sd" -> SearchQuality.SD

View file

@ -168,18 +168,6 @@ class GomunimeProvider : MainAPI() {
}
}
private fun invokeSource(
source: String,
sourceCallback: (ExtractorLink) -> Unit
) {
M3u8Helper.generateM3u8(
source = this.name,
streamUrl = source,
referer = "$mainUrl/",
name = this.name,
).forEach(sourceCallback)
}
data class MobiSource(
@JsonProperty("file") val file: String,
@JsonProperty("label") val label: String,
@ -219,15 +207,19 @@ class GomunimeProvider : MainAPI() {
url = "https://path.gomuni.me/app/vapi.php",
data = mapOf("fid" to it.first, "func" to "hls")
).text.let { link ->
invokeSource(link, callback)
M3u8Helper.generateM3u8(
this.name,
link,
mainUrl,
).forEach(callback)
}
}
else -> {
it.second.contains("mp4") -> {
app.post(
url = "https://path.gomuni.me/app/vapi.php",
data = mapOf("data" to it.first, "func" to "blogs")
).parsed<List<MobiSource>>().map {
callback(
callback.invoke(
ExtractorLink(
source = name,
name = "Mobi SD",
@ -238,6 +230,7 @@ class GomunimeProvider : MainAPI() {
)
}
}
else -> null
}
}
}

View file

@ -61,8 +61,12 @@ class KuronimeProvider : MainAPI() {
} else {
var title = uri.substringAfter("$mainUrl/")
title = when {
(title.contains("-episode")) && !(title.contains("-movie")) -> Regex("nonton-(.+)-episode").find(title)?.groupValues?.get(1).toString()
(title.contains("-movie")) -> Regex("nonton-(.+)-movie").find(title)?.groupValues?.get(1).toString()
(title.contains("-episode")) && !(title.contains("-movie")) -> Regex("nonton-(.+)-episode").find(
title
)?.groupValues?.get(1).toString()
(title.contains("-movie")) -> Regex("nonton-(.+)-movie").find(title)?.groupValues?.get(
1
).toString()
else -> title
}
@ -108,12 +112,17 @@ class KuronimeProvider : MainAPI() {
it.select("img").attr("src")
}
val tags = document.select(".infodetail > ul > li:nth-child(2) > a").map { it.text() }
val type = getType(document.selectFirst(".infodetail > ul > li:nth-child(7)")?.ownText()?.trim().toString())
val type = getType(
document.selectFirst(".infodetail > ul > li:nth-child(7)")?.ownText()?.trim().toString()
)
val trailer = document.select("iframe.entered.lazyloaded").attr("src")
val year = Regex("\\d, ([0-9]*)").find(
document.select(".infodetail > ul > li:nth-child(5)").text()
)?.groupValues?.get(1)?.toIntOrNull()
val status = getStatus(document.selectFirst(".infodetail > ul > li:nth-child(3)")!!.ownText().replace(Regex("\\W"), ""))
val status = getStatus(
document.selectFirst(".infodetail > ul > li:nth-child(3)")!!.ownText()
.replace(Regex("\\W"), "")
)
val description = document.select("span.const > p").text()
val episodes = document.select("div.bixbox.bxcl > ul > li").map {
@ -156,7 +165,7 @@ class KuronimeProvider : MainAPI() {
link,
referer = "https://animeku.org/",
quality = Qualities.Unknown.value,
isM3u8 = link.contains(".m3u8")
isM3u8 = true
)
)
}
@ -170,21 +179,14 @@ class KuronimeProvider : MainAPI() {
callback: (ExtractorLink) -> Unit
): Boolean {
val document = app.get(data).document
val iframeLink = document.select(".mobius > .mirror > option").mapNotNull {
val sources = document.select(".mobius > .mirror > option").mapNotNull {
fixUrl(Jsoup.parse(base64Decode(it.attr("value"))).select("iframe").attr("src"))
}
iframeLink.map {
it.replace("https://ok.ru", "http://ok.ru")
}.apmap {
sources.apmap {
safeApiCall {
when {
it.contains("hxfile.co") -> invokeLocalSource(
it,
this.name,
sourceCallback = callback
)
// it.contains("animeku.org") -> invokeKuroSource(it, callback)
it.contains("animeku.org") -> invokeKuroSource(it, callback)
else -> loadExtractor(it, mainUrl, callback)
}
}

View file

@ -89,7 +89,7 @@ class NeonimeProvider : MainAPI() {
return document.select("div.item.episode-home").mapNotNull {
val title = it.selectFirst("div.judul-anime > span")!!.text()
val poster = it.select("img").attr("data-src")
val poster = it.select("img").attr("data-src").toString().trim()
val episodes = it.selectFirst("div.fixyear > h2.text-center")!!
.text().replace(Regex("[^0-9]"), "").trim().toIntOrNull()
val tvType = getType(it.selectFirst("span.calidad2.episode")?.text().toString())
@ -102,11 +102,6 @@ class NeonimeProvider : MainAPI() {
}
}
data class NeonimeSyncData(
@JsonProperty("mal_id") val malId: String?,
@JsonProperty("anilist_id") val aniListId: String?,
)
override suspend fun load(url: String): LoadResponse {
val document = app.get(url).document
@ -174,14 +169,8 @@ class NeonimeProvider : MainAPI() {
}
}
source.map {
it.replace("https://ok.ru", "http://ok.ru")
}.apmap {
when {
it.contains("blogger.com") -> invokeBloggerSource(it, callback)
it.contains("7njctn.neonime.watch") || it.contains("8njctn.neonime.net") -> invokeLocalSource(it, mainUrl, redirect = false, callback)
else -> loadExtractor(it, data, callback)
}
source.apmap {
loadExtractor(it, data, callback)
}
return true

View file

@ -73,11 +73,15 @@ class NontonAnimeIDProvider : MainAPI() {
val name = Regex("$mainUrl/(.*)-episode.*").find(uri)?.groupValues?.get(1).toString()
if (name.contains("movie")) {
return "$mainUrl/anime/" + name.replace("-movie", "")
} else {
if (name.contains("kokurasetai-season-3")) {
"$mainUrl/anime/${name.replace("season-3", "ultra-romantic")}"
} else {
"$mainUrl/anime/$name"
}
}
}
}
private fun Element.toSearchResult(): SearchResponse {
val href = getProperAnimeLink(fixUrl(this.selectFirst("a")!!.attr("href")))
@ -233,115 +237,10 @@ class NontonAnimeIDProvider : MainAPI() {
sources.add(fixUrl(iframe))
}
sources.map {
it.replace("https://ok.ru", "http://ok.ru")
}.apmap {
when {
it.contains("blogger.com") -> invokeBloggerSource(it, callback)
it.contains("kotakanimeid.com") -> invokeLocalSource(
it,
this.name,
sourceCallback = callback
)
else -> loadExtractor(it, data, callback)
}
sources.apmap {
loadExtractor(it, data, callback)
}
return true
}
}
// re-use as extractorApis
suspend fun invokeBloggerSource(
url: String,
sourceCallback: (ExtractorLink) -> Unit
) {
val doc = app.get(url).document
val sourceName = Regex("[^w{3}]\\.?(.+)\\.").find(URI(url).host)?.groupValues?.get(1).toString()
.replace(Regex("\\w+\\."), "").replaceFirstChar { it.uppercase() }
val server =
doc.selectFirst("script")?.data()!!.substringAfter("\"streams\":[").substringBefore("]")
tryParseJson<List<BloggerSource>>("[$server]")?.map {
sourceCallback.invoke(
ExtractorLink(
sourceName,
sourceName,
it.play_url,
referer = "https://www.youtube.com/",
quality = when (it.format_id) {
18 -> 360
22 -> 720
else -> Qualities.Unknown.value
}
)
)
}
}
data class BloggerSource(
@JsonProperty("play_url") val play_url: String,
@JsonProperty("format_id") val format_id: Int
)
suspend fun invokeLocalSource(
source: String,
ref: String,
redirect: Boolean = true,
sourceCallback: (ExtractorLink) -> Unit
) {
val doc = app.get(source, allowRedirects = redirect).document
val sourceName =
Regex("[^w{3}]\\.?(.+)\\.").find(URI(source).host)?.groupValues?.get(1).toString()
.replace(Regex("\\w+\\."), "").replaceFirstChar { it.uppercase() }
doc.select("script").map { script ->
if (script.data().contains("eval(function(p,a,c,k,e,d)")) {
val data = getAndUnpack(script.data())
val server = data.substringAfter("sources:[").substringBefore("]")
tryParseJson<List<ResponseSource>>("[$server]")?.map {
sourceCallback.invoke(
ExtractorLink(
sourceName,
sourceName,
it.file,
referer = ref,
quality = when {
source.contains("hxfile.co") -> getQualityFromName(
Regex("\\d\\.(.*?).mp4").find(
doc.select("title").text()
)?.groupValues?.get(1).toString()
)
else -> getQualityFromName(it.label)
}
)
)
}
} else {
if (script.data().contains("\"sources\":[")) {
val server = script.data().substringAfter("\"sources\":[").substringBefore("]")
tryParseJson<List<ResponseSource>>("[$server]")?.map {
sourceCallback.invoke(
ExtractorLink(
sourceName,
sourceName,
it.file,
referer = ref,
quality = getQualityFromName(it.label)
)
)
}
} else {
// skip for now
}
}
}
}
data class ResponseSource(
@JsonProperty("file") val file: String,
@JsonProperty("type") val type: String?,
@JsonProperty("label") val label: String?
)

View file

@ -187,17 +187,12 @@ class OploverzProvider : MainAPI() {
callback: (ExtractorLink) -> Unit
): Boolean {
val document = app.get(data).document
val iframeLink = document.select(".mobius > .mirror > option").mapNotNull {
val sources = document.select(".mobius > .mirror > option").mapNotNull {
fixUrl(Jsoup.parse(base64Decode(it.attr("value"))).select("iframe").attr("src"))
}
iframeLink.map {
it.replace("https://ok.ru", "http://ok.ru")
}.apmap {
when {
it.contains("blogger.com") -> invokeBloggerSource(it, callback)
else -> loadExtractor(it, data, callback)
}
sources.apmap {
loadExtractor(it, data, callback)
}
return true

View file

@ -0,0 +1,45 @@
package com.lagradost.cloudstream3.extractors
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.utils.*
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
class Blogger : ExtractorApi() {
override val name = "Blogger"
override val mainUrl = "https://www.blogger.com"
override val requiresReferer = false
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
val sources = mutableListOf<ExtractorLink>()
with(app.get(url).document) {
this.select("script").map { script ->
if (script.data().contains("\"streams\":[")) {
val data = script.data().substringAfter("\"streams\":[")
.substringBefore("]")
tryParseJson<List<ResponseSource>>("[$data]")?.map {
sources.add(
ExtractorLink(
name,
name,
it.play_url,
referer = "https://www.youtube.com/",
quality = when (it.format_id) {
18 -> 360
22 -> 720
else -> Qualities.Unknown.value
}
)
)
}
}
}
}
return sources
}
private data class ResponseSource(
@JsonProperty("play_url") val play_url: String,
@JsonProperty("format_id") val format_id: Int
)
}

View file

@ -0,0 +1,89 @@
package com.lagradost.cloudstream3.extractors
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.utils.*
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
class Neonime7n : Hxfile() {
override val name = "Neonime7n"
override val mainUrl = "https://7njctn.neonime.watch"
override val redirect = false
}
class Neonime8n : Hxfile() {
override val name = "Neonime8n"
override val mainUrl = "https://8njctn.neonime.net"
override val redirect = false
}
class KotakAnimeid : Hxfile() {
override val name = "KotakAnimeid"
override val mainUrl = "https://kotakanimeid.com"
}
private data class ResponseSource(
@JsonProperty("file") val file: String,
@JsonProperty("type") val type: String?,
@JsonProperty("label") val label: String?
)
open class Hxfile : ExtractorApi() {
override val name = "Hxfile"
override val mainUrl = "https://hxfile.co"
override val requiresReferer = false
open val redirect = true
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
val sources = mutableListOf<ExtractorLink>()
val document = app.get(url, allowRedirects = redirect).document
with(document) {
this.select("script").map { script ->
if (script.data().contains("eval(function(p,a,c,k,e,d)")) {
val data =
getAndUnpack(script.data()).substringAfter("sources:[").substringBefore("]")
tryParseJson<List<ResponseSource>>("[$data]")?.map {
sources.add(
ExtractorLink(
name,
name,
it.file,
referer = mainUrl,
quality = when {
url.contains("hxfile.co") -> getQualityFromName(
Regex("\\d\\.(.*?).mp4").find(
document.select("title").text()
)?.groupValues?.get(1).toString()
)
else -> getQualityFromName(it.label)
}
)
)
}
} else if (script.data().contains("\"sources\":[")) {
val data = script.data().substringAfter("\"sources\":[").substringBefore("]")
tryParseJson<List<ResponseSource>>("[$data]")?.map {
sources.add(
ExtractorLink(
name,
name,
it.file,
referer = mainUrl,
quality = when {
it.label?.contains("HD") == true -> Qualities.P720.value
it.label?.contains("SD") == true -> Qualities.P480.value
else -> getQualityFromName(it.label)
}
)
)
}
}
else {
null
}
}
}
return sources
}
}

View file

@ -15,6 +15,7 @@ class Mp4Upload : ExtractorApi() {
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
with(app.get(url)) {
getAndUnpack(this.text).let { unpackedText ->
val quality = unpackedText.lowercase().substringAfter(" height=").substringBefore(" ").toIntOrNull()
srcRegex.find(unpackedText)?.groupValues?.get(1)?.let { link ->
return listOf(
ExtractorLink(
@ -22,7 +23,7 @@ class Mp4Upload : ExtractorApi() {
name,
link,
url,
Qualities.Unknown.value,
quality ?: Qualities.Unknown.value,
)
)
}

View file

@ -7,6 +7,9 @@ import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.M3u8Helper
class SBfull : StreamSB() {
override var mainUrl = "https://sbfull.com"
}
class StreamSB1 : StreamSB() {
override var mainUrl = "https://sbplay1.com"
@ -68,12 +71,16 @@ open class StreamSB : ExtractorApi() {
return String(hexChars)
}
data class Subs (
@JsonProperty("file") val file: String,
@JsonProperty("label") val label: String,
)
data class StreamData (
@JsonProperty("file") val file: String,
@JsonProperty("cdn_img") val cdnImg: String,
@JsonProperty("hash") val hash: String,
@JsonProperty("subs") val subs: List<String>,
@JsonProperty("subs") val subs: List<Subs>?,
@JsonProperty("length") val length: String,
@JsonProperty("id") val id: String,
@JsonProperty("title") val title: String,

View file

@ -8,6 +8,16 @@ import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.getQualityFromName
class LayarKaca: XStreamCdn() {
override val name: String = "LayarKaca-xxi"
override val mainUrl: String = "https://layarkacaxxi.icu"
}
class DBfilm: XStreamCdn() {
override val name: String = "DBfilm"
override val mainUrl: String = "https://dbfilm.bar"
}
class FEmbed: XStreamCdn() {
override val name: String = "FEmbed"
override val mainUrl: String = "https://www.fembed.com"

View file

@ -2,7 +2,6 @@ package com.lagradost.cloudstream3.movieproviders
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.animeproviders.invokeBloggerSource
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.getQualityFromName
@ -198,11 +197,11 @@ class DramaidProvider : MainAPI() {
callback: (ExtractorLink) -> Unit
): Boolean {
val document = app.get(data).document
val iframeLink = document.select(".mobius > .mirror > option").mapNotNull {
val sources = document.select(".mobius > .mirror > option").mapNotNull {
fixUrl(Jsoup.parse(base64Decode(it.attr("value"))).select("iframe").attr("src"))
}
iframeLink.map {
sources.map {
it.replace("https://ndrama.xyz", "https://www.fembed.com")
}.apmap {
when {

View file

@ -0,0 +1,226 @@
package com.lagradost.cloudstream3.movieproviders
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.httpsify
import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.Jsoup
import org.jsoup.nodes.Element
import java.util.*
class LayarKaca21Provider : MainAPI() {
override var mainUrl = "https://149.56.24.226/"
override var name = "LayarKaca21"
override val hasMainPage = true
override val lang = "id"
override val hasDownloadSupport = true
override val supportedTypes = setOf(
TvType.Movie,
TvType.TvSeries,
)
override suspend fun getMainPage(): HomePageResponse {
val document = app.get(mainUrl).document
val homePageList = ArrayList<HomePageList>()
document.select("section.hot-block,section#newseries").forEach { block ->
val header = block.select("footer.load-more > a").text().trim()
val items = block.select("div.slider-item").mapNotNull {
it.toTopSearchResult()
}
if (items.isNotEmpty()) homePageList.add(HomePageList(header, items))
}
document.select("div#newest").forEach { block ->
val header = block.select(".header > h2 > a").text()
val items = block.select("div.item").mapNotNull {
it.toMainSearchResult()
}
if (items.isNotEmpty()) homePageList.add(HomePageList(header, items))
}
document.select("section#recomendation,section#populer,section#seriespopuler")
.forEach { block ->
val header = block.select(".header > h2 > a").text()
val items = block.select("div.item").mapNotNull {
it.toBottomSearchResult()
}
if (items.isNotEmpty()) homePageList.add(HomePageList(header, items))
}
return HomePageResponse(homePageList)
}
private fun Element.toTopSearchResult(): SearchResponse {
val title = this.selectFirst("h3.caption")!!.text().trim()
val href = this.selectFirst("a")!!.attr("href")
val posterUrl = fixUrl(this.selectFirst("a > img")?.attr("src").toString())
val type =
if (this.select("div.quality-top").isNotEmpty()) TvType.Movie else TvType.TvSeries
return if (type == TvType.Movie) {
val quality = getQualityFromString(this.select("div.quality-top").text().trim())
return newMovieSearchResponse(title, href, TvType.Movie) {
this.posterUrl = posterUrl
this.quality = quality
}
} else {
val episode = this.select("div.last-episode > span").text().toIntOrNull()
newAnimeSearchResponse(title, href, TvType.TvSeries) {
this.posterUrl = posterUrl
addDubStatus(dubExist = false, subExist = true, subEpisodes = episode)
}
}
}
private fun Element.toMainSearchResult(): SearchResponse {
val title = this.selectFirst("h3.caption")!!.text().trim()
val href = this.selectFirst("a")!!.attr("href")
val posterUrl = fixUrl(this.select("a > img").attr("src").toString())
val quality = getQualityFromString(this.select("div.quality-top").text().trim())
return newMovieSearchResponse(title, href, TvType.Movie) {
this.posterUrl = posterUrl
this.quality = quality
}
}
private fun Element.toBottomSearchResult(): SearchResponse {
val title = this.selectFirst("h1.grid-title > a")!!.ownText().trim()
val href = this.selectFirst("h1.grid-title > a")!!.attr("href")
val posterUrl = fixUrl(this.selectFirst(".grid-poster > a > img")?.attr("src").toString())
val type = if (this.select("div.quality").isNotEmpty()) TvType.Movie else TvType.TvSeries
return if (type == TvType.Movie) {
val quality = getQualityFromString(this.select("div.quality").text().trim())
return newMovieSearchResponse(title, href, TvType.Movie) {
this.posterUrl = posterUrl
this.quality = quality
}
} else {
newTvSeriesSearchResponse(title, href, TvType.TvSeries) {
this.posterUrl = posterUrl
}
}
}
override suspend fun search(query: String): List<SearchResponse> {
val link = "$mainUrl/?s=$query"
val document = app.get(link).document
return document.select("div.search-item").map {
val title = it.selectFirst("h2 > a")!!.text().trim()
val href = it.selectFirst("h2 > a")!!.attr("href")
val posterUrl = fixUrl(it.selectFirst("img.img-thumbnail")?.attr("src").toString())
newTvSeriesSearchResponse(title, href, TvType.TvSeries) {
this.posterUrl = posterUrl
}
}
}
override suspend fun load(url: String): LoadResponse {
val document = app.get(url).document
val title = document.selectFirst("li.last > span[itemprop=name]")?.text()?.trim().toString()
val poster = fixUrl(document.select("img.img-thumbnail").attr("src").toString())
val tags = document.select("div.content > div:nth-child(5) > h3 > a").map { it.text() }
val year = Regex("\\d, (\\d+)").find(
document.select("div.content > div:nth-child(7) > h3").text().trim()
)?.groupValues?.get(1).toString().toIntOrNull()
val tvType = if (document.select("div.serial-wrapper")
.isNotEmpty()
) TvType.TvSeries else TvType.Movie
val description = document.select("div.content > blockquote").text().trim()
val rating =
document.selectFirst("div.content > div:nth-child(6) > h3")?.text()?.toRatingInt()
val actors = document.select("div.col-xs-9.content > div:nth-child(3) > h3 > a").map {
ActorData(
Actor(
it.text()
)
)
}
val recommendations = document.select("div.row.item-media").map {
val recName = it.selectFirst("h3")?.text()?.trim().toString()
val recHref = it.selectFirst(".content-media > a")!!.attr("href")
val recPosterUrl = fixUrl(it.selectFirst(".poster-media > a > img")?.attr("src").toString())
newTvSeriesSearchResponse(recName, recHref, TvType.TvSeries) {
this.posterUrl = recPosterUrl
}
}
return if (tvType == TvType.TvSeries) {
val episodes = document.select("div.episode-list > a:matches(\\d+)").map {
val href = fixUrl(it.attr("href"))
val episode = it.text().toIntOrNull()
val season =
it.attr("href").substringAfter("season-").substringBefore("-").toIntOrNull()
Episode(
href,
"Episode $episode",
season,
episode,
)
}.reversed()
newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) {
this.posterUrl = poster
this.year = year
this.plot = description
this.tags = tags
this.rating = rating
this.actors = actors
this.recommendations = recommendations
}
}
else {
newMovieLoadResponse(title, url, TvType.Movie, url) {
this.posterUrl = poster
this.year = year
this.plot = description
this.tags = tags
this.rating = rating
this.actors = actors
this.recommendations = recommendations
}
}
}
override suspend fun loadLinks(
data: String,
isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
val document = app.get(data).document
val sources = if(data.contains("-episode-")) {
document.select("script").mapNotNull { script ->
if(script.data().contains("var data =")) {
val scriptData = script.toString().substringAfter("var data = '").substringBefore("';")
Jsoup.parse(scriptData).select("li").map {
fixUrl(it.select("a").attr("href"))
}
} else {
null
}
}[0]
} else {
document.select("ul#loadProviders > li").map {
fixUrl(it.select("a").attr("href"))
}
}
sources.apmap {
loadExtractor(it, data, callback)
}
return true
}
}

View file

@ -0,0 +1,326 @@
package com.lagradost.cloudstream3.movieproviders
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.mvvm.safeApiCall
import com.lagradost.cloudstream3.network.WebViewResolver
import com.lagradost.cloudstream3.utils.*
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import org.jsoup.nodes.Element
import java.net.URI
import java.util.ArrayList
class RebahinProvider : MainAPI() {
override var mainUrl = "http://167.88.14.149"
override var name = "Rebahin"
override val hasMainPage = true
override val lang = "id"
override val hasDownloadSupport = true
override val supportedTypes = setOf(
TvType.Movie,
TvType.TvSeries,
)
override suspend fun getMainPage(): HomePageResponse {
val urls = listOf(
Pair("Featured", "xtab1"),
Pair("Film Terbaru", "xtab2"),
Pair("Romance", "xtab3"),
Pair("Drama", "xtab4"),
Pair("Action", "xtab5"),
Pair("Scifi", "xtab6"),
Pair("Tv Series Terbaru", "stab1"),
Pair("Anime Series", "stab2"),
Pair("Drakor Series", "stab3"),
Pair("West Series", "stab4"),
Pair("China Series", "stab5"),
Pair("Japan Series", "stab6"),
)
val items = ArrayList<HomePageList>()
for ((header, tab) in urls) {
try {
val home =
app.get("$mainUrl/wp-content/themes/indoxxi/ajax-top-$tab.php").document.select(
"div.ml-item"
).map {
it.toSearchResult()
}
items.add(HomePageList(header, home))
} catch (e: Exception) {
logError(e)
}
}
if (items.size <= 0) throw ErrorLoadingException()
return HomePageResponse(items)
}
private fun Element.toSearchResult(): SearchResponse {
val title = this.selectFirst("span.mli-info > h2")!!.text().trim()
val href = this.selectFirst("a")!!.attr("href")
val type =
if (this.select("span.mli-quality").isNotEmpty()) TvType.Movie else TvType.TvSeries
return if (type == TvType.Movie) {
val posterUrl = this.select("img").attr("src")
val quality = getQualityFromString(this.select("span.mli-quality").text().trim())
newMovieSearchResponse(title, href, TvType.Movie) {
this.posterUrl = posterUrl
this.quality = quality
}
} else {
val posterUrl =
this.select("img").attr("src").ifEmpty { this.select("img").attr("data-original") }
val episode =
this.select("div.mli-eps > span").text().replace(Regex("[^0-9]"), "").toIntOrNull()
newAnimeSearchResponse(title, href, TvType.TvSeries) {
this.posterUrl = posterUrl
addDubStatus(dubExist = false, subExist = true, subEpisodes = episode)
}
}
}
override suspend fun search(query: String): List<SearchResponse> {
val link = "$mainUrl/?s=$query"
val document = app.get(link).document
return document.select("div.ml-item").map {
it.toSearchResult()
}
}
override suspend fun load(url: String): LoadResponse {
val document = app.get(url).document
val title = document.selectFirst("h3[itemprop=name]")!!.ownText().trim()
val poster = document.select(".mvic-desc > div.thumb.mvic-thumb").attr("style")
.substringAfter("url(").substringBeforeLast(")")
val tags = document.select("span[itemprop=genre]").map { it.text() }
val year = Regex("([0-9]{4}?)-").find(
document.selectFirst(".mvici-right > p:nth-child(3)")!!.ownText().trim()
)?.groupValues?.get(1).toString().toIntOrNull()
val tvType = if (url.contains("/series/")) TvType.TvSeries else TvType.Movie
val description = document.select("span[itemprop=reviewBody] > p").text().trim()
val rating = document.selectFirst("span[itemprop=ratingValue]")?.text()?.toRatingInt()
val duration = document.selectFirst(".mvici-right > p:nth-child(1)")!!
.ownText().replace(Regex("[^0-9]"), "").toIntOrNull()
val actors = document.select("span[itemprop=actor] > a").map {
ActorData(
Actor(
it.select("span").text()
)
)
}
return if (tvType == TvType.TvSeries) {
val baseLink = document.select("div#mv-info > a").attr("href")
val episodes = app.get(baseLink).document.select("div#list-eps > a").map {
val name = it.text().replace(Regex("Server\\s?\\d"), "").trim()
name
}.distinct().map {
val name = it
// val epNum = Regex("[^r|R]\\s(\\d+)").find(it)?.groupValues?.get(1)?.toIntOrNull()
val epNum = it.replace(Regex("[^0-9]"), "").toIntOrNull()
val link = "$baseLink?ep=$epNum"
newEpisode(link) {
this.name = name
this.episode = epNum
}
}
newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) {
this.posterUrl = poster
this.year = year
this.plot = description
this.tags = tags
this.rating = rating
this.duration = duration
this.actors = actors
}
} else {
val episodes = document.select("div#mv-info > a").attr("href")
newMovieLoadResponse(title, url, TvType.Movie, episodes) {
this.posterUrl = poster
this.year = year
this.plot = description
this.tags = tags
this.rating = rating
this.duration = duration
this.actors = actors
}
}
}
private data class ResponseLocal(
@JsonProperty("file") val file: String,
@JsonProperty("label") val label: String,
@JsonProperty("type") val type: String?
)
private data class Tracks(
@JsonProperty("file") val file: String,
@JsonProperty("label") val label: String?,
@JsonProperty("kind") val kind: String?
)
private suspend fun invokeLokalSource(
url: String,
name: String,
subCallback: (SubtitleFile) -> Unit,
sourceCallback: (ExtractorLink) -> Unit
) {
val document = app.get(
url,
allowRedirects = false,
referer = mainUrl,
headers = mapOf("Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8")
).document
document.select("script").map { script ->
if (script.data().contains("sources: [")) {
val source = tryParseJson<ResponseLocal>(
script.data().substringAfter("sources: [").substringBefore("],"))
M3u8Helper.generateM3u8(
name,
source!!.file,
"http://172.96.161.72",
).forEach(sourceCallback)
val trackJson = script.data().substringAfter("tracks: [").substringBefore("],")
val track = tryParseJson<List<Tracks>>("[$trackJson]")
track?.map {
subCallback(
SubtitleFile(
"Indonesian",
(if (it.file.contains(".srt")) it.file else null)!!
)
)
}
}
}
}
private data class Captions(
@JsonProperty("id") val id: String,
@JsonProperty("hash") val hash: String,
@JsonProperty("language") val language: String,
)
private data class Data(
@JsonProperty("file") val file: String,
@JsonProperty("label") val label: String,
)
private data class Player(
@JsonProperty("poster_file") val poster_file: String,
)
private data class ResponseKotakAjair(
@JsonProperty("success") val success: Boolean,
@JsonProperty("player") val player: Player,
@JsonProperty("data") val data: List<Data>?,
@JsonProperty("captions") val captions: List<Captions>?
)
private suspend fun invokeKotakAjairSource(
url: String,
subCallback: (SubtitleFile) -> Unit,
sourceCallback: (ExtractorLink) -> Unit
) {
val domainUrl = "https://kotakajair.xyz"
val id = url.trimEnd('/').split("/").last()
val sources = app.post(
url = "$domainUrl/api/source/$id",
data = mapOf("r" to mainUrl, "d" to URI(url).host)
).parsed<ResponseKotakAjair>()
sources.data?.map {
sourceCallback.invoke(
ExtractorLink(
name,
"KotakAjair",
fixUrl(it.file),
referer = url,
quality = getQualityFromName(it.label)
)
)
}
val userData = sources.player.poster_file.split("/")[2]
sources.captions?.map {
subCallback(
SubtitleFile(
if (it.language.lowercase().contains("eng")) it.language else "Indonesian",
"$domainUrl/asset/userdata/$userData/caption/${it.hash}/${it.id}.srt"
)
)
}
}
override suspend fun loadLinks(
data: String,
isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
val sources = if (data.contains("/play")) {
app.get(data).document.select(".server-wrapper").mapNotNull {
val iframeLink =
"${mainUrl}/iembed/?source=${it.selectFirst("div.server")?.attr("data-iframe")}"
app.get(iframeLink).document.select("iframe").attr("src")
}
} else {
val fixData = Regex("(.*?)\\?ep").find(data)?.groupValues?.get(1).toString()
val document = app.get(fixData).document
val ep = Regex("\\?ep=([0-9]+)").find(data)?.groupValues?.get(1).toString()
val title = document.selectFirst("div#list-eps > a")?.text()?.replace(Regex("[\\d]"), "")
?.trim()?.replace("Server", "")?.trim()
document.select("div#list-eps > a:matches(${title}\\s?${ep}$)").mapNotNull {
val iframeLink = "${mainUrl}/iembed/?source=${it.attr("data-iframe")}"
app.get(iframeLink).document.select("iframe")
.attr("src")
}
}
sources.apmap {
safeApiCall {
when {
it.startsWith("http://172.96.161.72") -> invokeLokalSource(
it,
this.name,
subtitleCallback,
callback
)
it.startsWith("https://kotakajair.xyz") -> invokeKotakAjairSource(
it,
subtitleCallback,
callback
)
else -> {
loadExtractor(it, data, callback)
if (it.startsWith("https://sbfull.com")) {
val response = app.get(
it, interceptor = WebViewResolver(
Regex("""\.srt""")
)
)
subtitleCallback.invoke(
SubtitleFile(
"Indonesian",
response.url
)
)
}
}
}
}
}
return true
}
}

View file

@ -139,12 +139,15 @@ val extractorApis: Array<ExtractorApi> = arrayOf(
StreamSB8(),
StreamSB9(),
StreamSB10(),
SBfull(),
// Streamhub(), cause Streamhub2() works
Streamhub2(),
FEmbed(),
FeHD(),
Fplayer(),
DBfilm(),
LayarKaca(),
// WatchSB(), 'cause StreamSB.kt works
Uqload(),
Uqload1(),
@ -183,7 +186,14 @@ val extractorApis: Array<ExtractorApi> = arrayOf(
PlayerVoxzer(),
BullStream(),
GMPlayer()
GMPlayer(),
Blogger(),
Hxfile(),
KotakAnimeid(),
Neonime8n(),
Neonime7n(),
)
fun getExtractorApiFromName(name: String): ExtractorApi {