Commit d9e2da53 authored by TobiGr's avatar TobiGr
Browse files

Replace explicit string checks whether a playlist íd is a certain YouTube Mix...

Replace explicit string checks whether a playlist íd is a certain YouTube Mix type with calling the dedicated methods
parent 3033c0b9
......@@ -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);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment