diff --git a/innertube/src/main/java/com/zionhuang/innertube/YouTube.kt b/innertube/src/main/java/com/zionhuang/innertube/YouTube.kt index 4b386cfe0..448b122a8 100644 --- a/innertube/src/main/java/com/zionhuang/innertube/YouTube.kt +++ b/innertube/src/main/java/com/zionhuang/innertube/YouTube.kt @@ -12,7 +12,7 @@ import com.zionhuang.innertube.models.SearchSuggestions import com.zionhuang.innertube.models.SongItem import com.zionhuang.innertube.models.WatchEndpoint import com.zionhuang.innertube.models.WatchEndpoint.WatchEndpointMusicSupportedConfigs.WatchEndpointMusicConfig.Companion.MUSIC_VIDEO_TYPE_ATV -import com.zionhuang.innertube.models.YouTubeClient.Companion.ANDROID_MUSIC +import com.zionhuang.innertube.models.YouTubeClient.Companion.IOS import com.zionhuang.innertube.models.YouTubeClient.Companion.TVHTML5 import com.zionhuang.innertube.models.YouTubeClient.Companion.WEB import com.zionhuang.innertube.models.YouTubeClient.Companion.WEB_REMIX @@ -413,7 +413,7 @@ object YouTube { } suspend fun player(videoId: String, playlistId: String? = null): Result = runCatching { - val playerResponse = innerTube.player(ANDROID_MUSIC, videoId, playlistId).body() + val playerResponse = innerTube.player(IOS, videoId, playlistId).body() if (playerResponse.playabilityStatus.status == "OK") { return@runCatching playerResponse } diff --git a/innertube/src/main/java/com/zionhuang/innertube/models/YouTubeClient.kt b/innertube/src/main/java/com/zionhuang/innertube/models/YouTubeClient.kt index 8e715e6d0..20609997d 100644 --- a/innertube/src/main/java/com/zionhuang/innertube/models/YouTubeClient.kt +++ b/innertube/src/main/java/com/zionhuang/innertube/models/YouTubeClient.kt @@ -25,6 +25,7 @@ data class YouTubeClient( private const val USER_AGENT_WEB = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36" private const val USER_AGENT_ANDROID = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Mobile Safari/537.36" + private const val USER_AGENT_IOS = "com.google.ios.youtube/19.29.1 (iPhone16,2; U; CPU iOS 17_5_1 like Mac OS X;)" val ANDROID_MUSIC = YouTubeClient( clientName = "ANDROID_MUSIC", @@ -61,5 +62,12 @@ data class YouTubeClient( api_key = "AIzaSyDCU8hByM-4DrUqRUYnGn-3llEO78bcxq8", userAgent = "Mozilla/5.0 (PlayStation 4 5.55) AppleWebKit/601.2 (KHTML, like Gecko)" ) + + val IOS = YouTubeClient( + clientName = "IOS", + clientVersion = "19.29.1", + api_key = "AIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc", + userAgent = USER_AGENT_IOS, + ) } }