From 3033c0b99334489a64c78e042bde3443073f4341 Mon Sep 17 00:00:00 2001 From: TobiGr Date: Wed, 23 Dec 2020 21:07:30 +0100 Subject: [PATCH] [YouTube] Music Mix: Fix playlist not being accepted Regression introduced by YouTube Mix support (#280) --- .../extractor/services/youtube/YoutubeParsingHelper.java | 6 +++--- .../newpipe/extractor/services/youtube/YoutubeService.java | 3 ++- .../linkHandler/YoutubePlaylistLinkHandlerFactory.java | 5 ----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java index 05749bbdb..48589cc33 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java @@ -205,12 +205,12 @@ public class YoutubeParsingHelper { /** * 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 * @return Whether given id belongs to a YouTube Music Mix */ 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) @@ -229,7 +229,7 @@ public class YoutubeParsingHelper { if (playlistId.startsWith("RDMM")) { //My Mix 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); } else if (playlistId.startsWith("RMCM")) { //Channel mix diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeService.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeService.java index 997fd0b73..6e7ab7407 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeService.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeService.java @@ -111,7 +111,8 @@ public class YoutubeService extends StreamingService { @Override 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); } else { return new YoutubePlaylistExtractor(this, linkHandler); diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/linkHandler/YoutubePlaylistLinkHandlerFactory.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/linkHandler/YoutubePlaylistLinkHandlerFactory.java index aa2908e64..74b8f91f9 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/linkHandler/YoutubePlaylistLinkHandlerFactory.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/linkHandler/YoutubePlaylistLinkHandlerFactory.java @@ -52,11 +52,6 @@ public class YoutubePlaylistLinkHandlerFactory extends ListLinkHandlerFactory { "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) && Utils.getQueryValue(urlObj, "v") == null) { //Video id can't be determined from the channel mix id. See YoutubeParsingHelper#extractVideoIdFromMixId