From 509a240e5a513a738a623e5fd84f3d4eba947b1a Mon Sep 17 00:00:00 2001 From: Hexated <37908684+hexated@users.noreply.github.com> Date: Fri, 27 May 2022 06:35:37 +0700 Subject: [PATCH] fix layarkaca/gomunime/kuronime (#1092) --- .../com/lagradost/cloudstream3/MainAPI.kt | 2 +- .../animeproviders/GomunimeProvider.kt | 12 +---- .../animeproviders/KuronimeProvider.kt | 8 ++-- .../animeproviders/NeonimeProvider.kt | 3 +- .../cloudstream3/extractors/DoodExtractor.kt | 4 +- .../cloudstream3/extractors/Solidfiles.kt | 45 +++++++++++++++++++ .../movieproviders/LayarKaca21Provider.kt | 9 ++-- .../movieproviders/RebahinProvider.kt | 24 +++++++--- .../cloudstream3/utils/ExtractorApi.kt | 1 + 9 files changed, 81 insertions(+), 27 deletions(-) create mode 100644 app/src/main/java/com/lagradost/cloudstream3/extractors/Solidfiles.kt diff --git a/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt b/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt index f0360387..57c29dc4 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt @@ -89,7 +89,7 @@ object APIHolder { TantifilmProvider(), HDMovie5(), RebahinProvider(), - LayarKaca21Provider(), + LayarKacaProvider(), // Metadata providers //TmdbProvider(), diff --git a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/GomunimeProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/GomunimeProvider.kt index d5f2706f..1287ae6f 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/GomunimeProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/GomunimeProvider.kt @@ -3,20 +3,11 @@ package com.lagradost.cloudstream3.animeproviders import com.fasterxml.jackson.annotation.JsonProperty import com.lagradost.cloudstream3.* import org.jsoup.Jsoup -import org.jsoup.nodes.Element import java.util.* -import com.fasterxml.jackson.module.kotlin.readValue -import com.lagradost.cloudstream3.movieproviders.SflixProvider -import com.lagradost.cloudstream3.movieproviders.SflixProvider.Companion.extractRabbitStream -import com.lagradost.cloudstream3.movieproviders.SflixProvider.Companion.toExtractorLink import com.lagradost.cloudstream3.mvvm.logError import com.lagradost.cloudstream3.mvvm.safeApiCall import com.lagradost.cloudstream3.utils.* import com.lagradost.cloudstream3.utils.AppUtils.parseJson -import com.lagradost.nicehttp.Requests.Companion.await -import kotlinx.coroutines.runBlocking -import okhttp3.Interceptor -import java.net.URI class GomunimeProvider : MainAPI() { override var mainUrl = "https://185.231.223.76" @@ -210,7 +201,8 @@ class GomunimeProvider : MainAPI() { M3u8Helper.generateM3u8( this.name, link, - mainUrl, + "$mainUrl/", + headers = mapOf("Origin" to mainUrl) ).forEach(callback) } } diff --git a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/KuronimeProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/KuronimeProvider.kt index 8af7e501..14e841fc 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/KuronimeProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/KuronimeProvider.kt @@ -1,6 +1,5 @@ package com.lagradost.cloudstream3.animeproviders -import com.fasterxml.jackson.annotation.JsonProperty import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer import com.lagradost.cloudstream3.mvvm.safeApiCall @@ -157,6 +156,8 @@ class KuronimeProvider : MainAPI() { val token = data.substringAfter("var token = \"").substringBefore("\";") val pat = data.substringAfter("var pat = \"").substringBefore("\";") val link = "$doma$token$pat/index.m3u8" + val quality = + Regex("\\d{3,4}p").find(doc.select("title").text())?.groupValues?.get(0) sourceCallback.invoke( ExtractorLink( @@ -164,7 +165,8 @@ class KuronimeProvider : MainAPI() { this.name, link, referer = "https://animeku.org/", - quality = Qualities.Unknown.value, + quality = getQualityFromName(quality), + headers = mapOf("Origin" to "https://animeku.org"), isM3u8 = true ) ) @@ -186,7 +188,7 @@ class KuronimeProvider : MainAPI() { sources.apmap { safeApiCall { when { - it.contains("animeku.org") -> invokeKuroSource(it, callback) + it.startsWith("https://animeku.org") -> invokeKuroSource(it, callback) else -> loadExtractor(it, mainUrl, callback) } } diff --git a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/NeonimeProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/NeonimeProvider.kt index 2e3cceab..d844e043 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/NeonimeProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/NeonimeProvider.kt @@ -1,8 +1,6 @@ package com.lagradost.cloudstream3.animeproviders -import com.fasterxml.jackson.annotation.JsonProperty import com.lagradost.cloudstream3.* -import com.lagradost.cloudstream3.mvvm.safeApiCall import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.loadExtractor import org.jsoup.nodes.Element @@ -33,6 +31,7 @@ class NeonimeProvider : MainAPI() { return when (t) { "Ended" -> ShowStatus.Completed "OnGoing" -> ShowStatus.Ongoing + "Ongoing" -> ShowStatus.Ongoing "In Production" -> ShowStatus.Ongoing "Returning Series" -> ShowStatus.Ongoing else -> ShowStatus.Completed diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/DoodExtractor.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/DoodExtractor.kt index 71a11d60..3be8f510 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/DoodExtractor.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/DoodExtractor.kt @@ -4,6 +4,7 @@ import com.lagradost.cloudstream3.app import com.lagradost.cloudstream3.utils.ExtractorApi import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.Qualities +import com.lagradost.cloudstream3.utils.getQualityFromName import kotlinx.coroutines.delay class DoodCxExtractor : DoodLaExtractor() { @@ -40,13 +41,14 @@ open class DoodLaExtractor : ExtractorApi() { val response0 = app.get(url).text // html of DoodStream page to look for /pass_md5/... val md5 =mainUrl+(Regex("/pass_md5/[^']*").find(response0)?.value ?: return null) // get https://dood.ws/pass_md5/... val trueUrl = app.get(md5, referer = url).text + "zUEJeL3mUN?token=" + md5.substringAfterLast("/") //direct link to extract (zUEJeL3mUN is random) + val quality = Regex("\\d{3,4}p").find(response0.substringAfter("").substringBefore(""))?.groupValues?.get(0) return listOf( ExtractorLink( trueUrl, this.name, trueUrl, mainUrl, - Qualities.Unknown.value, + getQualityFromName(quality), false ) ) // links are valid in 8h diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/Solidfiles.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/Solidfiles.kt new file mode 100644 index 00000000..849f5fc8 --- /dev/null +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/Solidfiles.kt @@ -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.AppUtils.tryParseJson +import com.lagradost.cloudstream3.utils.ExtractorApi +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.getQualityFromName + + +class Solidfiles : ExtractorApi() { + override val name = "Solidfiles" + override val mainUrl = "https://www.solidfiles.com" + override val requiresReferer = false + + override suspend fun getUrl(url: String, referer: String?): List { + val sources = mutableListOf() + with(app.get(url).document) { + this.select("script").map { script -> + if (script.data().contains("\"streamUrl\":")) { + val data = script.data().substringAfter("constant('viewerOptions', {").substringBefore("});") + val source = tryParseJson("{$data}") + val quality = Regex("\\d{3,4}p").find(source!!.nodeName)?.groupValues?.get(0) + sources.add( + ExtractorLink( + name, + name, + source.streamUrl, + referer = url, + quality = getQualityFromName(quality) + ) + ) + } + } + } + return sources + } + + + private data class ResponseSource( + @JsonProperty("streamUrl") val streamUrl: String, + @JsonProperty("nodeName") val nodeName: String + ) + +} \ No newline at end of file diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/LayarKaca21Provider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/LayarKaca21Provider.kt index eb98eee8..e8f78b28 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/LayarKaca21Provider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/LayarKaca21Provider.kt @@ -1,23 +1,22 @@ 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" +class LayarKacaProvider : MainAPI() { + override var mainUrl = "https://149.56.24.226" + override var name = "LayarKaca" override val hasMainPage = true override val lang = "id" override val hasDownloadSupport = true override val supportedTypes = setOf( TvType.Movie, TvType.TvSeries, + TvType.AsianDrama ) override suspend fun getMainPage(): HomePageResponse { diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/RebahinProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/RebahinProvider.kt index 52927a94..789d6684 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/RebahinProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/RebahinProvider.kt @@ -20,6 +20,8 @@ class RebahinProvider : MainAPI() { override val supportedTypes = setOf( TvType.Movie, TvType.TvSeries, + TvType.Anime, + TvType.AsianDrama ) override suspend fun getMainPage(): HomePageResponse { @@ -168,6 +170,7 @@ class RebahinProvider : MainAPI() { private suspend fun invokeLokalSource( url: String, name: String, + ref: String, subCallback: (SubtitleFile) -> Unit, sourceCallback: (ExtractorLink) -> Unit ) { @@ -182,11 +185,21 @@ class RebahinProvider : MainAPI() { if (script.data().contains("sources: [")) { val source = tryParseJson( script.data().substringAfter("sources: [").substringBefore("],")) - M3u8Helper.generateM3u8( - name, - source!!.file, - "http://172.96.161.72", - ).forEach(sourceCallback) + val m3uData = app.get(source!!.file, referer = ref).text + val quality = Regex("\\d{3,4}\\.m3u8").findAll(m3uData).map { it.value }.toList() + + quality.forEach { + sourceCallback.invoke( + ExtractorLink( + source = name, + name = name, + url = source.file.replace("video.m3u8", it), + referer = ref, + quality = getQualityFromName("${it.replace(".m3u8", "")}p"), + isM3u8 = true + ) + ) + } val trackJson = script.data().substringAfter("tracks: [").substringBefore("],") val track = tryParseJson>("[$trackJson]") @@ -291,6 +304,7 @@ class RebahinProvider : MainAPI() { it.startsWith("http://172.96.161.72") -> invokeLokalSource( it, this.name, + "http://172.96.161.72/", subtitleCallback, callback ) diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt index 44b9fe69..9bbd3fd8 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt @@ -190,6 +190,7 @@ val extractorApis: Array = arrayOf( GMPlayer(), Blogger(), + Solidfiles(), Hxfile(), KotakAnimeid(),