diff --git a/main/build.gradle.kts b/main/build.gradle.kts index 39fa9ee18..e98f5c5a0 100644 --- a/main/build.gradle.kts +++ b/main/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } val moduleName = "lavaplayer" -version = "1.3.99-original" +version = "1.3.99.1-original" dependencies { api("com.sedmelluq:lava-common:1.1.2") diff --git a/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/youtube/DefaultYoutubeTrackDetailsLoader.java b/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/youtube/DefaultYoutubeTrackDetailsLoader.java index 4c3346593..dff4164f5 100644 --- a/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/youtube/DefaultYoutubeTrackDetailsLoader.java +++ b/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/youtube/DefaultYoutubeTrackDetailsLoader.java @@ -18,6 +18,7 @@ import static com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeConstants.CLIENT_SCREEN_EMBED; import static com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeConstants.CLIENT_THIRD_PARTY_EMBED; +import static com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeConstants.PLAYER_PARAMS; import static com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeConstants.PLAYER_URL; import static com.sedmelluq.discord.lavaplayer.tools.ExceptionTools.throwWithDebugInfo; import static com.sedmelluq.discord.lavaplayer.tools.FriendlyException.Severity.COMMON; @@ -209,26 +210,28 @@ protected JsonBrowser loadTrackInfoFromInnertube( if (infoStatus == InfoStatus.PREMIERE_TRAILER) { // Android client gives encoded Base64 response to trailer which is also protobuf so we can't decode it - clientConfig = YoutubeClientConfig.WEB.copy().setAttribute(httpInterface); + clientConfig = YoutubeClientConfig.WEB.copy(); } else if (infoStatus == InfoStatus.NON_EMBEDDABLE) { // Used when age restriction bypass failed, if we have valid auth then most likely this request will be successful - clientConfig = YoutubeClientConfig.ANDROID.copy().setAttribute(httpInterface); + clientConfig = YoutubeClientConfig.ANDROID.copy() + .withRootField("params", PLAYER_PARAMS); } else if (infoStatus == InfoStatus.REQUIRES_LOGIN) { // Age restriction bypass - clientConfig = YoutubeClientConfig.TV_EMBEDDED.copy().setAttribute(httpInterface); + clientConfig = YoutubeClientConfig.TV_EMBEDDED.copy(); } else { // Default payload from what we start trying to get required data clientConfig = YoutubeClientConfig.ANDROID.copy() .withClientField("clientScreen", CLIENT_SCREEN_EMBED) .withThirdPartyEmbedUrl(CLIENT_THIRD_PARTY_EMBED) - .setAttribute(httpInterface); + .withRootField("params", PLAYER_PARAMS); } clientConfig .withRootField("racyCheckOk", true) .withRootField("contentCheckOk", true) .withRootField("videoId", videoId) - .withPlaybackSignatureTimestamp(playerScriptTimestamp.scriptTimestamp); + .withPlaybackSignatureTimestamp(playerScriptTimestamp.scriptTimestamp) + .setAttribute(httpInterface); log.debug("Loading track info with payload: {}", clientConfig.toJsonString()); diff --git a/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/youtube/YoutubeConstants.java b/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/youtube/YoutubeConstants.java index 64db978c1..fec86feb5 100644 --- a/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/youtube/YoutubeConstants.java +++ b/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/youtube/YoutubeConstants.java @@ -21,6 +21,7 @@ public class YoutubeConstants { static final String CLIENT_SCREEN_EMBED = "EMBED"; static final String CLIENT_THIRD_PARTY_EMBED = "https://google.com"; + static final String PLAYER_PARAMS = "8AEB"; static final String SEARCH_PARAMS = "EgIQAQ=="; static final String SEARCH_URL = BASE_URL + "/search?key=" + INNERTUBE_ANDROID_API_KEY;