diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/VidSrcExtractor.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/VidSrcExtractor.kt index a4a1797c..7b087157 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/VidSrcExtractor.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/VidSrcExtractor.kt @@ -8,9 +8,23 @@ import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.M3u8Helper import com.lagradost.cloudstream3.utils.loadExtractor -class VidSrcExtractor : ExtractorApi() { +class VidSrcExtractor2 : VidSrcExtractor() { + override val mainUrl = "https://vidsrc.me/embed" + override suspend fun getUrl( + url: String, + referer: String?, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ) { + val newUrl = url.lowercase().replace(mainUrl, super.mainUrl) + super.getUrl(newUrl, referer, subtitleCallback, callback) + } +} + +open class VidSrcExtractor : ExtractorApi() { override val name = "VidSrc" - override val mainUrl = "https://v2.vidsrc.me" + private val absoluteUrl = "https://v2.vidsrc.me" + override val mainUrl = "$absoluteUrl/embed" override val requiresReferer = false override suspend fun getUrl( @@ -26,7 +40,7 @@ class VidSrcExtractor : ExtractorApi() { val datahash = it.attr("data-hash") if (datahash.isNotBlank()) { val links = try { - app.get("$mainUrl/src/$datahash", referer = "https://source.vidsrc.me/").url + app.get("$absoluteUrl/src/$datahash", referer = "https://source.vidsrc.me/").url } catch (e: Exception) { "" } @@ -37,13 +51,13 @@ class VidSrcExtractor : ExtractorApi() { serverslist.apmap { server -> val linkfixed = server.replace("https://vidsrc.xyz/", "https://embedsito.com/") if (linkfixed.contains("/pro")) { - val srcresponse = app.get(server, referer = mainUrl).text + val srcresponse = app.get(server, referer = absoluteUrl).text val m3u8Regex = Regex("((https:|http:)//.*\\.m3u8)") val srcm3u8 = m3u8Regex.find(srcresponse)?.value ?: return@apmap M3u8Helper.generateM3u8( name, srcm3u8, - mainUrl + absoluteUrl ).forEach(callback) } else { loadExtractor(linkfixed, url, subtitleCallback, callback) diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/HDMovie5.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/HDMovie5.kt index f8e1e368..68d91f47 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/HDMovie5.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/HDMovie5.kt @@ -8,7 +8,7 @@ import com.lagradost.cloudstream3.utils.loadExtractor import org.jsoup.Jsoup class HDMovie5 : MainAPI() { - override var mainUrl = "https://Hdmovie2.art" + override var mainUrl = "https://hdmovie2.art" override var name = "HDMovie" override var lang = "hi" diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/VidSrcProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/VidSrcProvider.kt index 25e83df2..d7223f9f 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/VidSrcProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/VidSrcProvider.kt @@ -44,7 +44,7 @@ class VidSrcProvider : TmdbProvider() { "$mainUrl/embed/$suffix" } - extractor.getSafeUrl(embedUrl)?.forEach(callback) ?: return false + extractor.getSafeUrl(embedUrl, null, subtitleCallback, callback) return true } 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 0fc81200..9ce3e211 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt @@ -178,11 +178,9 @@ suspend fun loadExtractor( callback: (ExtractorLink) -> Unit ): Boolean { val currentUrl = unshortenLinkSafe(url) - + val compareUrl = currentUrl.lowercase().replace(schemaStripRegex, "") for (extractor in extractorApis) { - if (currentUrl.replace(schemaStripRegex, "") - .startsWith(extractor.mainUrl.replace(schemaStripRegex, "")) - ) { + if (compareUrl.startsWith(extractor.mainUrl.replace(schemaStripRegex, ""))) { extractor.getSafeUrl(currentUrl, referer, subtitleCallback, callback) return true } @@ -314,6 +312,7 @@ val extractorApis: Array = arrayOf( YoutubeShortLinkExtractor(), Streamlare(), VidSrcExtractor(), + VidSrcExtractor2(), ) fun getExtractorApiFromName(name: String): ExtractorApi {