Change android youtube client
This commit is contained in:
@@ -698,7 +698,7 @@ class PlayerService : InvincibleService(), Player.Listener, PlaybackStatsListene
|
|||||||
itag = format.itag,
|
itag = format.itag,
|
||||||
mimeType = format.mimeType,
|
mimeType = format.mimeType,
|
||||||
bitrate = format.bitrate,
|
bitrate = format.bitrate,
|
||||||
loudnessDb = body.playerConfig?.audioConfig?.loudnessDb?.toFloat(),
|
loudnessDb = body.playerConfig?.audioConfig?.loudnessDb?.toFloat()?.plus(7),
|
||||||
contentLength = format.contentLength,
|
contentLength = format.contentLength,
|
||||||
lastModified = format.lastModified
|
lastModified = format.lastModified
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ fun StatsForNerds(
|
|||||||
itag = format.itag,
|
itag = format.itag,
|
||||||
mimeType = format.mimeType,
|
mimeType = format.mimeType,
|
||||||
bitrate = format.bitrate,
|
bitrate = format.bitrate,
|
||||||
loudnessDb = response.playerConfig?.audioConfig?.loudnessDb?.toFloat(),
|
loudnessDb = response.playerConfig?.audioConfig?.loudnessDb?.toFloat()?.plus(7),
|
||||||
contentLength = format.contentLength,
|
contentLength = format.contentLength,
|
||||||
lastModified = format.lastModified
|
lastModified = format.lastModified
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ data class Context(
|
|||||||
val clientVersion: String,
|
val clientVersion: String,
|
||||||
val platform: String,
|
val platform: String,
|
||||||
val hl: String = "en",
|
val hl: String = "en",
|
||||||
val visitorData: String? = null,
|
val visitorData: String = "CgtEUlRINDFjdm1YayjX1pSaBg%3D%3D",
|
||||||
val androidSdkVersion: Int? = null,
|
val androidSdkVersion: Int? = null,
|
||||||
val userAgent: String? = null
|
val userAgent: String? = null
|
||||||
)
|
)
|
||||||
@@ -29,17 +29,16 @@ data class Context(
|
|||||||
clientName = "WEB_REMIX",
|
clientName = "WEB_REMIX",
|
||||||
clientVersion = "1.20220918",
|
clientVersion = "1.20220918",
|
||||||
platform = "DESKTOP",
|
platform = "DESKTOP",
|
||||||
visitorData = "CgtsZG1ySnZiQWtSbyiMjuGSBg%3D%3D"
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
val DefaultAndroid = Context(
|
val DefaultAndroid = Context(
|
||||||
client = Client(
|
client = Client(
|
||||||
clientName = "ANDROID",
|
clientName = "ANDROID_MUSIC",
|
||||||
clientVersion = "17.36.4",
|
clientVersion = "5.28.1",
|
||||||
platform = "MOBILE",
|
platform = "MOBILE",
|
||||||
androidSdkVersion = 30,
|
androidSdkVersion = 30,
|
||||||
userAgent = "com.google.android.youtube/17.36.4 (Linux; U; Android 11) gzip"
|
userAgent = "com.google.android.apps.youtube.music/5.28.1 (Linux; U; Android 11) gzip"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -47,8 +46,7 @@ data class Context(
|
|||||||
client = Client(
|
client = Client(
|
||||||
clientName = "TVHTML5_SIMPLY_EMBEDDED_PLAYER",
|
clientName = "TVHTML5_SIMPLY_EMBEDDED_PLAYER",
|
||||||
clientVersion = "2.0",
|
clientVersion = "2.0",
|
||||||
platform = "TV",
|
platform = "TV"
|
||||||
visitorData = null,
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import io.ktor.client.request.post
|
|||||||
import io.ktor.client.request.setBody
|
import io.ktor.client.request.setBody
|
||||||
import io.ktor.http.ContentType
|
import io.ktor.http.ContentType
|
||||||
import io.ktor.http.contentType
|
import io.ktor.http.contentType
|
||||||
import io.ktor.http.userAgent
|
|
||||||
import it.vfsfitvnm.youtubemusic.Innertube
|
import it.vfsfitvnm.youtubemusic.Innertube
|
||||||
import it.vfsfitvnm.youtubemusic.models.Context
|
import it.vfsfitvnm.youtubemusic.models.Context
|
||||||
import it.vfsfitvnm.youtubemusic.models.PlayerResponse
|
import it.vfsfitvnm.youtubemusic.models.PlayerResponse
|
||||||
@@ -17,7 +16,6 @@ import kotlinx.serialization.Serializable
|
|||||||
suspend fun Innertube.player(body: PlayerBody) = runCatchingNonCancellable {
|
suspend fun Innertube.player(body: PlayerBody) = runCatchingNonCancellable {
|
||||||
val response = client.post(player) {
|
val response = client.post(player) {
|
||||||
setBody(body)
|
setBody(body)
|
||||||
body.context.client.userAgent?.let(::userAgent)
|
|
||||||
mask("playabilityStatus.status,playerConfig.audioConfig,streamingData.adaptiveFormats,videoDetails.videoId")
|
mask("playabilityStatus.status,playerConfig.audioConfig,streamingData.adaptiveFormats,videoDetails.videoId")
|
||||||
}.body<PlayerResponse>()
|
}.body<PlayerResponse>()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user