From 03bdad96df1948874186f9ae8c50b1039651b9e9 Mon Sep 17 00:00:00 2001 From: hexated Date: Tue, 18 Oct 2022 22:05:35 +0700 Subject: [PATCH] added Moviehab extractor --- .../cloudstream3/extractors/Moviehab.kt | 40 +++++++++++++++++++ .../cloudstream3/utils/ExtractorApi.kt | 1 + 2 files changed, 41 insertions(+) create mode 100644 app/src/main/java/com/lagradost/cloudstream3/extractors/Moviehab.kt diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/Moviehab.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/Moviehab.kt new file mode 100644 index 00000000..e2eb7bf0 --- /dev/null +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/Moviehab.kt @@ -0,0 +1,40 @@ +package com.lagradost.cloudstream3.extractors + +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.M3u8Helper + +class Moviehab : ExtractorApi() { + override var name = "Moviehab" + override var mainUrl = "https://play.moviehab.com" + override val requiresReferer = false + + override suspend fun getUrl( + url: String, + referer: String?, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ) { + val res = app.get(url) + res.document.select("video#player").let { + //should redirect first for making it works + val link = app.get("$mainUrl/${it.select("source").attr("src")}", referer = url).url + M3u8Helper.generateM3u8( + this.name, + link, + url + ).forEach(callback) + + Regex("src[\"|'],\\s[\"|'](\\S+)[\"|']\\)").find(res.text)?.groupValues?.get(1).let {sub -> + subtitleCallback.invoke( + SubtitleFile( + it.select("track").attr("label"), + "$mainUrl/$sub" + ) + ) + } + } + } +} \ No newline at end of file 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 159484f8..499b5177 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt @@ -326,6 +326,7 @@ val extractorApis: MutableList = arrayListOf( Vidmoly(), Vidmolyme(), Voe(), + Moviehab(), Gdriveplayerapi(), Gdriveplayerapp(),