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

View file

@ -10,12 +10,18 @@ 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
val response = app.get(realUrl)
val unpackedText = getAndUnpack(response.text)
val quality =
unpackedText.lowercase().substringAfter(" height=").substringBefore(" ").toIntOrNull()
srcRegex.find(unpackedText)?.groupValues?.get(1)?.let { link -> srcRegex.find(unpackedText)?.groupValues?.get(1)?.let { link ->
return listOf( return listOf(
ExtractorLink( ExtractorLink(
@ -27,7 +33,16 @@ open class Mp4Upload : ExtractorApi() {
) )
) )
} }
} srcRegex2.find(unpackedText)?.groupValues?.get(1)?.let { link ->
return listOf(
ExtractorLink(
name,
name,
link,
url,
quality ?: Qualities.Unknown.value,
)
)
} }
return null return null
} }