From 00075adb47a22e65a44b9a1344bae51133cef1b0 Mon Sep 17 00:00:00 2001 From: Jjmarco Date: Sat, 2 Oct 2021 19:23:38 +0200 Subject: [PATCH] Added fixes from issue #650 pull request from original repo --- .../source/soundcloud/DefaultSoundCloudDataReader.java | 6 ++---- .../source/soundcloud/DefaultSoundCloudHtmlDataLoader.java | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/soundcloud/DefaultSoundCloudDataReader.java b/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/soundcloud/DefaultSoundCloudDataReader.java index b75e60ad7..10f192404 100644 --- a/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/soundcloud/DefaultSoundCloudDataReader.java +++ b/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/soundcloud/DefaultSoundCloudDataReader.java @@ -90,10 +90,8 @@ public List readPlaylistTracks(JsonBrowser playlistData) { protected JsonBrowser findEntryOfKind(JsonBrowser data, String kind) { for (JsonBrowser value : data.values()) { - for (JsonBrowser entry : value.get("data").values()) { - if (entry.isMap() && kind.equals(entry.get("kind").text())) { - return entry; - } + if (value.isMap() && kind.equals(value.get("data").get("kind").safeText())) { + return value.get("data"); } } diff --git a/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/soundcloud/DefaultSoundCloudHtmlDataLoader.java b/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/soundcloud/DefaultSoundCloudHtmlDataLoader.java index 57bc048ce..03b9b1d28 100644 --- a/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/soundcloud/DefaultSoundCloudHtmlDataLoader.java +++ b/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/soundcloud/DefaultSoundCloudHtmlDataLoader.java @@ -22,6 +22,7 @@ public class DefaultSoundCloudHtmlDataLoader implements SoundCloudHtmlDataLoader private static final Logger log = LoggerFactory.getLogger(DefaultSoundCloudHtmlDataLoader.class); private static final TextRange[] JSON_RANGES = { + new TextRange("window.__sc_hydration = ", ";"), new TextRange("catch(e){}})},", ");"), new TextRange("){}})},", ");") };