diff --git a/application/src/main/java/me/duncte123/lyrics/HttpClientProvider.java b/application/src/main/java/me/duncte123/lyrics/HttpClientProvider.java index 29ef325..306f4a8 100644 --- a/application/src/main/java/me/duncte123/lyrics/HttpClientProvider.java +++ b/application/src/main/java/me/duncte123/lyrics/HttpClientProvider.java @@ -32,7 +32,10 @@ public HttpClientProvider(AbstractRoutePlanner routePlanner, ServerConfig server rotator = new YoutubeIpRotatorSetup(routePlanner).withRetryLimit(retryLimit); } - rotator.forConfiguration(this.httpInterfaceManager, false).setup(); + rotator.forConfiguration(this.httpInterfaceManager, false) + // Necessary to avoid NPEs. + .withMainDelegateFilter(null) + .setup(); } } diff --git a/application/src/main/java/me/duncte123/lyrics/LyricsClient.java b/application/src/main/java/me/duncte123/lyrics/LyricsClient.java index 942ff9f..c7db573 100644 --- a/application/src/main/java/me/duncte123/lyrics/LyricsClient.java +++ b/application/src/main/java/me/duncte123/lyrics/LyricsClient.java @@ -1,6 +1,5 @@ package me.duncte123.lyrics; -import com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack; import com.sedmelluq.discord.lavaplayer.tools.JsonBrowser; import com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface; import com.sedmelluq.discord.lavaplayer.track.AudioTrack; @@ -47,8 +46,8 @@ public Future findLyrics(AudioTrack track) { try { final String videoId; - if (track instanceof YoutubeAudioTrack ytTrack) { - videoId = ytTrack.getInfo().identifier; + if ("youtube".equalsIgnoreCase(track.getSourceManager().getSourceName())) { + videoId = track.getInfo().identifier; } else if (track.getInfo().isrc != null) { // So, turns out that yt needs the ISRC in quotes. Whoops final var searched = search(