Replace explicit string checks whether a playlist íd is a certain YouTube Mix type with calling the dedicated methods
This commit is contained in:
parent
3033c0b993
commit
d9e2da53c3
|
@ -226,20 +226,20 @@ public class YoutubeParsingHelper {
|
|||
* @throws ParsingException If the playlistId is a Channel Mix or not a mix.
|
||||
*/
|
||||
public static String extractVideoIdFromMixId(final String playlistId) throws ParsingException {
|
||||
if (playlistId.startsWith("RDMM")) { //My Mix
|
||||
if (playlistId.startsWith("RDMM")) { // My Mix
|
||||
return playlistId.substring(4);
|
||||
|
||||
} else if (playlistId.startsWith("RDAMVM") || playlistId.startsWith("RDCLAK")) { //Music mix
|
||||
} else if (isYoutubeMusicMixId(playlistId)) { // starts with "RDAMVM" or "RDCLAK"
|
||||
return playlistId.substring(6);
|
||||
|
||||
} else if (playlistId.startsWith("RMCM")) { //Channel mix
|
||||
//Channel mix are build with RMCM{channelId}, so videoId can't be determined
|
||||
} else if (isYoutubeChannelMixId(playlistId)) { // starts with "RMCM"
|
||||
// Channel mix are build with RMCM{channelId}, so videoId can't be determined
|
||||
throw new ParsingException("Video id could not be determined from mix id: " + playlistId);
|
||||
|
||||
} else if (playlistId.startsWith("RD")) { // Normal mix
|
||||
} else if (isYoutubeMixId(playlistId)) { // normal mix, starts with "RD"
|
||||
return playlistId.substring(2);
|
||||
|
||||
} else { //not a mix
|
||||
} else { // not a mix
|
||||
throw new ParsingException("Video id could not be determined from mix id: " + playlistId);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue