Skip to content

A collection of Lavaplayer SourceManagers

License

Notifications You must be signed in to change notification settings

karma993892/LavaSrc

 
 

Repository files navigation

LavaSrc

A collection of additional Lavaplayer Audio Source Managers and Lavalink Plugin.

  • Spotify* playlists/albums/songs/artists(top tracks)/search results
  • Apple Music* playlists/albums/songs/artists/search results(Big thx to ryan5453 for helping me)
  • Deezer playlists/albums/songs/artists/search results(Big thx to ryan5453 and melike2d for helping me)
  • Yandex Music playlists/albums/songs/artists/podcasts/search results(Thx to AgutinVBoy for implementing it)

*tracks are searched & played via YouTube or other configurable sources

Summary

Lavaplayer Usage

Replace x.y.z with the latest version number

Using in Gradle:

repositories {
  maven {
    url "https://jitpack.io"
  }
}

dependencies {
  implementation "com.github.TopiSenpai.LavaSrc:lavasrc:x.y.z"
}

Using in Maven:

<repositories>
  <repository>
    <id>jitpack</id>
    <url>https://jitpack.io</url>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>com.github.TopiSenpai.LavaSrc</groupId>
    <artifactId>lavasrc</artifactId>
    <version>x.y.z</version>
  </dependency>
</dependencies>

Usage

For all supported urls and queries see here

Spotify

To get a Spotify clientId & clientSecret you must go here and create a new application.

AudioPlayerManager playerManager = new DefaultAudioPlayerManager();

// create a new SpotifySourceManager with the default providers, clientId, clientSecret, countryCode and AudioPlayerManager and register it
playerManager.registerSourceManager(new SpotifySourceManager(null, clientId, clientSecret, countryCode, playerManager));

Apple Music

AudioPlayerManager playerManager = new DefaultAudioPlayerManager();

// create a new AppleMusicSourceManager with the standard providers, countrycode and AudioPlayerManager and register it
playerManager.registerSourceManager(new AppleMusicSourceManager(null, "us", playerManager));

Deezer

AudioPlayerManager playerManager = new DefaultAudioPlayerManager();

// create a new DeezerSourceManager with the master decryption key and register it
playerManager.registerSourceManager(new DeezerSourceManager("...");

Yandex Music

How to get access token

How to get access token

  1. (Optional) Open DevTools in your browser and on the Network tab enable trotlining.
  2. Go to https://oauth.yandex.ru/authorize?response_type=token&client_id=23cabbbdc6cd418abb4b39c32c41195d
  3. Authorize and grant access
  4. The browser will redirect to the address like https://music.yandex.ru/#access_token=AQAAAAAYc***&token_type=bearer&expires_in=31535645. Very quickly there will be a redirect to another page, so you need to have time to copy the link. image
  5. Your accessToken, what is after access_token.

Token expires in 1 year. You can get a new one by repeating the steps above.

Important information

Yandex Music is very location-dependent. You should either have a premium subscription or be located in one of the following countries:

  • Azerbaijan
  • Armenia
  • Belarus
  • Georgia
  • Kazakhstan
  • Kyrgyzstan
  • Moldova
  • Russia
  • Tajikistan
  • Turkmenistan
  • Uzbekistan

Else you will only have access to podcasts.

AudioPlayerManager playerManager = new DefaultAudioPlayerManager();

// create a new YandexMusicSourceManager with the access token and register it
playerManager.registerSourceManager(new YandexMusicSourceManager("...");

Lavalink Usage

This plugin requires Lavalink v3.6.0 or greater

To install this plugin either download the latest release and place it into your plugins folder or add the following into your application.yml

Lavalink supports plugins only in v3.5 and above

Replace x.y.z with the latest version number

lavalink:
  plugins:
    - dependency: "com.github.TopiSenpai.LavaSrc:lavasrc-plugin:x.y.z"
      repository: "https://jitpack.io"

Configuration

For all supported urls and queries see here

For an application.yml example see here

To get your Spotify clientId & clientSecret go here & then copy them into your application.yml like the following.

To get your Yandex Music access token go here

(YES plugins IS AT ROOT IN THE YAML)

plugins:
  lavasrc:
    providers: # Custom providers for track loading. This is the default
      - "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
    # - "dzisrc:%ISRC%" # Deezer ISRC provider
    # - "scsearch:%QUERY%" you can add multiple other fallback sources here
    sources:
      spotify: true # Enable Spotify source
      applemusic: true # Enable Apple Music source
      deezer: true # Enable Deezer source
      yandexmusic: true # Enable Yandex Music source
    spotify:
      clientId: "your client id"
      clientSecret: "your client secret"
      countryCode: "US" # the country code you want to use for filtering the artists top tracks. See https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
    applemusic:
      countryCode: "US" # the country code you want to use for filtering the artists top tracks and language. See https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
    deezer:
      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)
    yandexmusic:
      accessToken: "your access token" # the token used for accessing the yandex music api. See https://github.com/TopiSenpai/LavaSrc#yandex-music

Supported URLs and Queries

Spotify

Apple Music

Deezer

Yandex Music


About

A collection of Lavaplayer SourceManagers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%