From 167609448892308d51038e9b6a9c6dd38ada22c5 Mon Sep 17 00:00:00 2001 From: coxju <118901131+coxju@users.noreply.github.com> Date: Thu, 18 Jan 2024 03:02:22 +0530 Subject: [PATCH] feat (loadExtractor) : match mirror domains of extractor link (#877) Co-authored-by: coxju --- .../lagradost/cloudstream3/utils/ExtractorApi.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 48a8cdab..59417f4d 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt @@ -216,6 +216,7 @@ import com.lagradost.cloudstream3.extractors.Ztreamhub import com.lagradost.cloudstream3.mvvm.logError import com.lagradost.cloudstream3.mvvm.normalSafeApiCall import kotlinx.coroutines.delay +import me.xdrop.fuzzywuzzy.FuzzySearch import org.jsoup.Jsoup import java.net.URL import java.util.UUID @@ -600,6 +601,18 @@ suspend fun loadExtractor( } } + // this is to match mirror domains - like example.com, example.net + for (extractor in extractorApis) { + if (FuzzySearch.partialRatio( + extractor.mainUrl, + currentUrl + ) > 80 + ) { + extractor.getSafeUrl(currentUrl, referer, subtitleCallback, callback) + return true + } + } + return false }