From 785eda47c27a7b1971665bb9759ac5137c0b4493 Mon Sep 17 00:00:00 2001 From: sora Date: Thu, 20 Jul 2023 11:56:56 +0700 Subject: [PATCH] Yomovies: added new source --- YomoviesProvider/build.gradle.kts | 2 +- .../src/main/kotlin/com/hexated/Extractors.kt | 37 +++++++++++++++++++ .../main/kotlin/com/hexated/Watchomovies.kt | 23 ++++++++++++ .../kotlin/com/hexated/YomoviesProvider.kt | 37 ++++++++----------- .../com/hexated/YomoviesProviderPlugin.kt | 2 + 5 files changed, 79 insertions(+), 22 deletions(-) create mode 100644 YomoviesProvider/src/main/kotlin/com/hexated/Extractors.kt create mode 100644 YomoviesProvider/src/main/kotlin/com/hexated/Watchomovies.kt diff --git a/YomoviesProvider/build.gradle.kts b/YomoviesProvider/build.gradle.kts index 8b53037f..42b439cd 100644 --- a/YomoviesProvider/build.gradle.kts +++ b/YomoviesProvider/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 15 +version = 16 cloudstream { diff --git a/YomoviesProvider/src/main/kotlin/com/hexated/Extractors.kt b/YomoviesProvider/src/main/kotlin/com/hexated/Extractors.kt new file mode 100644 index 00000000..08597bf1 --- /dev/null +++ b/YomoviesProvider/src/main/kotlin/com/hexated/Extractors.kt @@ -0,0 +1,37 @@ +package com.hexated + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.SubtitleFile +import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.extractors.SpeedoStream +import com.lagradost.cloudstream3.utils.AppUtils +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.M3u8Helper +import com.lagradost.cloudstream3.utils.getAndUnpack + +class Streamoupload : SpeedoStream() { + override val mainUrl = "https://streamoupload.xyz" + override val name = "Streamoupload" + + override suspend fun getUrl( + url: String, + referer: String?, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ) { + val script = getAndUnpack(app.get(url, referer = referer).text) + val data = script.substringAfter("sources:[") + .substringBefore("],").replace("file", "\"file\"").trim() + AppUtils.tryParseJson(data)?.let { + M3u8Helper.generateM3u8( + name, + it.file, + "$mainUrl/", + ).forEach(callback) + } + } + + private data class File( + @JsonProperty("file") val file: String, + ) +} \ No newline at end of file diff --git a/YomoviesProvider/src/main/kotlin/com/hexated/Watchomovies.kt b/YomoviesProvider/src/main/kotlin/com/hexated/Watchomovies.kt new file mode 100644 index 00000000..9ed5ad2d --- /dev/null +++ b/YomoviesProvider/src/main/kotlin/com/hexated/Watchomovies.kt @@ -0,0 +1,23 @@ +package com.hexated + +import com.lagradost.cloudstream3.TvType +import com.lagradost.cloudstream3.mainPageOf + +class Watchomovies : YomoviesProvider() { + override var mainUrl = "https://watchomovies.mom" + override var name = "Watchomovies" + override val hasMainPage = true + override var lang = "hi" + override val supportedTypes = setOf( + TvType.NSFW, + ) + + override val mainPage = mainPageOf( + "most-favorites" to "Most Viewed", + "genre/xxx-scenes" to "XXX Scenes", + "genre/18" to "18+ Movies", + "genre/erotic-movies" to "Erotic Movies Movies", + "genre/parody" to "Parody Movies", + "genre/tv-shows" to "TV Shows Movies", + ) +} \ No newline at end of file diff --git a/YomoviesProvider/src/main/kotlin/com/hexated/YomoviesProvider.kt b/YomoviesProvider/src/main/kotlin/com/hexated/YomoviesProvider.kt index ac5e991f..1b2bd2a0 100644 --- a/YomoviesProvider/src/main/kotlin/com/hexated/YomoviesProvider.kt +++ b/YomoviesProvider/src/main/kotlin/com/hexated/YomoviesProvider.kt @@ -9,37 +9,32 @@ import com.lagradost.cloudstream3.utils.loadExtractor import org.jsoup.nodes.Element import java.net.URI -class YomoviesProvider : MainAPI() { +open class YomoviesProvider : MainAPI() { override var mainUrl = "https://yomovies.baby" - private var directUrl = mainUrl + private var directUrl = "" override var name = "Yomovies" override val hasMainPage = true override var lang = "hi" - override val hasDownloadSupport = true override val supportedTypes = setOf( TvType.Movie, TvType.TvSeries, ) override val mainPage = mainPageOf( - "$mainUrl/most-favorites/page/" to "Most Viewed", - "$mainUrl/genre/web-series/page/" to "Web Series Movies", - "$mainUrl/genre/dual-audio/page/" to "Dual Audio Movies", - "$mainUrl/genre/bollywood/page/" to "Bollywood Movies", - "$mainUrl/genre/tv-shows/page/" to "TV Shows Movies", - "$mainUrl/genre/hollywood/page/" to "Hollywood Movies", - "$mainUrl/series/page/" to "All TV Series", + "most-favorites" to "Most Viewed", + "genre/web-series" to "Web Series Movies", + "genre/dual-audio" to "Dual Audio Movies", + "genre/bollywood" to "Bollywood Movies", + "genre/tv-shows" to "TV Shows Movies", + "genre/hollywood" to "Hollywood Movies", + "series" to "All TV Series", ) override suspend fun getMainPage( page: Int, request: MainPageRequest ): HomePageResponse { - val document = if (page == 1) { - app.get(request.data.removeSuffix("page/")).document - } else { - app.get(request.data + page).document - } + val document = app.get("$mainUrl/${request.data}/page/$page").document val home = document.select("div.ml-item").mapNotNull { it.toSearchResult() } @@ -129,12 +124,6 @@ class YomoviesProvider : MainAPI() { } } - private fun getBaseUrl(url: String): String { - return URI(url).let { - "${it.scheme}://${it.host}" - } - } - override suspend fun loadLinks( data: String, isCasting: Boolean, @@ -175,4 +164,10 @@ class YomoviesProvider : MainAPI() { return fixTitle(URI(this).host.substringBeforeLast(".").substringAfterLast(".")) } + private fun getBaseUrl(url: String): String { + return URI(url).let { + "${it.scheme}://${it.host}" + } + } + } diff --git a/YomoviesProvider/src/main/kotlin/com/hexated/YomoviesProviderPlugin.kt b/YomoviesProvider/src/main/kotlin/com/hexated/YomoviesProviderPlugin.kt index 72cbcd16..60bb8004 100644 --- a/YomoviesProvider/src/main/kotlin/com/hexated/YomoviesProviderPlugin.kt +++ b/YomoviesProvider/src/main/kotlin/com/hexated/YomoviesProviderPlugin.kt @@ -10,5 +10,7 @@ class YomoviesProviderPlugin: Plugin() { override fun load(context: Context) { // All providers should be added in this manner. Please don't edit the providers list directly. registerMainAPI(YomoviesProvider()) + registerMainAPI(Watchomovies()) + registerExtractorAPI(Streamoupload()) } } \ No newline at end of file