fixed extractor bug

This commit is contained in:
LagradOst 2022-07-27 19:54:53 +02:00
parent 6027beb078
commit 31ee495bc1
4 changed files with 24 additions and 11 deletions

View file

@ -8,9 +8,23 @@ import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.M3u8Helper import com.lagradost.cloudstream3.utils.M3u8Helper
import com.lagradost.cloudstream3.utils.loadExtractor 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 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 val requiresReferer = false
override suspend fun getUrl( override suspend fun getUrl(
@ -26,7 +40,7 @@ class VidSrcExtractor : ExtractorApi() {
val datahash = it.attr("data-hash") val datahash = it.attr("data-hash")
if (datahash.isNotBlank()) { if (datahash.isNotBlank()) {
val links = try { 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) { } catch (e: Exception) {
"" ""
} }
@ -37,13 +51,13 @@ class VidSrcExtractor : ExtractorApi() {
serverslist.apmap { server -> serverslist.apmap { server ->
val linkfixed = server.replace("https://vidsrc.xyz/", "https://embedsito.com/") val linkfixed = server.replace("https://vidsrc.xyz/", "https://embedsito.com/")
if (linkfixed.contains("/pro")) { 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 m3u8Regex = Regex("((https:|http:)//.*\\.m3u8)")
val srcm3u8 = m3u8Regex.find(srcresponse)?.value ?: return@apmap val srcm3u8 = m3u8Regex.find(srcresponse)?.value ?: return@apmap
M3u8Helper.generateM3u8( M3u8Helper.generateM3u8(
name, name,
srcm3u8, srcm3u8,
mainUrl absoluteUrl
).forEach(callback) ).forEach(callback)
} else { } else {
loadExtractor(linkfixed, url, subtitleCallback, callback) loadExtractor(linkfixed, url, subtitleCallback, callback)

View file

@ -8,7 +8,7 @@ import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.Jsoup import org.jsoup.Jsoup
class HDMovie5 : MainAPI() { class HDMovie5 : MainAPI() {
override var mainUrl = "https://Hdmovie2.art" override var mainUrl = "https://hdmovie2.art"
override var name = "HDMovie" override var name = "HDMovie"
override var lang = "hi" override var lang = "hi"

View file

@ -44,7 +44,7 @@ class VidSrcProvider : TmdbProvider() {
"$mainUrl/embed/$suffix" "$mainUrl/embed/$suffix"
} }
extractor.getSafeUrl(embedUrl)?.forEach(callback) ?: return false extractor.getSafeUrl(embedUrl, null, subtitleCallback, callback)
return true return true
} }

View file

@ -178,11 +178,9 @@ suspend fun loadExtractor(
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
): Boolean { ): Boolean {
val currentUrl = unshortenLinkSafe(url) val currentUrl = unshortenLinkSafe(url)
val compareUrl = currentUrl.lowercase().replace(schemaStripRegex, "")
for (extractor in extractorApis) { for (extractor in extractorApis) {
if (currentUrl.replace(schemaStripRegex, "") if (compareUrl.startsWith(extractor.mainUrl.replace(schemaStripRegex, ""))) {
.startsWith(extractor.mainUrl.replace(schemaStripRegex, ""))
) {
extractor.getSafeUrl(currentUrl, referer, subtitleCallback, callback) extractor.getSafeUrl(currentUrl, referer, subtitleCallback, callback)
return true return true
} }
@ -314,6 +312,7 @@ val extractorApis: Array<ExtractorApi> = arrayOf(
YoutubeShortLinkExtractor(), YoutubeShortLinkExtractor(),
Streamlare(), Streamlare(),
VidSrcExtractor(), VidSrcExtractor(),
VidSrcExtractor2(),
) )
fun getExtractorApiFromName(name: String): ExtractorApi { fun getExtractorApiFromName(name: String): ExtractorApi {