[youtube:watchlater] Respect --no-playlist
This commit is contained in:
parent
bc7a9cd8fb
commit
ebf1b291d0
|
@ -1701,13 +1701,7 @@ class YoutubePlaylistIE(YoutubePlaylistBaseInfoExtractor):
|
||||||
|
|
||||||
return self.playlist_result(self._entries(page, playlist_id), playlist_id, playlist_title)
|
return self.playlist_result(self._entries(page, playlist_id), playlist_id, playlist_title)
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _check_download_just_video(self, url, playlist_id):
|
||||||
# Extract playlist id
|
|
||||||
mobj = re.match(self._VALID_URL, url)
|
|
||||||
if mobj is None:
|
|
||||||
raise ExtractorError('Invalid URL: %s' % url)
|
|
||||||
playlist_id = mobj.group(1) or mobj.group(2)
|
|
||||||
|
|
||||||
# Check if it's a video-specific URL
|
# Check if it's a video-specific URL
|
||||||
query_dict = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query)
|
query_dict = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query)
|
||||||
if 'v' in query_dict:
|
if 'v' in query_dict:
|
||||||
|
@ -1718,6 +1712,17 @@ class YoutubePlaylistIE(YoutubePlaylistBaseInfoExtractor):
|
||||||
else:
|
else:
|
||||||
self.to_screen('Downloading playlist %s - add --no-playlist to just download video %s' % (playlist_id, video_id))
|
self.to_screen('Downloading playlist %s - add --no-playlist to just download video %s' % (playlist_id, video_id))
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
# Extract playlist id
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
if mobj is None:
|
||||||
|
raise ExtractorError('Invalid URL: %s' % url)
|
||||||
|
playlist_id = mobj.group(1) or mobj.group(2)
|
||||||
|
|
||||||
|
video = self._check_download_just_video(url, playlist_id)
|
||||||
|
if video:
|
||||||
|
return video
|
||||||
|
|
||||||
if playlist_id.startswith('RD') or playlist_id.startswith('UL'):
|
if playlist_id.startswith('RD') or playlist_id.startswith('UL'):
|
||||||
# Mixes require a custom extraction process
|
# Mixes require a custom extraction process
|
||||||
return self._extract_mix(playlist_id)
|
return self._extract_mix(playlist_id)
|
||||||
|
@ -2037,6 +2042,9 @@ class YoutubeWatchLaterIE(YoutubePlaylistIE):
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
video = self._check_download_just_video(url, 'WL')
|
||||||
|
if video:
|
||||||
|
return video
|
||||||
return self._extract_playlist('WL')
|
return self._extract_playlist('WL')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue