-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
106 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
package dev.lavalink.youtube.clients; | ||
|
||
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException; | ||
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException.Severity; | ||
import com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface; | ||
import com.sedmelluq.discord.lavaplayer.track.AudioItem; | ||
import dev.lavalink.youtube.CannotBeLoaded; | ||
import dev.lavalink.youtube.YoutubeAudioSourceManager; | ||
import dev.lavalink.youtube.clients.skeleton.StreamingNonMusicClient; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.io.IOException; | ||
|
||
public class Tv extends StreamingNonMusicClient { | ||
public static ClientConfig BASE_CONFIG = new ClientConfig() | ||
.withApiKey("AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8") | ||
.withClientName("TVHTML5") | ||
.withClientField("clientVersion", "7.20240724.13.00"); | ||
|
||
protected ClientOptions options; | ||
|
||
public Tv() { | ||
this(ClientOptions.DEFAULT); | ||
} | ||
|
||
public Tv(@NotNull ClientOptions options) { | ||
this.options = options; | ||
} | ||
|
||
@Override | ||
@NotNull | ||
protected ClientConfig getBaseClientConfig(@NotNull HttpInterface httpInterface) { | ||
return BASE_CONFIG.copy(); | ||
} | ||
|
||
@Override | ||
@NotNull | ||
public String getPlayerParams() { | ||
return WEB_PLAYER_PARAMS; | ||
} | ||
|
||
@Override | ||
@NotNull | ||
public ClientOptions getOptions() { | ||
return this.options; | ||
} | ||
|
||
@Override | ||
public boolean canHandleRequest(@NotNull String identifier) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean supportsOAuth() { | ||
return true; | ||
} | ||
|
||
@Override | ||
@NotNull | ||
public String getIdentifier() { | ||
return BASE_CONFIG.getName(); | ||
} | ||
|
||
@Override | ||
public AudioItem loadPlaylist(@NotNull YoutubeAudioSourceManager source, | ||
@NotNull HttpInterface httpInterface, | ||
@NotNull String playlistId, | ||
@Nullable String selectedVideoId) { | ||
throw new FriendlyException("This client cannot load playlists", Severity.COMMON, | ||
new RuntimeException("TVHTML5 cannot be used to load playlists")); | ||
} | ||
|
||
@Override | ||
public AudioItem loadVideo(@NotNull YoutubeAudioSourceManager source, @NotNull HttpInterface httpInterface, @NotNull String videoId) throws CannotBeLoaded, IOException { | ||
throw new FriendlyException("This client cannot load videos", Severity.COMMON, | ||
new RuntimeException("TVHTML5 cannot be used to load videos")); | ||
} | ||
|
||
@Override | ||
public AudioItem loadMix(@NotNull YoutubeAudioSourceManager source, @NotNull HttpInterface httpInterface, @NotNull String mixId, @Nullable String selectedVideoId) { | ||
throw new FriendlyException("This client cannot load mixes", Severity.COMMON, | ||
new RuntimeException("TVHTML5 cannot be used to load mixes")); | ||
} | ||
|
||
@Override | ||
public AudioItem loadSearch(@NotNull YoutubeAudioSourceManager source, @NotNull HttpInterface httpInterface, @NotNull String searchQuery) { | ||
throw new FriendlyException("This client cannot search", Severity.COMMON, | ||
new RuntimeException("TVHTML5 cannot be used to search")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters