This commit is contained in:
LagradOst 2023-08-19 01:37:48 +02:00
parent 56cb3d7181
commit a05616e3e8

View file

@ -10,24 +10,39 @@ open class Mp4Upload : ExtractorApi() {
override var name = "Mp4Upload" override var name = "Mp4Upload"
override var mainUrl = "https://www.mp4upload.com" override var mainUrl = "https://www.mp4upload.com"
private val srcRegex = Regex("""player\.src\("(.*?)"""") private val srcRegex = Regex("""player\.src\("(.*?)"""")
override val requiresReferer = true private val srcRegex2 = Regex("""player\.src\([\w\W]*src: "(.*?)"""")
override val requiresReferer = true
private val idMatch = Regex("""mp4upload\.com/(embed-|)([A-Za-z0-9]*)""")
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? { override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
with(app.get(url)) { val realUrl = idMatch.find(url)?.groupValues?.get(2)?.let { id ->
getAndUnpack(this.text).let { unpackedText -> "$mainUrl/embed-$id.html"
val quality = unpackedText.lowercase().substringAfter(" height=").substringBefore(" ").toIntOrNull() } ?: url
srcRegex.find(unpackedText)?.groupValues?.get(1)?.let { link -> val response = app.get(realUrl)
return listOf( val unpackedText = getAndUnpack(response.text)
ExtractorLink( val quality =
name, unpackedText.lowercase().substringAfter(" height=").substringBefore(" ").toIntOrNull()
name, srcRegex.find(unpackedText)?.groupValues?.get(1)?.let { link ->
link, return listOf(
url, ExtractorLink(
quality ?: Qualities.Unknown.value, name,
) name,
) link,
} url,
} quality ?: Qualities.Unknown.value,
)
)
}
srcRegex2.find(unpackedText)?.groupValues?.get(1)?.let { link ->
return listOf(
ExtractorLink(
name,
name,
link,
url,
quality ?: Qualities.Unknown.value,
)
)
} }
return null return null
} }