mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-20 12:24:57 +00:00
[youtube:playlist] PEP8
This commit is contained in:
parent
61edcfb0a2
commit
c9cc0bf57b
@ -1055,21 +1055,26 @@ class YoutubePlaylistIE(YoutubeBaseInfoExtractor):
|
|||||||
self._login()
|
self._login()
|
||||||
|
|
||||||
def _ids_to_results(self, ids):
|
def _ids_to_results(self, ids):
|
||||||
return [self.url_result(vid_id, 'Youtube', video_id=vid_id)
|
return [
|
||||||
for vid_id in ids]
|
self.url_result(vid_id, 'Youtube', video_id=vid_id)
|
||||||
|
for vid_id in ids]
|
||||||
|
|
||||||
def _extract_mix(self, playlist_id):
|
def _extract_mix(self, playlist_id):
|
||||||
# The mixes are generated from a a single video
|
# The mixes are generated from a a single video
|
||||||
# the id of the playlist is just 'RD' + video_id
|
# the id of the playlist is just 'RD' + video_id
|
||||||
url = 'https://youtube.com/watch?v=%s&list=%s' % (playlist_id[-11:], playlist_id)
|
url = 'https://youtube.com/watch?v=%s&list=%s' % (playlist_id[-11:], playlist_id)
|
||||||
webpage = self._download_webpage(url, playlist_id, u'Downloading Youtube mix')
|
webpage = self._download_webpage(
|
||||||
|
url, playlist_id, u'Downloading Youtube mix')
|
||||||
search_title = lambda class_name: get_element_by_attribute('class', class_name, webpage)
|
search_title = lambda class_name: get_element_by_attribute('class', class_name, webpage)
|
||||||
title_span = (search_title('playlist-title') or
|
title_span = (
|
||||||
search_title('title long-title') or search_title('title'))
|
search_title('playlist-title') or
|
||||||
|
search_title('title long-title') or
|
||||||
|
search_title('title'))
|
||||||
title = clean_html(title_span)
|
title = clean_html(title_span)
|
||||||
video_re = r'''(?x)data-video-username=".*?".*?
|
ids = orderedSet(re.findall(
|
||||||
href="/watch\?v=([0-9A-Za-z_-]{11})&[^"]*?list=%s''' % re.escape(playlist_id)
|
r'''(?xs)data-video-username=".*?".*?
|
||||||
ids = orderedSet(re.findall(video_re, webpage, flags=re.DOTALL))
|
href="/watch\?v=([0-9A-Za-z_-]{11})&[^"]*?list=%s''' % re.escape(playlist_id),
|
||||||
|
webpage))
|
||||||
url_results = self._ids_to_results(ids)
|
url_results = self._ids_to_results(ids)
|
||||||
|
|
||||||
return self.playlist_result(url_results, playlist_id, title)
|
return self.playlist_result(url_results, playlist_id, title)
|
||||||
@ -1162,6 +1167,7 @@ class YoutubeTopListIE(YoutubePlaylistIE):
|
|||||||
msg = u'Downloading Youtube mix'
|
msg = u'Downloading Youtube mix'
|
||||||
if i > 0:
|
if i > 0:
|
||||||
msg += ', retry #%d' % i
|
msg += ', retry #%d' % i
|
||||||
|
|
||||||
webpage = self._download_webpage(url, title, msg)
|
webpage = self._download_webpage(url, title, msg)
|
||||||
ids = orderedSet(re.findall(video_re, webpage))
|
ids = orderedSet(re.findall(video_re, webpage))
|
||||||
if ids:
|
if ids:
|
||||||
|
Loading…
Reference in New Issue
Block a user