From f2af2539862f5acbc405f15a962dc7d4e6125fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80?= Date: Sun, 26 Nov 2023 14:43:06 +0100 Subject: [PATCH] use head request to resolve spotify short links --- .../topisenpai/lavasrc/spotify/SpotifySourceManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/src/main/java/com/github/topisenpai/lavasrc/spotify/SpotifySourceManager.java b/main/src/main/java/com/github/topisenpai/lavasrc/spotify/SpotifySourceManager.java index b253806d..630f3eac 100644 --- a/main/src/main/java/com/github/topisenpai/lavasrc/spotify/SpotifySourceManager.java +++ b/main/src/main/java/com/github/topisenpai/lavasrc/spotify/SpotifySourceManager.java @@ -17,6 +17,7 @@ import org.apache.http.client.config.RequestConfig; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpHead; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.message.BasicNameValuePair; @@ -114,7 +115,7 @@ public AudioItem loadItem(AudioPlayerManager manager, AudioReference reference) // If the identifier is a share URL, we need to follow the redirect to find out the real url behind it if (reference.identifier.startsWith(SHARE_URL)) { - var request = new HttpGet(reference.identifier); + var request = new HttpHead(reference.identifier); request.setConfig(RequestConfig.custom().setRedirectsEnabled(false).build()); try (var response = this.httpInterfaceManager.getInterface().execute(request)) { if (response.getStatusLine().getStatusCode() == 307) {