diff --git a/kugou/src/main/kotlin/it/vfsfitvnm/kugou/KuGou.kt b/kugou/src/main/kotlin/it/vfsfitvnm/kugou/KuGou.kt index 3a29324..8c1875e 100644 --- a/kugou/src/main/kotlin/it/vfsfitvnm/kugou/KuGou.kt +++ b/kugou/src/main/kotlin/it/vfsfitvnm/kugou/KuGou.kt @@ -2,7 +2,7 @@ package it.vfsfitvnm.kugou import io.ktor.client.HttpClient import io.ktor.client.call.body -import io.ktor.client.engine.cio.CIO +import io.ktor.client.engine.okhttp.OkHttp import io.ktor.client.plugins.BrowserUserAgent import io.ktor.client.plugins.compression.ContentEncoding import io.ktor.client.plugins.contentnegotiation.ContentNegotiation @@ -22,7 +22,7 @@ import kotlinx.serialization.json.Json object KuGou { @OptIn(ExperimentalSerializationApi::class) private val client by lazy { - HttpClient(CIO) { + HttpClient(OkHttp) { BrowserUserAgent() expectSuccess = true diff --git a/settings.gradle.kts b/settings.gradle.kts index f608508..b9c2a24 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -41,7 +41,7 @@ dependencyResolutionManagement { version("ktor", "2.0.3") library("ktor-client-core", "io.ktor", "ktor-client-core").versionRef("ktor") - library("ktor-client-cio", "io.ktor", "ktor-client-cio").versionRef("ktor") + library("ktor-client-cio", "io.ktor", "ktor-client-okhttp").versionRef("ktor") library("ktor-client-content-negotiation", "io.ktor", "ktor-client-content-negotiation").versionRef("ktor") library("ktor-client-encoding", "io.ktor", "ktor-client-encoding").versionRef("ktor") library("ktor-client-serialization", "io.ktor", "ktor-client-serialization").versionRef("ktor") diff --git a/youtube-music/src/main/kotlin/it/vfsfitvnm/youtubemusic/YouTube.kt b/youtube-music/src/main/kotlin/it/vfsfitvnm/youtubemusic/YouTube.kt index c44f7cc..f7a7cd8 100644 --- a/youtube-music/src/main/kotlin/it/vfsfitvnm/youtubemusic/YouTube.kt +++ b/youtube-music/src/main/kotlin/it/vfsfitvnm/youtubemusic/YouTube.kt @@ -1,25 +1,41 @@ package it.vfsfitvnm.youtubemusic -import io.ktor.client.* -import io.ktor.client.call.* -import io.ktor.client.engine.cio.* -import io.ktor.client.plugins.* -import io.ktor.client.plugins.compression.* -import io.ktor.client.plugins.contentnegotiation.* -import io.ktor.client.request.* -import io.ktor.http.* -import io.ktor.serialization.kotlinx.json.* -import it.vfsfitvnm.youtubemusic.models.* +import io.ktor.client.HttpClient +import io.ktor.client.call.body +import io.ktor.client.engine.okhttp.OkHttp +import io.ktor.client.plugins.BrowserUserAgent +import io.ktor.client.plugins.compression.ContentEncoding +import io.ktor.client.plugins.compression.brotli +import io.ktor.client.plugins.contentnegotiation.ContentNegotiation +import io.ktor.client.plugins.defaultRequest +import io.ktor.client.request.get +import io.ktor.client.request.parameter +import io.ktor.client.request.post +import io.ktor.client.request.setBody +import io.ktor.http.ContentType +import io.ktor.http.contentType +import io.ktor.serialization.kotlinx.json.json +import it.vfsfitvnm.youtubemusic.models.BrowseResponse +import it.vfsfitvnm.youtubemusic.models.ContinuationResponse +import it.vfsfitvnm.youtubemusic.models.GetQueueResponse +import it.vfsfitvnm.youtubemusic.models.GetSearchSuggestionsResponse +import it.vfsfitvnm.youtubemusic.models.MusicResponsiveListItemRenderer +import it.vfsfitvnm.youtubemusic.models.MusicShelfRenderer +import it.vfsfitvnm.youtubemusic.models.NavigationEndpoint +import it.vfsfitvnm.youtubemusic.models.NextResponse +import it.vfsfitvnm.youtubemusic.models.PlayerResponse +import it.vfsfitvnm.youtubemusic.models.Runs +import it.vfsfitvnm.youtubemusic.models.SearchResponse +import it.vfsfitvnm.youtubemusic.models.ThumbnailRenderer import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.Serializable import kotlinx.serialization.json.Json - object YouTube { private const val Key = "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8" @OptIn(ExperimentalSerializationApi::class) - val client = HttpClient(CIO) { + val client = HttpClient(OkHttp) { BrowserUserAgent() expectSuccess = true