Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidal & Jiosaavn , Advanced mirroring #247

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
08988b1
apply StringCompareMirroringAudioTrackResolver to DefaultMirroringAud…
WeeeeeeeeeeS Dec 25, 2024
b05dfd8
Used Nansess tidal implementation
WeeeeeeeeeeS Jan 3, 2025
a811daa
Used Nansess tidal implementation
WeeeeeeeeeeS Jan 3, 2025
bd58425
Added "useLocalNetwork" as a proxy option.
WeeeeeeeeeeS Jan 3, 2025
800f308
Made saavn use localnetwork for playback
WeeeeeeeeeeS Jan 3, 2025
f49e5ff
Used fuzzywuzzy:1.4.0
WeeeeeeeeeeS Jan 4, 2025
ba952cc
added TidalToken option & changed application.example.yml
WeeeeeeeeeeS Jan 4, 2025
f51e2f2
updated application.example.yml
WeeeeeeeeeeS Jan 4, 2025
4ef9c2b
Updated ReadMe.md & added more constructors to ProxyConfig & Saavn au…
WeeeeeeeeeeS Jan 4, 2025
2c83c1b
Updated Readme.md
WeeeeeeeeeeS Jan 4, 2025
38bb861
Updated Readme.md
WeeeeeeeeeeS Jan 4, 2025
5a7cfd1
if it works don't touch it? Fixed Saavn
WeeeeeeeeeeS Jan 4, 2025
37c14c3
Added tidal recommendations
WeeeeeeeeeeS Jan 12, 2025
be58db1
Fixed deezer null exception when not using proxies
WeeeeeeeeeeS Jan 13, 2025
2bc7ee6
Update application.example.yml
WeeeeeeeeeeS Jan 15, 2025
9b97a9c
updated apiurl search endpoint in jiosaavn
WeeeeeeeeeeS Jan 15, 2025
6f65617
rewrote StringCompareMirroringAudioTrackResolver
WeeeeeeeeeeS Jan 18, 2025
8b6bc51
changed the configurations to make them more logical, commented out u…
WeeeeeeeeeeS Jan 19, 2025
e22175d
changed Saavn to JioSaavn
WeeeeeeeeeeS Jan 19, 2025
1ad32e1
ProxyManager now implements HttpInterfaceManager, now debugging make …
WeeeeeeeeeeS Jan 19, 2025
2c783cc
changed Deezer & jiosaavn to take ProxyManager instead of configs
WeeeeeeeeeeS Jan 19, 2025
ac3e29d
changed Deezer & jiosaavn to take ProxyManager instead of configs
WeeeeeeeeeeS Jan 19, 2025
da80949
updated README.md & application.example.yml to match the new Proxyman…
WeeeeeeeeeeS Jan 19, 2025
78561ed
added an example of how to use ProxyConfig
WeeeeeeeeeeS Jan 19, 2025
87bf40e
Updated JioSaavn jsrec README.md
WeeeeeeeeeeS Jan 19, 2025
e057b03
updated tidal http link to https
WeeeeeeeeeeS Jan 19, 2025
5909ed0
removed secret key
WeeeeeeeeeeS Jan 21, 2025
e0c2f08
replaced apiUrl with a generic proxy (even easier to self host)
WeeeeeeeeeeS Jan 23, 2025
00909a4
Removed old apiUrl in README.md
WeeeeeeeeeeS Jan 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 101 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ A collection of additional [Lavaplayer v2](https://github.com/sedmelluq/lavaplay
* [Flowery TTS](https://flowery.pw/docs) (Thx to [bachtran02](https://github.com/bachtran02) for implementing it)
* [YouTube](https://youtube.com) & [YouTubeMusic](https://music.youtube.com/) [LavaSearch](https://github.com/topi314/LavaSearch)/[LavaLyrics](https://github.com/topi314/LavaLyrics) (Thx to [DRSchlaubi](https://github.com/DRSchlaubi) for helping me)
* [Vk Music](https://music.vk.com/) playlists/albums/songs/artists(top tracks)/search results/[LavaLyrics](https://github.com/topi314/LavaLyrics)/[LavaSearch](https://github.com/topi314/LavaSearch) (Thx to [Krispeckt](https://github.com/Krispeckt) for implementing it)
* [JioSaavn](https://www.jiosaavn.com) playlists/albums/songs/artists/featured/search results
* [Tidal](https://tidal.com) playlists/albums/songs/search results

> [!IMPORTANT]
> Tracks from Spotify & Apple Music don't actually play from their sources, but are instead resolved via the configured providers
> Tracks from Spotify & Apple Music & Tidal don't actually play from their sources, but are instead resolved via the configured providers

## Summary

Expand Down Expand Up @@ -71,9 +73,21 @@ plugins:
providers: # Custom providers for track loading. This is the default
# - "dzisrc:%ISRC%" # Deezer ISRC provider
# - "dzsearch:%QUERY%" # Deezer search provider
# - 'jssearch:%QUERY%' # JioSaavn search provider (recommended to use with advanced mirroring & search proxies)
- "ytsearch:\"%ISRC%\"" # Will be ignored if track does not have an ISRC. See https://en.wikipedia.org/wiki/International_Standard_Recording_Code
- "ytsearch:%QUERY%" # Will be used if track has no ISRC or no track could be found for the ISRC
# you can add multiple other fallback sources here
advancemirroring:
WeeeeeeeeeeS marked this conversation as resolved.
Show resolved Hide resolved
enabled: false # Whether to enable the advanced mirroring feature
titleThreshold: 50 # The threshold for the title match (50 is the most optimal)
authorThreshold: 70 # The threshold for the author match (70 is the most optimal)
totalMatchThreshold: 196 # The threshold for the total match (196 is the most optimal)
skipSoundCloudGo: true # Whether to skip the SoundCloud Go tracks (preview tracks)
levelOnePenalty: 1 # The penalty for the first level
levelTwoPenalty: 2 # The penalty for the second level
levelThreePenalty: 0.8 # The penalty for the third level
sources: # The sources to use for the advanced mirroring
- jssearch
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this config is a mess tbh. this should be restructured

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to be optional; advanced users can still add these if they want

    providers: # Custom providers for track loading. This is the default
#      - "dzisrc:%ISRC%" # Deezer ISRC provider
#      - "dzsearch:%QUERY%" # Deezer search provider
#      - 'jssearch:%QUERY%' # JioSaavn search provider (recommended to use with advanced mirroring & search proxies)
      - "ytsearch:\"%ISRC%\"" # Will be ignored if track does not have an ISRC. See https://en.wikipedia.org/wiki/International_Standard_Recording_Code
      - "ytsearch:%QUERY%" # Will be used if track has no ISRC or no track could be found for the ISRC
    #        you can add multiple other fallback sources here
    #advancedmirroring: # A custom resolver that will be used for regular QUERY searches, and get you the best results from the sources you provide (Recommended for use with bad search platforms)
      #sources: # The sources to use for the advanced mirroring
      #  - jssearch # JioSaavn search source
      # skipSoundCloudGo: true # Whether to skip the SoundCloud Go tracks (preview tracks) (optional)
      # You can also set the threshold for the title, author & total match (titleThreshold, authorThreshold (1 - 100), totalMatchThreshold (1 - 300)) (optional)
      # levelOnePenalty: 1, levelTwoPenalty: 2, levelThreePenalty: 0.8 # Penalties for the first, second, and third levels (optional)

sources:
spotify: false # Enable Spotify source
applemusic: false # Enable Apple Music source
Expand All @@ -82,6 +96,8 @@ plugins:
flowerytts: false # Enable Flowery TTS source
youtube: false # Enable YouTube search source (https://github.com/topi314/LavaSearch)
vkmusic: false # Enable Vk Music source
saavn: false # Enable JioSaavn source
tidal: false # Enable Tidal source
lyrics-sources:
spotify: false # Enable Spotify lyrics source
deezer: false # Enable Deezer lyrics source
Expand Down Expand Up @@ -113,6 +129,13 @@ plugins:
masterDecryptionKey: "your master decryption key" # the master key used for decrypting the deezer tracks. (yes this is not here you need to get it from somewhere else)
# arl: "your deezer arl" # the arl cookie used for accessing the deezer api this is optional but required for formats above MP3_128
formats: [ "FLAC", "MP3_320", "MP3_256", "MP3_128", "MP3_64", "AAC_64" ] # the formats you want to use for the deezer tracks. "FLAC", "MP3_320", "MP3_256" & "AAC_64" are only available for premium users and require a valid arl
# useLocalNetwork: true # whether to use the local network for accessing the deezer api or just rely on the proxies
# proxies:
# - proxyProtocol: "http" # the protocol of the proxy
# proxyHost: "192.0.2.146" # the host of the proxy (ip or domain)
# proxyPort: 8080 # the port of the proxy
# proxyUser: "user" # the user of the proxy (optional)
# proxyPassword: "youShallPass" # the password of the proxy (optional)
yandexmusic:
accessToken: "your access token" # the token used for accessing the yandex music api. See https://github.com/TopiSenpai/LavaSrc#yandex-music
playlistLoadLimit: 1 # The number of pages at 100 tracks each
Expand All @@ -131,6 +154,19 @@ plugins:
playlistLoadLimit: 1 # The number of pages at 50 tracks each
artistLoadLimit: 1 # The number of pages at 10 tracks each
recommendationsLoadLimit: 10 # Number of tracks
tidal:
countryCode: "US"
searchLimit: 6
WeeeeeeeeeeS marked this conversation as resolved.
Show resolved Hide resolved
#tidalToken: "your tidal token" # optional (in case you want to change the token & use your own)
WeeeeeeeeeeS marked this conversation as resolved.
Show resolved Hide resolved
saavn:
#apiUrl: "https://apilink.lavalink/api" # the api link used for accessing the saavn api (not recommended to use, use proxies)
useLocalNetwork: false # whether to use the local network for accessing the deezer api or just rely on the proxies (keep it false if your server is not in India)
proxies:
- proxyProtocol: "http" # the protocol of the proxy (use http or https)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proxies -> proxyProtocol??

proxyHost: "192.0.2.146" # the host of the proxy (ip or domain)
proxyPort: 8080 # the port of the proxy
proxyUser: "user" # the user of the proxy (optional)
proxyPassword: "youShallPass" # the password of the proxy (optional)
```

### Plugin Info
Expand Down Expand Up @@ -492,8 +528,11 @@ Use Google to find a guide on how to get the arl cookie. It's not that hard.
AudioPlayerManager playerManager = new DefaultAudioPlayerManager();

// create a new DeezerSourceManager with the master decryption key and register it

var deezer = new DeezerSourceManager("the master decryption key", "your arl", formats);

// To use Deezer with proxies
// var proxyConfigs = List.of(new ProxyConfig(proxyProtocol, proxyHost, proxyPort, proxyUser, String proxyPassword))
// var deezer = new DeezerAudioSourceManager("the master decryption key", "your arl", formats, proxiesList, useLocalNetwork);
playerManager.registerSourceManager(deezer);
```

Expand Down Expand Up @@ -662,17 +701,59 @@ lyricsManager.registerLyricsManager(vkmusic);
<summary>Click to expand</summary>

```java
// create new search manager
var searchManager = new SearchManager();
AudioPlayerManager playerManager = new DefaultAudioPlayerManager();

// register source
searchManager.registerSearchManager(vkmusic);
// create a new VkMusicSourceManager with the user token and register it
playerManager.registerSourceManager(new VkMusicSourceManager("...");
```

</details>

---

### JioSaavn

<details>
<summary>How to get api url</summary>
Follow this guide https://github.com/appujet/jiosaavn-plugin-api)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👎🏻 I don't want to rely on someone random thing

### Note: Using proxies is recommended instead of relying on an external API.

</details>
<details>
<summary>Supported proxy regions</summary>
India, Pakistan, Afghanistan, Bahrain, Bangladesh, Bhutan, Egypt, Iraq, Jordan, Kuwait, Lebanon, Maldives, Nepal, Oman, Qatar, Saudi Arabia, Sri Lanka, UAE, and Yemen.

</details>

```java
AudioPlayerManager playerManager = new DefaultAudioPlayerManager();

// create a new SaavnAudioSourceManager and register it (ONLY IF YOUR SERVER IS IN A SUPPORTED REGION)
var saavn = new SaavnAudioSourceManager();

// to use Saavn with proxies (user & password are optional)
// var proxyConfigs = List.of(new ProxyConfig(proxyProtocol, proxyHost, proxyPort, proxyUser, String proxyPassword))
// var saavn = new SaavnAudioSourceManager(proxyConfigs, useLocalNetwork);

playerManager.registerSourceManager(saavn);
```

---


### Tidal

```java
AudioPlayerManager playerManager = new DefaultAudioPlayerManager();

// Tidal token is optional (in case you want to change the token & use your own)
// country code is optional (default is US)
var tidal = new TidalSourceManager(countryCode, playerManager, DefaultMirroringAudioTrackResolver, tidalToken);
playerManager.registerSourceManager(tidal);
````



## Supported URLs and Queries

### Spotify
Expand Down Expand Up @@ -740,4 +821,18 @@ You can read about all the available options [here](https://flowery.pw/docs), a
* https://vk.com/audios700949584?q=phonk%20album&z=audio_playlist-2000933493_13933493%2Fbe3494d46d310b0d0d
* https://vk.ru/audios700949584?q=phonk%20album&z=audio_playlist-2000933493_13933493

### JioSaavn
* `jssearch:animals architects`
* `jsrec:identifier`
WeeeeeeeeeeS marked this conversation as resolved.
Show resolved Hide resolved
* https://www.jiosaavn.com/song/hello/Oj0JdT5yZFo
* https://www.jiosaavn.com/artist/adele-songs/yc6n84bIDm8
* https://www.jiosaavn.com/album/25/NGUmkn-uYyY
* https://www.jiosaavn.com/featured/lets-play-adele/pVh19D03XxOvz,QNANKgeg

### Tidal
* `tdsearch:animals architects`
* `tdrec:205573155` (`tdrec:{TRACK_ID}`)
WeeeeeeeeeeS marked this conversation as resolved.
Show resolved Hide resolved
* http://www.tidal.com/track/205573155
* https://tidal.com/browse/album/165814025
* https://tidal.com/browse/mix/00527d2ae9ccc1721dc42e9cc48e7a
---
39 changes: 37 additions & 2 deletions application.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,21 @@ plugins:
providers: # Custom providers for track loading. This is the default
# - "dzisrc:%ISRC%" # Deezer ISRC provider
# - "dzsearch:%QUERY%" # Deezer search provider
# - 'jssearch:%QUERY%' # JioSaavn search provider (recommended to use with advanced mirroring & search proxies)
- "ytsearch:\"%ISRC%\"" # Will be ignored if track does not have an ISRC. See https://en.wikipedia.org/wiki/International_Standard_Recording_Code
- "ytsearch:%QUERY%" # Will be used if track has no ISRC or no track could be found for the ISRC
# you can add multiple other fallback sources here
# you can add multiple other fallback sources here
advancemirroring:
enabled: false # Whether to enable the advanced mirroring feature
titleThreshold: 50 # The threshold for the title match (50 is the most optimal)
authorThreshold: 70 # The threshold for the author match (70 is the most optimal)
totalMatchThreshold: 196 # The threshold for the total match (196 is the most optimal)
skipSoundCloudGo: true # Whether to skip the SoundCloud Go tracks (preview tracks)
levelOnePenalty: 1 # The penalty for the first level
levelTwoPenalty: 2 # The penalty for the second level
levelThreePenalty: 0.8 # The penalty for the third level
sources: # The sources to use for the advanced mirroring
- jssearch
sources:
spotify: false # Enable Spotify source
applemusic: false # Enable Apple Music source
Expand All @@ -14,6 +26,8 @@ plugins:
flowerytts: false # Enable Flowery TTs source
youtube: false # Enable YouTube search source (https://github.com/topi314/LavaSearch)
vkmusic: false # Enable Vk Music source
saavn: false # Enable JioSaavn source
tidal: false # Enable Tidal source
lyrics-sources:
spotify: false # Enable Spotify lyrics source
deezer: false # Enable Deezer lyrics source
Expand All @@ -37,6 +51,13 @@ plugins:
masterDecryptionKey: "your master decryption key" # the master key used for decrypting the deezer tracks. (yes this is not here you need to get it from somewhere else)
arl: "your deezer arl" # the arl cookie used for accessing the deezer api
formats: [ "FLAC", "MP3_320", "MP3_256", "MP3_128", "MP3_64", "AAC_64" ] # the formats you want to use for the deezer tracks. "FLAC", "MP3_320", "MP3_256" & "AAC_64" are only available for premium users and require a valid arl
useLocalNetwork: true # whether to use the local network for accessing the deezer api or just rely on the proxies
proxies:
- proxyProtocol: "http" # the protocol of the proxy
proxyHost: "192.0.2.146" # the host of the proxy (ip or domain)
proxyPort: 8080 # the port of the proxy
proxyUser: "user" # the user of the proxy (optional)
proxyPassword: "youShallPass" # the password of the proxy (optional)
yandexmusic:
accessToken: "your access token" # the token used for accessing the yandex music api. See https://github.com/TopiSenpai/LavaSrc#yandex-music
playlistLoadLimit: 1 # The number of pages at 100 tracks each
Expand All @@ -55,6 +76,20 @@ plugins:
playlistLoadLimit: 1 # The number of pages at 50 tracks each
artistLoadLimit: 1 # The number of pages at 10 tracks each
recommendationsLoadLimit: 10 # Number of tracks
tidal:
countryCode: "US"
searchLimit: 6
# tidalToken: "your tidal token" # optional (in case you want to change the token & use your own)
saavn:
# apiUrl: "https://apilink.lavalink/api" # the api link used for accessing the saavn api (not recommended to use, use proxies)
useLocalNetwork: false # whether to use the local network for accessing the jiosaavn or just rely on the proxies (keep it false if your server is not in India)
proxies:
- proxyProtocol: "http" # the protocol of the proxy (use http or https)
proxyHost: "192.0.2.146" # the host of the proxy (ip or domain)
proxyPort: 8080 # the port of the proxy
proxyUser: "user" # the user of the proxy (optional)
proxyPassword: "youShallPass" # the password of the proxy (optional)


server: # REST and WS server
port: 2333
Expand Down Expand Up @@ -152,4 +187,4 @@ logging:
logback:
rollingpolicy:
max-file-size: 1GB
max-history: 30
max-history: 30
2 changes: 2 additions & 0 deletions main/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ dependencies {
implementation("com.auth0:java-jwt:4.4.0")
compileOnly("org.slf4j:slf4j-api:2.0.7")

implementation("me.xdrop:fuzzywuzzy:1.4.0")

lyricsDependency("protocol")
lyricsDependency("client")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.github.topi314.lavasearch.result.BasicAudioSearchResult;
import com.github.topi314.lavasrc.ExtendedAudioSourceManager;
import com.github.topi314.lavasrc.LavaSrcTools;
import com.github.topi314.lavasrc.proxy.ProxyManager;
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
import com.sedmelluq.discord.lavaplayer.tools.JsonBrowser;
Expand All @@ -25,6 +26,7 @@
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.github.topi314.lavasrc.proxy.ProxyConfig;

import java.io.DataInput;
import java.io.IOException;
Expand All @@ -42,6 +44,7 @@
import java.util.regex.Pattern;
import java.util.stream.Collectors;


public class DeezerAudioSourceManager extends ExtendedAudioSourceManager implements HttpConfigurable, AudioSearchManager, AudioLyricsManager {

public static final Pattern URL_PATTERN = Pattern.compile("(https?://)?(www\\.)?deezer\\.com/(?<countrycode>[a-zA-Z]{2}/)?(?<type>track|album|playlist|artist)/(?<identifier>[0-9]+)");
Expand All @@ -60,26 +63,30 @@ public class DeezerAudioSourceManager extends ExtendedAudioSourceManager impleme
private final String masterDecryptionKey;
private String arl;
private DeezerAudioTrack.TrackFormat[] formats;
private final HttpInterfaceManager httpInterfaceManager;
private Tokens tokens;
private final ProxyManager proxyManager;
private final HttpInterfaceManager httpInterfaceManager;


public DeezerAudioSourceManager(String masterDecryptionKey) {
this(masterDecryptionKey, null);
}

public DeezerAudioSourceManager(String masterDecryptionKey, @Nullable String arl) {
this(masterDecryptionKey, arl, null);
this(masterDecryptionKey, arl, null, null, false);
}

public DeezerAudioSourceManager(String masterDecryptionKey, @Nullable String arl, @Nullable DeezerAudioTrack.TrackFormat[] formats) {
public DeezerAudioSourceManager(String masterDecryptionKey, @Nullable String arl, @Nullable DeezerAudioTrack.TrackFormat[] formats, ProxyConfig[] proxyConfigs, boolean useLocalNetwork) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it would be better to just pass the proxy manager directly?
then you can reuse it for multiple sources too

couldn't the proxy manager be an implementation of HttpInterfaceManager?

if (masterDecryptionKey == null || masterDecryptionKey.isEmpty()) {
throw new IllegalArgumentException("Deezer master key must be set");
}

this.masterDecryptionKey = masterDecryptionKey;
this.arl = arl != null && arl.isEmpty() ? null : arl;
this.formats = formats != null && formats.length > 0 ? formats : DeezerAudioTrack.TrackFormat.DEFAULT_FORMATS;
this.httpInterfaceManager = HttpClientTools.createCookielessThreadLocalManager();
this.proxyManager = proxyConfigs != null ? new ProxyManager(proxyConfigs, useLocalNetwork) : null;
this.httpInterfaceManager = this.proxyManager != null ? this.proxyManager.getHttpInterfaceManager() : HttpClientTools.createCookielessThreadLocalManager();

}

public void setFormats(DeezerAudioTrack.TrackFormat[] formats) {
Expand Down Expand Up @@ -175,6 +182,7 @@ public AudioLyrics loadLyrics(@NotNull AudioTrack audioTrack) {
if (item == AudioReference.NO_TRACK) {
return null;
}

if (item instanceof AudioTrack) {
deezerTackId = ((AudioTrack) item).getIdentifier();
} else if (item instanceof AudioPlaylist) {
Expand Down Expand Up @@ -250,7 +258,7 @@ public AudioItem loadItem(String identifier, boolean preview) {
if (identifier.startsWith(SHARE_URL)) {
var request = new HttpGet(identifier);
request.setConfig(RequestConfig.custom().setRedirectsEnabled(false).build());
try (var response = this.httpInterfaceManager.getInterface().execute(request)) {
try (var response = getHttpInterface().execute(request)) {
if (response.getStatusLine().getStatusCode() == 302) {
var location = response.getFirstHeader("Location").getValue();
if (location.startsWith("https://www.deezer.com/")) {
Expand Down Expand Up @@ -290,7 +298,7 @@ public AudioItem loadItem(String identifier, boolean preview) {
public JsonBrowser getJson(String uri) throws IOException {
var request = new HttpGet(uri);
request.setHeader("Accept", "application/json");
return LavaSrcTools.fetchResponseAsJson(this.httpInterfaceManager.getInterface(), request);
return LavaSrcTools.fetchResponseAsJson(this.getHttpInterface(), request);
}

private List<AudioTrack> parseTracks(JsonBrowser json, boolean preview) {
Expand Down Expand Up @@ -538,20 +546,20 @@ private AudioItem getArtist(String id, boolean preview) throws IOException {
@Override
public void shutdown() {
try {
this.httpInterfaceManager.close();
this.proxyManager.close();
} catch (IOException e) {
log.error("Failed to close HTTP interface manager", e);
}
}

@Override
public void configureRequests(Function<RequestConfig, RequestConfig> configurator) {
this.httpInterfaceManager.configureRequests(configurator);
this.proxyManager.configureAllRequests(configurator);
}

@Override
public void configureBuilder(Consumer<HttpClientBuilder> configurator) {
this.httpInterfaceManager.configureBuilder(configurator);
this.proxyManager.configureAllBuilder(configurator);
}

public String getMasterDecryptionKey() {
Expand All @@ -568,7 +576,10 @@ public DeezerAudioTrack.TrackFormat[] getFormats() {
}

public HttpInterface getHttpInterface() {
return this.httpInterfaceManager.getInterface();
if(this.proxyManager == null) {
return this.httpInterfaceManager.getInterface();
}
return this.proxyManager.getHttpInterfaceManager().getInterface();
}

public static class Tokens {
Expand Down
Loading