From f0515c4dc9e38bcf80f9766e7dff9f9ffd802f72 Mon Sep 17 00:00:00 2001 From: Stormunblessed <86633626+Stormunblessed@users.noreply.github.com> Date: Fri, 3 Mar 2023 09:24:02 +0000 Subject: [PATCH] Support qualities for Dailymotion (#407) * Dailymotion qualities --- .../cloudstream3/extractors/Dailymotion.kt | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/Dailymotion.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/Dailymotion.kt index 125e4bcf..4b7cb19f 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/Dailymotion.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/Dailymotion.kt @@ -6,6 +6,7 @@ import com.lagradost.cloudstream3.app import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson import com.lagradost.cloudstream3.utils.ExtractorApi import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.M3u8Helper.Companion.generateM3u8 import com.lagradost.cloudstream3.utils.Qualities import java.net.URL @@ -42,18 +43,9 @@ open class Dailymotion : ExtractorApi() { ) val metaData = app.get(metaDataUrl, referer = embedUrl, cookies = cookies) .parsedSafe() ?: return - metaData.qualities.forEach { (key, video) -> + metaData.qualities.forEach { (_, video) -> video.forEach { - callback.invoke( - ExtractorLink( - name, - "$name $key", - it.url, - "", - Qualities.Unknown.value, - true - ) - ) + getStream(it.url, this.name, callback) } } } @@ -75,6 +67,17 @@ open class Dailymotion : ExtractorApi() { return null } + private suspend fun getStream( + streamLink: String, + name: String, + callback: (ExtractorLink) -> Unit + ) { + return generateM3u8( + name, + streamLink, + "", + ).forEach(callback) + } data class Config( val context: Context, val dmInternalData: InternalData