[YouTube] Music Mix: Fix playlist not being accepted

Regression introduced by YouTube Mix support (#280)
This commit is contained in:
TobiGr 2020-12-23 21:07:30 +01:00
parent b62144b49d
commit 3033c0b993
3 changed files with 5 additions and 9 deletions

View File

@ -205,12 +205,12 @@ public class YoutubeParsingHelper {
/** /**
* Checks if the given playlist id is a YouTube Music Mix (auto-generated playlist) * Checks if the given playlist id is a YouTube Music Mix (auto-generated playlist)
* Ids from a YouTube Music Mix start with "RDAMVM" * Ids from a YouTube Music Mix start with "RDAMVM" or "RDCLAK"
* @param playlistId * @param playlistId
* @return Whether given id belongs to a YouTube Music Mix * @return Whether given id belongs to a YouTube Music Mix
*/ */
public static boolean isYoutubeMusicMixId(final String playlistId) { public static boolean isYoutubeMusicMixId(final String playlistId) {
return playlistId.startsWith("RDAMVM"); return playlistId.startsWith("RDAMVM") || playlistId.startsWith("RDCLAK");
} }
/** /**
* Checks if the given playlist id is a YouTube Channel Mix (auto-generated playlist) * Checks if the given playlist id is a YouTube Channel Mix (auto-generated playlist)
@ -229,7 +229,7 @@ public class YoutubeParsingHelper {
if (playlistId.startsWith("RDMM")) { //My Mix if (playlistId.startsWith("RDMM")) { //My Mix
return playlistId.substring(4); return playlistId.substring(4);
} else if (playlistId.startsWith("RDAMVM")) { //Music mix } else if (playlistId.startsWith("RDAMVM") || playlistId.startsWith("RDCLAK")) { //Music mix
return playlistId.substring(6); return playlistId.substring(6);
} else if (playlistId.startsWith("RMCM")) { //Channel mix } else if (playlistId.startsWith("RMCM")) { //Channel mix

View File

@ -111,7 +111,8 @@ public class YoutubeService extends StreamingService {
@Override @Override
public PlaylistExtractor getPlaylistExtractor(final ListLinkHandler linkHandler) { public PlaylistExtractor getPlaylistExtractor(final ListLinkHandler linkHandler) {
if (YoutubeParsingHelper.isYoutubeMixId(linkHandler.getId())) { if (YoutubeParsingHelper.isYoutubeMixId(linkHandler.getId())
&& !YoutubeParsingHelper.isYoutubeMusicMixId(linkHandler.getId())) {
return new YoutubeMixPlaylistExtractor(this, linkHandler); return new YoutubeMixPlaylistExtractor(this, linkHandler);
} else { } else {
return new YoutubePlaylistExtractor(this, linkHandler); return new YoutubePlaylistExtractor(this, linkHandler);

View File

@ -52,11 +52,6 @@ public class YoutubePlaylistLinkHandlerFactory extends ListLinkHandlerFactory {
"the list-ID given in the URL does not match the list pattern"); "the list-ID given in the URL does not match the list pattern");
} }
if (YoutubeParsingHelper.isYoutubeMusicMixId(listID)) {
throw new ContentNotSupportedException(
"YouTube Music Mix playlists are not yet supported");
}
if (YoutubeParsingHelper.isYoutubeChannelMixId(listID) if (YoutubeParsingHelper.isYoutubeChannelMixId(listID)
&& Utils.getQueryValue(urlObj, "v") == null) { && Utils.getQueryValue(urlObj, "v") == null) {
//Video id can't be determined from the channel mix id. See YoutubeParsingHelper#extractVideoIdFromMixId //Video id can't be determined from the channel mix id. See YoutubeParsingHelper#extractVideoIdFromMixId