[youtube] Liked Music playlist support (closes #25175, closes #14001)

This commit is contained in:
morrah 2020-09-18 17:39:15 +03:00
parent 6e65a2a67e
commit 338467aa30
2 changed files with 24 additions and 1 deletions

View File

@ -1490,6 +1490,7 @@ from .youtube import (
YoutubeTruncatedURLIE, YoutubeTruncatedURLIE,
YoutubeUserIE, YoutubeUserIE,
YoutubeWatchLaterIE, YoutubeWatchLaterIE,
YoutubeLikedMusicIE,
) )
from .zapiks import ZapiksIE from .zapiks import ZapiksIE
from .zaq1 import Zaq1IE from .zaq1 import Zaq1IE

View File

@ -434,7 +434,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
(?!.*?\blist= (?!.*?\blist=
(?: (?:
%(playlist_id)s| # combined list/video URLs are handled by the playlist IE %(playlist_id)s| # combined list/video URLs are handled by the playlist IE
WL # WL are handled by the watch later IE WL| # WL are handled by the watch later IE
LM # LM are handled by the watch later IE
) )
) )
(?(1).+)? # if we found the ID, everything can follow (?(1).+)? # if we found the ID, everything can follow
@ -3347,6 +3348,27 @@ class YoutubeWatchLaterIE(YoutubePlaylistIE):
return playlist return playlist
class YoutubeLikedMusicIE(YoutubePlaylistIE):
IE_NAME = 'youtube:likedmusic'
IE_DESC = 'Youtube liked music list, ":ytlikedmusic" for short (requires authentication)'
_VALID_URL = r'https?://(?:www\.)?youtube\.com/((?:playlist|watch)\?(?:.+&)?list=LM)|:ytlikedmusic'
_TESTS = [{
'url': 'https://www.youtube.com/playlist?list=LM',
'only_matching': True,
}, {
'url': 'https://www.youtube.com/watch?v=j2DgYtvDW3I&index=1&list=LM',
'only_matching': True,
}]
def _real_extract(self, url):
_, video = self._check_download_just_video(url, 'LM')
if video:
return video
_, playlist = self._extract_playlist('LM')
return playlist
class YoutubeFavouritesIE(YoutubeBaseInfoExtractor): class YoutubeFavouritesIE(YoutubeBaseInfoExtractor):
IE_NAME = 'youtube:favorites' IE_NAME = 'youtube:favorites'
IE_DESC = 'YouTube.com favourite videos, ":ytfav" for short (requires authentication)' IE_DESC = 'YouTube.com favourite videos, ":ytfav" for short (requires authentication)'