added Mediafire (#906)

This commit is contained in:
Sofie 2024-01-21 21:35:33 +07:00 committed by GitHub
parent 01f21e0fe8
commit 8b14fcb881
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 46 additions and 1 deletions

View File

@ -230,7 +230,7 @@ dependencies {
// Downloading & Networking
implementation("androidx.work:work-runtime:2.8.1")
implementation("androidx.work:work-runtime-ktx:2.8.1")
implementation("com.github.Blatzar:NiceHttp:0.4.4") // HTTP Lib
implementation("com.github.Blatzar:NiceHttp:0.4.5") // HTTP Lib
}
tasks.register("androidSourcesJar", Jar::class) {

View File

@ -0,0 +1,43 @@
package com.lagradost.cloudstream3.extractors
import com.lagradost.cloudstream3.SubtitleFile
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.INFER_TYPE
import com.lagradost.cloudstream3.utils.Qualities
open class Mediafire : ExtractorApi() {
override val name = "Mediafire"
override val mainUrl = "https://www.mediafire.com"
override val requiresReferer = true
override suspend fun getUrl(
url: String,
referer: String?,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val res = app.get(url, referer = referer).document
val title = res.select("div.dl-btn-label").text()
val video = res.selectFirst("a#downloadButton")?.attr("href")
callback.invoke(
ExtractorLink(
this.name,
this.name,
video ?: return,
"",
getQuality(title),
INFER_TYPE
)
)
}
private fun getQuality(str: String?): Int {
return Regex("(\\d{3,4})[pP]").find(str ?: "")?.groupValues?.getOrNull(1)?.toIntOrNull()
?: Qualities.Unknown.value
}
}

View File

@ -116,6 +116,7 @@ import com.lagradost.cloudstream3.extractors.TRsTX
import com.lagradost.cloudstream3.extractors.VidMoxy
import com.lagradost.cloudstream3.extractors.PixelDrain
import com.lagradost.cloudstream3.extractors.MailRu
import com.lagradost.cloudstream3.extractors.Mediafire
import com.lagradost.cloudstream3.extractors.OkRuSSL
import com.lagradost.cloudstream3.extractors.OkRuHTTP
import com.lagradost.cloudstream3.extractors.Okrulink
@ -835,6 +836,7 @@ val extractorApis: MutableList<ExtractorApi> = arrayListOf(
Gdriveplayer(),
DatabaseGdrive(),
DatabaseGdrive2(),
Mediafire(),
YoutubeExtractor(),
YoutubeShortLinkExtractor(),