Class NonMusicClient

java.lang.Object
dev.lavalink.youtube.clients.skeleton.NonMusicClient
All Implemented Interfaces:
Client
Direct Known Subclasses:
StreamingNonMusicClient

public abstract class NonMusicClient extends Object implements Client
The base class for a client that is used for everything except music.youtube.com.
  • Field Details

    • WEB_PLAYER_PARAMS

      protected static String WEB_PLAYER_PARAMS
    • MOBILE_PLAYER_PARAMS

      protected static String MOBILE_PLAYER_PARAMS
    • playlistPageCount

      protected int playlistPageCount
  • Constructor Details

    • NonMusicClient

      public NonMusicClient()
  • Method Details

    • getBaseClientConfig

      @NotNull protected abstract @NotNull ClientConfig getBaseClientConfig(@NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface)
      Retrieves a base client config payload to be used for requests.
      Parameters:
      httpInterface - The HTTP interface to use for fetching a config, if applicable.
      Returns:
      A client configuration.
    • loadJsonResponse

      @NotNull protected @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser loadJsonResponse(@NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull @NotNull org.apache.http.client.methods.HttpPost request, @NotNull @NotNull String context) throws IOException
      Throws:
      IOException
    • loadTrackInfoFromInnertube

      @NotNull protected @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser loadTrackInfoFromInnertube(@NotNull @NotNull YoutubeAudioSourceManager source, @NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull @NotNull String videoId, @Nullable @Nullable Client.PlayabilityStatus status) throws CannotBeLoaded, IOException
      Throws:
      CannotBeLoaded
      IOException
    • loadTrackInfoFromInnertube

      @NotNull protected @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser loadTrackInfoFromInnertube(@NotNull @NotNull YoutubeAudioSourceManager source, @NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull @NotNull String videoId, @Nullable @Nullable Client.PlayabilityStatus status, boolean validatePlayabilityStatus) throws CannotBeLoaded, IOException
      Retrieve raw JSON data for a specific video by its ID.
      Parameters:
      source - The source manager linked to this client.
      httpInterface - The interface to use for HTTP requests.
      videoId - The ID of the video to retrieve information for.
      status - The last playability status, or null if an attempt to retrieve information has not been made yet.
      validatePlayabilityStatus - Whether to validate playability status. This may be false in situations where only video metadata is required. If video data does not exist, this is forcefully checked regardless of provided value.
      Returns:
      The raw JSON data as received from YouTube.
      Throws:
      CannotBeLoaded - If a video does not exist, is private, or otherwise inaccessible.
      IOException - If a HTTP request fails, etc.
    • loadSearchResults

      @NotNull protected @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser loadSearchResults(@NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull @NotNull String searchQuery)
    • extractSearchResults

      @NotNull protected @NotNull List<com.sedmelluq.discord.lavaplayer.track.AudioTrack> extractSearchResults(@NotNull @NotNull YoutubeAudioSourceManager source, @NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser json)
    • loadMixResult

      @NotNull protected @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser loadMixResult(@NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull @NotNull String mixId, @Nullable @Nullable String selectedVideoId)
    • extractMixPlaylistData

      @NotNull protected @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser extractMixPlaylistData(@NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser json)
    • loadPlaylistResult

      @NotNull protected @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser loadPlaylistResult(@NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull @NotNull String playlistId)
    • extractPlaylistError

      @Nullable protected @Nullable String extractPlaylistError(@NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser json)
    • extractPlaylistName

      @Nullable protected @Nullable String extractPlaylistName(@NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser json)
    • extractPlaylistVideoList

      @NotNull protected @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser extractPlaylistVideoList(@NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser json)
    • extractPlaylistContinuationToken

      @Nullable protected @Nullable String extractPlaylistContinuationToken(@NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser videoList)
    • extractPlaylistContinuationVideos

      @NotNull protected @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser extractPlaylistContinuationVideos(@NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser continuationJson)
    • extractPlaylistTracks

      protected void extractPlaylistTracks(@NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser json, @NotNull @NotNull List<com.sedmelluq.discord.lavaplayer.track.AudioTrack> tracks, @NotNull @NotNull YoutubeAudioSourceManager source)
    • extractAudioTrack

      @Nullable protected @Nullable com.sedmelluq.discord.lavaplayer.track.AudioTrack extractAudioTrack(@NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser json, @NotNull @NotNull YoutubeAudioSourceManager source)
    • canHandleRequest

      public boolean canHandleRequest(@NotNull @NotNull String identifier)
      Description copied from interface: Client
      Returns a boolean determining whether this client can be used to handle requests for the given identifier.
      Specified by:
      canHandleRequest in interface Client
      Parameters:
      identifier - The resource identifier. Could be an arbitrary string or a URL.
      Returns:
      True, if this client can handle the request.
    • setPlaylistPageCount

      public void setPlaylistPageCount(int playlistPageCount)
      Specified by:
      setPlaylistPageCount in interface Client
    • loadVideo

      public com.sedmelluq.discord.lavaplayer.track.AudioItem loadVideo(@NotNull @NotNull YoutubeAudioSourceManager source, @NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull @NotNull String videoId) throws CannotBeLoaded, IOException
      Description copied from interface: Client
      Loads a single video.
      Specified by:
      loadVideo in interface Client
      Parameters:
      source - The source manager responsible for this client.
      httpInterface - The interface to use for requests.
      videoId - The ID of the video to load.
      Returns:
      An AudioItem.
      Throws:
      CannotBeLoaded - If a video doesn't exist etc.
      IOException
    • loadSearch

      public com.sedmelluq.discord.lavaplayer.track.AudioItem loadSearch(@NotNull @NotNull YoutubeAudioSourceManager source, @NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull @NotNull String searchQuery)
      Description copied from interface: Client
      Loads search results for a query.
      Specified by:
      loadSearch in interface Client
      Parameters:
      source - The source manager responsible for this client.
      httpInterface - The interface to use for requests.
      searchQuery - The search query.
      Returns:
      An AudioItem.
    • loadMix

      public com.sedmelluq.discord.lavaplayer.track.AudioItem loadMix(@NotNull @NotNull YoutubeAudioSourceManager source, @NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull @NotNull String mixId, @Nullable @Nullable String selectedVideoId)
      Description copied from interface: Client
      Loads a mix playlist.
      Specified by:
      loadMix in interface Client
      Parameters:
      source - The source manager responsible for this client.
      httpInterface - The interface to use for requests.
      mixId - The ID of the mix.
      Returns:
      An AudioItem.
    • loadPlaylist

      public com.sedmelluq.discord.lavaplayer.track.AudioItem loadPlaylist(@NotNull @NotNull YoutubeAudioSourceManager source, @NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull @NotNull String playlistId, @Nullable @Nullable String selectedVideoId)
      Description copied from interface: Client
      Loads a playlist.
      Specified by:
      loadPlaylist in interface Client
      Parameters:
      source - The source manager responsible for this client.
      httpInterface - The interface to use for requests.
      playlistId - The ID of the playlist.
      Returns:
      An AudioItem.
    • loadSearchMusic

      public com.sedmelluq.discord.lavaplayer.track.AudioItem loadSearchMusic(@NotNull @NotNull YoutubeAudioSourceManager source, @NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull @NotNull String searchQuery)
      Description copied from interface: Client
      Loads search results for a query.
      Specified by:
      loadSearchMusic in interface Client
      Parameters:
      source - The source manager responsible for this client.
      httpInterface - The interface to use for requests.
      searchQuery - The search query.
      Returns:
      An AudioItem.