mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-11-22 09:04:32 +01:00
Youtube Mp3 Link Fetching Fixed for Native
This commit is contained in:
parent
c278d6379a
commit
440210931b
@ -75,6 +75,8 @@ fun createHttpClient(enableNetworkLogs: Boolean = false) = HttpClient {
|
||||
install(JsonFeature) {
|
||||
serializer = KotlinxSerializer()
|
||||
}
|
||||
// WorkAround for Freezing
|
||||
// Use httpClient.getData / httpClient.postData Extensions
|
||||
/*install(JsonFeature) {
|
||||
serializer = KotlinxSerializer(
|
||||
Json {
|
||||
|
@ -49,7 +49,6 @@ suspend inline fun <reified T: Any> HttpClient.postData(
|
||||
): T {
|
||||
val response = post<HttpResponse> {
|
||||
url.takeFrom(urlString)
|
||||
header(HttpHeaders.ContentType, ContentType.Application.Json)
|
||||
block()
|
||||
}
|
||||
val jsonBody = response.readText()
|
||||
|
@ -45,7 +45,7 @@ interface Yt1sMp3 {
|
||||
* Body Form= q:yt video link ,vt:format=mp3
|
||||
* */
|
||||
private suspend fun getKey(videoID: String): String {
|
||||
val response: JsonObject? = httpClient.postData("${corsApi}https://yt1s.com/api/ajaxSearch/index") {
|
||||
val response: JsonObject? = httpClient.post("${corsApi}https://yt1s.com/api/ajaxSearch/index") {
|
||||
body = FormDataContent(
|
||||
Parameters.build {
|
||||
append("q", "https://www.youtube.com/watch?v=$videoID")
|
||||
@ -57,7 +57,7 @@ interface Yt1sMp3 {
|
||||
}
|
||||
|
||||
private suspend fun getConvertedMp3Link(videoID: String, key: String): JsonObject? {
|
||||
return httpClient.postData("${corsApi}https://yt1s.com/api/ajaxConvert/convert") {
|
||||
return httpClient.post("${corsApi}https://yt1s.com/api/ajaxConvert/convert") {
|
||||
body = FormDataContent(
|
||||
Parameters.build {
|
||||
append("vid", videoID)
|
||||
|
Loading…
Reference in New Issue
Block a user