[YouTube] Deduplicate code extracting video id from mix id
This commit is contained in:
parent
8f9d5b858e
commit
f19660e7d9
|
@ -232,19 +232,9 @@ public class YoutubeMixPlaylistExtractor extends PlaylistExtractor {
|
|||
}
|
||||
|
||||
@Nonnull
|
||||
private String getThumbnailUrlFromPlaylistId(@Nonnull final String playlistId) throws ParsingException {
|
||||
final String videoId;
|
||||
if (isYoutubeMyMixId(playlistId)) {
|
||||
videoId = playlistId.substring(4);
|
||||
} else if (isYoutubeChannelMixId(playlistId)) {
|
||||
throw new ParsingException("This playlist is a channel mix");
|
||||
} else {
|
||||
videoId = playlistId.substring(2);
|
||||
}
|
||||
if (videoId.isEmpty()) {
|
||||
throw new ParsingException("videoId is empty");
|
||||
}
|
||||
return getThumbnailUrlFromVideoId(videoId);
|
||||
private String getThumbnailUrlFromPlaylistId(@Nonnull final String playlistId)
|
||||
throws ParsingException {
|
||||
return getThumbnailUrlFromVideoId(YoutubeParsingHelper.extractVideoIdFromMixId(playlistId));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
|
Loading…
Reference in New Issue