From baac818d5a36e208392ec36eb60254fdefe2eb8a Mon Sep 17 00:00:00 2001 From: shabinder Date: Sat, 10 Jul 2021 12:38:25 +0530 Subject: [PATCH] YT Mp3 Extraction fixes and 128 -> 192 KBPS --- .../common/di/providers/requests/youtubeMp3/Yt1sMp3.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/providers/requests/youtubeMp3/Yt1sMp3.kt b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/providers/requests/youtubeMp3/Yt1sMp3.kt index 3e7feff2..db2b0d21 100644 --- a/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/providers/requests/youtubeMp3/Yt1sMp3.kt +++ b/common/dependency-injection/src/commonMain/kotlin/com/shabinder/common/di/providers/requests/youtubeMp3/Yt1sMp3.kt @@ -22,6 +22,7 @@ import com.shabinder.common.models.event.coroutines.SuspendableEvent import com.shabinder.common.models.event.coroutines.flatMap import com.shabinder.common.models.event.coroutines.map import com.shabinder.common.requireNotNull +import io.github.shabinder.utils.getJsonObject import io.ktor.client.* import io.ktor.client.request.* import io.ktor.client.request.forms.* @@ -62,7 +63,10 @@ interface Yt1sMp3 { ) } - response["kc"].requireNotNull().jsonPrimitive.content + response.getJsonObject("links") + .getJsonObject("mp3") + .getJsonObject("192") + ?.get("k").requireNotNull().jsonPrimitive.content } private suspend fun getConvertedMp3Link(videoID: String, key: String): SuspendableEvent = SuspendableEvent {