Skip to content

Commit 7aec38a

Browse files
Fix Playlist Loading for ANDROID and IOS Clients; Remove Deprecated Clients (#82)
* chore: update `CLIENT_VERSION` for client `ANDROID` * chore: remove `ANDROID_LITE`, `ANDROID_TESTSUITE` and `MEDIA_CONNECT` due to its broken * fix: playlist name extraction[`ANDROID`] * fix: playlist name extraction[`ANDROID_VR`] * fix: playlist name extraction[`IOS`] * chore: update `CLIENT_VERSION` and `USER_AGENT` for `IOS` client * chore: update `CLIENT_VERSION` for `ANDROID_VR` client * chore: update `CLIENT_VERSION` for `ANDROID_MUSIC` client * chore: update `CLIENT_VERSION` for `WEB_EMBEDDED_PLAYER` client * chore: update `CLIENT_VERSION` for `WEB_REMIX` client * chore: update default clients --------- Co-authored-by: devoxin <[email protected]>
1 parent 48abb60 commit 7aec38a

File tree

16 files changed

+48
-276
lines changed

16 files changed

+48
-276
lines changed

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,11 @@ Currently, the following clients are available for use:
193193
- ❌ No mix/playlist/search support.
194194
- `ANDROID`
195195
- ❌ Heavily restricted, frequently dysfunctional.
196-
- `ANDROID_TESTSUITE`
197-
- ✔ Opus formats.
198-
- ❌ No mix/playlist/livestream support.
199196
- `ANDROID_MUSIC`
200197
- ✔ Opus formats.
201198
- ❌ No playlist/livestream support.
202199
- `ANDROID_VR`
203200
- ✔ Opus formats.
204-
- `MEDIA_CONNECT`
205-
- ❌ No Opus formats (requires transcoding).
206-
- ❌ No mix/playlist/search support.
207201
- `IOS`
208202
- ❌ No Opus formats (requires transcoding).
209203
- `TVHTML5EMBEDDED`

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public YoutubeAudioSourceManager(boolean allowSearch) {
7979

8080
public YoutubeAudioSourceManager(boolean allowSearch, boolean allowDirectVideoIds, boolean allowDirectPlaylistIds) {
8181
// query order: music -> web -> androidtestsuite -> tvhtml5embedded
82-
this(allowSearch, allowDirectVideoIds, allowDirectPlaylistIds, new Music(), new Web(), new AndroidTestsuite(), new TvHtml5Embedded());
82+
this(allowSearch, allowDirectVideoIds, allowDirectPlaylistIds, new Music(), new AndroidVr(), new Web(), new WebEmbedded());
8383
}
8484

8585
/**

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package dev.lavalink.youtube.clients;
22

3+
import com.sedmelluq.discord.lavaplayer.tools.JsonBrowser;
34
import com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface;
45
import dev.lavalink.youtube.clients.ClientConfig.AndroidVersion;
56
import dev.lavalink.youtube.clients.skeleton.StreamingNonMusicClient;
@@ -10,7 +11,7 @@
1011
public class Android extends StreamingNonMusicClient {
1112
private static final Logger log = LoggerFactory.getLogger(Android.class);
1213

13-
public static String CLIENT_VERSION = "19.07.39";
14+
public static String CLIENT_VERSION = "19.44.38";
1415
public static AndroidVersion ANDROID_VERSION = AndroidVersion.ANDROID_11;
1516

1617
public static ClientConfig BASE_CONFIG = new ClientConfig()
@@ -62,4 +63,25 @@ public ClientOptions getOptions() {
6263
public String getIdentifier() {
6364
return BASE_CONFIG.getName();
6465
}
66+
67+
@Override
68+
@NotNull
69+
protected String extractPlaylistName(@NotNull JsonBrowser json) {
70+
return json.get("header")
71+
.get("pageHeaderRenderer")
72+
.get("content")
73+
.get("elementRenderer")
74+
.get("newElement")
75+
.get("type")
76+
.get("componentType")
77+
.get("model")
78+
.get("youtubeModel")
79+
.get("viewModel")
80+
.get("pageHeaderViewModel")
81+
.get("title")
82+
.get("dynamicTextViewModel")
83+
.get("text")
84+
.get("content")
85+
.text();
86+
}
6587
}

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

Lines changed: 0 additions & 67 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
public class AndroidMusic extends Android {
2121
private static final Logger log = LoggerFactory.getLogger(AndroidMusic.class);
22-
public static String CLIENT_VERSION = "7.11.50";
22+
public static String CLIENT_VERSION = "7.27.52";
2323

2424
public static ClientConfig BASE_CONFIG = new ClientConfig()
2525
.withApiKey(Android.BASE_CONFIG.getApiKey())

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

Lines changed: 0 additions & 70 deletions
This file was deleted.

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package dev.lavalink.youtube.clients;
22

3+
import com.sedmelluq.discord.lavaplayer.tools.JsonBrowser;
34
import com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface;
45
import dev.lavalink.youtube.clients.ClientConfig.AndroidVersion;
56
import org.jetbrains.annotations.NotNull;
67

78
public class AndroidVr extends Android {
8-
public static String CLIENT_VERSION = "1.60.18";
9+
public static String CLIENT_VERSION = "1.60.19";
910
public static AndroidVersion ANDROID_VERSION = AndroidVersion.ANDROID_12L;
1011

1112
public static ClientConfig BASE_CONFIG = new ClientConfig()
@@ -36,4 +37,10 @@ protected ClientConfig getBaseClientConfig(@NotNull HttpInterface httpInterface)
3637
public String getIdentifier() {
3738
return BASE_CONFIG.getName();
3839
}
40+
41+
@Override
42+
@NotNull
43+
protected String extractPlaylistName(@NotNull JsonBrowser json) {
44+
return json.get("header").get("playlistHeaderRenderer").get("title").get("runs").index(0).get("text").text();
45+
}
3946
}

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

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

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

1111
public static ClientConfig BASE_CONFIG = new ClientConfig()
1212
.withApiKey("AIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc")
13-
.withUserAgent(String.format("com.google.ios.youtube/%s (iPhone14,5; U; CPU iOS 15_6 like Mac OS X)", CLIENT_VERSION))
13+
.withUserAgent(String.format("com.google.ios.youtube/%s (iPhone16,2; U; CPU iOS 18_1_0 like Mac OS X;)", CLIENT_VERSION))
1414
.withClientName("IOS")
1515
.withClientField("clientVersion", CLIENT_VERSION)
1616
.withUserField("lockedSafetyMode", false);
@@ -49,6 +49,15 @@ protected JsonBrowser extractPlaylistVideoList(@NotNull JsonBrowser json) {
4949
.get("playlistVideoListRenderer");
5050
}
5151

52+
@Override
53+
@NotNull
54+
protected String extractPlaylistName(@NotNull JsonBrowser json) {
55+
return json.get("header")
56+
.get("pageHeaderRenderer")
57+
.get("pageTitle")
58+
.text();
59+
}
60+
5261
@Override
5362
@NotNull
5463
public String getPlayerParams() {

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

Lines changed: 0 additions & 75 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class Music extends MusicClient {
88
public static ClientConfig BASE_CONFIG = new ClientConfig()
99
.withApiKey("AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30") // Requires header (Referer music.youtube.com)
1010
.withClientName("WEB_REMIX")
11-
.withClientField("clientVersion", "1.20240401.00.00");
11+
.withClientField("clientVersion", "1.20240724.00.00");
1212

1313
protected ClientOptions options;
1414

0 commit comments

Comments
 (0)