Skip to content

Commit 43414e3

Browse files
committed
Update client versions, don't print client error message twice.
1 parent 9d4dbee commit 43414e3

5 files changed

Lines changed: 97 additions & 6 deletions

File tree

common/src/main/java/dev/lavalink/youtube/ClientException.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public String getFormattedMessage() {
3434

3535
// Recursively iterate down the causes to our stored exceptions
3636
private void writeException(@NotNull PrintWriter printer, @NotNull Throwable throwable, int maxDepth) {
37-
printer.print(throwable.getMessage());
3837
StackTraceElement[] stackTrace = throwable.getStackTrace();
3938

4039
for (int i = 0; i < Math.min(5, stackTrace.length); i++) {

common/src/main/java/dev/lavalink/youtube/clients/Ios.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
import org.jetbrains.annotations.NotNull;
77

88
public class Ios extends StreamingNonMusicClient {
9-
public static String CLIENT_VERSION = "19.45.4";
9+
public static String CLIENT_VERSION = "21.02.3";
1010

1111
public static ClientConfig BASE_CONFIG = new ClientConfig()
12-
.withUserAgent(String.format("com.google.ios.youtube/%s (iPhone16,2; U; CPU iOS 18_1_0 like Mac OS X;)", CLIENT_VERSION))
12+
.withUserAgent(String.format("com.google.ios.youtube/%s (iPhone16,2; U; CPU iOS 18_3_2 like Mac OS X;)", CLIENT_VERSION))
1313
.withClientName("IOS")
1414
.withClientField("clientVersion", CLIENT_VERSION)
1515
.withUserField("lockedSafetyMode", false);

common/src/main/java/dev/lavalink/youtube/clients/MWeb.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
public class MWeb extends Web {
1818
public static ClientConfig BASE_CONFIG = new ClientConfig()
1919
.withClientName("MWEB")
20-
.withClientField("clientVersion", "2.20240726.11.00");
20+
.withClientField("clientVersion", "2.20260115.01.00")
21+
.withUserAgent("Mozilla/5.0 (iPad; CPU OS 16_7_10 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1,gzip(gfe)");
2122

2223
public MWeb() {
2324
super();

common/src/main/java/dev/lavalink/youtube/clients/Tv.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
public class Tv extends StreamingNonMusicClient {
1616
public static ClientConfig BASE_CONFIG = new ClientConfig()
1717
.withClientName("TVHTML5")
18-
.withUserAgent("Mozilla/5.0 (ChromiumStylePlatform) Cobalt/Version")
19-
.withClientField("clientVersion", "7.20250319.10.00");
18+
.withUserAgent("Mozilla/5.0 (ChromiumStylePlatform) Cobalt/25.lts.30.1034943-gold (unlike Gecko), Unknown_TV_Unknown_0/Unknown (Unknown, Unknown)")
19+
.withClientField("clientVersion", "7.20260114.12.00");
2020

2121
protected ClientOptions options;
2222

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
package dev.lavalink.youtube.clients;
2+
3+
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
4+
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException.Severity;
5+
import com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface;
6+
import com.sedmelluq.discord.lavaplayer.track.AudioItem;
7+
import dev.lavalink.youtube.CannotBeLoaded;
8+
import dev.lavalink.youtube.YoutubeAudioSourceManager;
9+
import dev.lavalink.youtube.clients.skeleton.StreamingNonMusicClient;
10+
import org.jetbrains.annotations.NotNull;
11+
import org.jetbrains.annotations.Nullable;
12+
13+
import java.io.IOException;
14+
15+
public class TvDowngraded extends StreamingNonMusicClient {
16+
public static ClientConfig BASE_CONFIG = new ClientConfig()
17+
.withClientName("TVHTML5")
18+
.withUserAgent("Mozilla/5.0 (ChromiumStylePlatform) Cobalt/Version")
19+
.withClientField("clientVersion", "5.20260114");
20+
21+
protected ClientOptions options;
22+
23+
public TvDowngraded() {
24+
this(ClientOptions.DEFAULT);
25+
}
26+
27+
public TvDowngraded(@NotNull ClientOptions options) {
28+
this.options = options;
29+
}
30+
31+
@Override
32+
@NotNull
33+
protected ClientConfig getBaseClientConfig(@NotNull HttpInterface httpInterface) {
34+
return BASE_CONFIG.copy();
35+
}
36+
37+
@Override
38+
@NotNull
39+
public String getPlayerParams() {
40+
return WEB_PLAYER_PARAMS;
41+
}
42+
43+
@Override
44+
@NotNull
45+
public ClientOptions getOptions() {
46+
return this.options;
47+
}
48+
49+
@Override
50+
public boolean canHandleRequest(@NotNull String identifier) {
51+
return false;
52+
}
53+
54+
@Override
55+
public boolean supportsOAuth() {
56+
return true;
57+
}
58+
59+
@Override
60+
@NotNull
61+
public String getIdentifier() {
62+
return BASE_CONFIG.getName();
63+
}
64+
65+
@Override
66+
public AudioItem loadPlaylist(@NotNull YoutubeAudioSourceManager source,
67+
@NotNull HttpInterface httpInterface,
68+
@NotNull String playlistId,
69+
@Nullable String selectedVideoId) {
70+
throw new FriendlyException("This client cannot load playlists", Severity.COMMON,
71+
new RuntimeException("TVHTML5 cannot be used to load playlists"));
72+
}
73+
74+
@Override
75+
public AudioItem loadVideo(@NotNull YoutubeAudioSourceManager source, @NotNull HttpInterface httpInterface, @NotNull String videoId) throws CannotBeLoaded, IOException {
76+
throw new FriendlyException("This client cannot load videos", Severity.COMMON,
77+
new RuntimeException("TVHTML5 cannot be used to load videos"));
78+
}
79+
80+
@Override
81+
public AudioItem loadMix(@NotNull YoutubeAudioSourceManager source, @NotNull HttpInterface httpInterface, @NotNull String mixId, @Nullable String selectedVideoId) {
82+
throw new FriendlyException("This client cannot load mixes", Severity.COMMON,
83+
new RuntimeException("TVHTML5 cannot be used to load mixes"));
84+
}
85+
86+
@Override
87+
public AudioItem loadSearch(@NotNull YoutubeAudioSourceManager source, @NotNull HttpInterface httpInterface, @NotNull String searchQuery) {
88+
throw new FriendlyException("This client cannot search", Severity.COMMON,
89+
new RuntimeException("TVHTML5 cannot be used to search"));
90+
}
91+
}

0 commit comments

Comments
 (0)