Skip to content

Commit 8ba316b

Browse files
authored
Update SpotifySourceManager.java (#280)
1 parent 1abc5d6 commit 8ba316b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

main/src/main/java/com/github/topi314/lavasrc/spotify/SpotifySourceManager.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public class SpotifySourceManager extends MirroringAudioSourceManager implements
5252
public static final int ALBUM_MAX_PAGE_ITEMS = 50;
5353
public static final String API_BASE = "https://api.spotify.com/v1/";
5454
public static final String CLIENT_API_BASE = "https://spclient.wg.spotify.com/";
55+
private static final String USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.6998.178 Spotify/1.2.65.255 Safari/537.36";
5556
public static final Set<AudioSearchResult.Type> SEARCH_TYPES = Set.of(AudioSearchResult.Type.ALBUM, AudioSearchResult.Type.ARTIST, AudioSearchResult.Type.PLAYLIST, AudioSearchResult.Type.TRACK);
5657
private static final Logger log = LoggerFactory.getLogger(SpotifySourceManager.class);
5758

@@ -177,8 +178,9 @@ public AudioLyrics getLyrics(String id) throws IOException {
177178
}
178179

179180
var request = new HttpGet(CLIENT_API_BASE + "color-lyrics/v2/track/" + id + "?format=json&vocalRemoval=false");
180-
request.addHeader("App-Platform", "WebPlayer");
181-
request.addHeader("Authorization", "Bearer " + this.tokenTracker.getAccountToken());
181+
request.setHeader("User-Agent", USER_AGENT);
182+
request.setHeader("App-Platform", "WebPlayer");
183+
request.setHeader("Authorization", "Bearer " + this.tokenTracker.getAccountToken());
182184
var json = LavaSrcTools.fetchResponseAsJson(this.httpInterfaceManager.getInterface(), request);
183185
if (json == null) {
184186
return null;

0 commit comments

Comments
 (0)