TopiSenpai / LavaSrc

A collection of additional Lavaplayer/Lavalink Sources

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Snapshot builds are available in https://maven.topi.wtf/snapshots with the short commit hash as the version

Using in Gradle:

Gradle

repositories {
  maven {
    url "https://maven.topi.wtf/releases"
  }
}

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

Using in Maven:

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, token(pass null for automatic extraction), countrycode and AudioPlayerManager and register it
playerManager.registerSourceManager(new AppleMusicSourceManager(null, mediaAPIToken , "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

Note For a full application.yml example see here

Replace x.y.z with the latest version number

lavalink:
  plugins:
    - dependency: "com.github.TopiSenpai.LavaSrc:lavasrc-plugin:x.y.z"
      repository: "https://maven.topi.wtf/releases"

Snapshot builds are available in https://maven.topi.wtf/snapshots with the short commit hash as the version

Configuration

For all supported urls and queries 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
      # - "dzisrc:%ISRC%" # Deezer ISRC provider
      # - "dzsearch:%QUERY%" # Deezer search provider
      - "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
    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
      playlistLoadLimit: 6 # The number of pages at 100 tracks each
      albumLoadLimit: 6 # The number of pages at 50 tracks each
    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
      # mediaAPIToken: "..." # Can be used to bypass the auto token fetching which is likely to break again in the future
      playlistLoadLimit: 6 # The number of pages at 300 tracks each
      albumLoadLimit: 6 # The number of pages at 300 tracks each
    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

(including new regional links like https://open.spotify.com/intl-de/track/0eG08cBeKk0mzykKjw4hcQ)

Apple Music

Deezer

Yandex Music


About

A collection of additional Lavaplayer/Lavalink Sources

License:Apache License 2.0


Languages

Language:Java 100.0%