[YouTube] Deduplicate code extracting video id from mix id
This commit is contained in:
parent
8f9d5b858e
commit
f19660e7d9
1 changed files with 3 additions and 13 deletions
|
@ -232,19 +232,9 @@ public class YoutubeMixPlaylistExtractor extends PlaylistExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private String getThumbnailUrlFromPlaylistId(@Nonnull final String playlistId) throws ParsingException {
|
private String getThumbnailUrlFromPlaylistId(@Nonnull final String playlistId)
|
||||||
final String videoId;
|
throws ParsingException {
|
||||||
if (isYoutubeMyMixId(playlistId)) {
|
return getThumbnailUrlFromVideoId(YoutubeParsingHelper.extractVideoIdFromMixId(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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
|
Loading…
Reference in a new issue