mirror of
https://github.com/TeamNewPipe/NewPipeExtractor
synced 2024-12-12 11:59:45 +01:00
[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
|
@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 New Issue
Block a user