From 92475c077b91578d484a8c0b4b108ca7ea77b12d Mon Sep 17 00:00:00 2001 From: sora Date: Wed, 9 Aug 2023 23:30:29 +0700 Subject: [PATCH] added ZippyShare --- Nekopoi/build.gradle.kts | 2 +- .../src/main/kotlin/com/hexated/Extractors.kt | 32 +++++++++++++++++++ .../src/main/kotlin/com/hexated/Nekopoi.kt | 19 +++++------ .../main/kotlin/com/hexated/NekopoiPlugin.kt | 1 + .../src/main/kotlin/com/hexated/SoraStream.kt | 2 -- 5 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 Nekopoi/src/main/kotlin/com/hexated/Extractors.kt diff --git a/Nekopoi/build.gradle.kts b/Nekopoi/build.gradle.kts index a8c9601a..1d430492 100644 --- a/Nekopoi/build.gradle.kts +++ b/Nekopoi/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 3 +version = 4 cloudstream { diff --git a/Nekopoi/src/main/kotlin/com/hexated/Extractors.kt b/Nekopoi/src/main/kotlin/com/hexated/Extractors.kt new file mode 100644 index 00000000..47e90c61 --- /dev/null +++ b/Nekopoi/src/main/kotlin/com/hexated/Extractors.kt @@ -0,0 +1,32 @@ +package com.hexated + +import com.lagradost.cloudstream3.SubtitleFile +import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.utils.ExtractorApi +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.Qualities + +open class ZippyShare : ExtractorApi() { + override val name = "ZippyShare" + override val mainUrl = "https://zippysha.re" + override val requiresReferer = true + + override suspend fun getUrl( + url: String, + referer: String?, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ) { + val res = app.get(url, referer = referer).document + val video = res.selectFirst("a#download-url")?.attr("href") + callback.invoke( + ExtractorLink( + this.name, + this.name, + video ?: return, + "$mainUrl/", + Qualities.Unknown.value + ) + ) + } +} \ No newline at end of file diff --git a/Nekopoi/src/main/kotlin/com/hexated/Nekopoi.kt b/Nekopoi/src/main/kotlin/com/hexated/Nekopoi.kt index 27ecc2e8..f4721169 100644 --- a/Nekopoi/src/main/kotlin/com/hexated/Nekopoi.kt +++ b/Nekopoi/src/main/kotlin/com/hexated/Nekopoi.kt @@ -4,6 +4,7 @@ import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.utils.* import com.lagradost.nicehttp.Requests import com.lagradost.nicehttp.Session +import kotlinx.coroutines.delay import org.jsoup.nodes.Element import java.net.URI @@ -24,7 +25,6 @@ class Nekopoi : MainAPI() { "DropApk", "Racaty", "ZippyShare", - "ZippySha", "VideobinCo", "DropApk", "SendCm", @@ -227,16 +227,15 @@ class Nekopoi : MainAPI() { } private suspend fun bypassMirrored(url: String?): List { - val request = app.get(url ?: return emptyList()) - var nextUrl = request.document.selectFirst("div.row div.centered a")?.attr("href") - nextUrl = app.get(nextUrl ?: return emptyList()).text.substringAfter("\"GET\", \"") - .substringBefore("\"") - return app.get(fixUrl(nextUrl, mirroredHost)).document.select("table.hoverable tbody tr") + val request = session.get(url ?: return emptyList()) + delay(2000) + val nextUrl = request.text.substringAfter("\"GET\", \"").substringBefore("\"") + return session.get(fixUrl(nextUrl, mirroredHost)).document.select("table.hoverable tbody tr") .filter { mirror -> !mirrorIsBlackList(mirror.selectFirst("img")?.attr("alt")) }.apmap { val fileLink = it.selectFirst("a")?.attr("href") - app.get( + session.get( fixUrl( fileLink ?: return@apmap null, mirroredHost @@ -269,8 +268,10 @@ class Nekopoi : MainAPI() { } private fun getIndexQuality(str: String?): Int { - return Regex("(\\d{3,4})[pP]").find(str ?: "")?.groupValues?.getOrNull(1)?.toIntOrNull() - ?: Qualities.Unknown.value + return when (val quality = Regex("""(?i)\[(\d+[pk])]""").find(str ?: "")?.groupValues?.getOrNull(1)?.lowercase()) { + "2k" -> Qualities.P1440.value + else -> getQualityFromName(quality) + } } } \ No newline at end of file diff --git a/Nekopoi/src/main/kotlin/com/hexated/NekopoiPlugin.kt b/Nekopoi/src/main/kotlin/com/hexated/NekopoiPlugin.kt index a6fe53a3..62dea5a4 100644 --- a/Nekopoi/src/main/kotlin/com/hexated/NekopoiPlugin.kt +++ b/Nekopoi/src/main/kotlin/com/hexated/NekopoiPlugin.kt @@ -9,5 +9,6 @@ class NekopoiPlugin: Plugin() { override fun load(context: Context) { // All providers should be added in this manner. Please don't edit the providers list directly. registerMainAPI(Nekopoi()) + registerExtractorAPI(ZippyShare()) } } \ No newline at end of file diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt index 88efd8de..e52f5b61 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt @@ -11,7 +11,6 @@ import com.hexated.SoraExtractor.invokeHDMovieBox import com.hexated.SoraExtractor.invokeIdlix import com.hexated.SoraExtractor.invokeKimcartoon import com.hexated.SoraExtractor.invokeMovieHab -import com.hexated.SoraExtractor.invokeNoverse import com.hexated.SoraExtractor.invokeSeries9 import com.hexated.SoraExtractor.invokeVidSrc import com.lagradost.cloudstream3.* @@ -25,7 +24,6 @@ import com.hexated.SoraExtractor.invokeFlixon import com.hexated.SoraExtractor.invokeFmovies import com.hexated.SoraExtractor.invokeFwatayako import com.hexated.SoraExtractor.invokeGMovies -import com.hexated.SoraExtractor.invokeGdbotMovies import com.hexated.SoraExtractor.invokeGoku import com.hexated.SoraExtractor.invokeGomovies import com.hexated.SoraExtractor.invokeKisskh