diff options
author | Sergey M. <dstftw@gmail.com> | 2014-02-24 12:51:06 +0700 |
---|---|---|
committer | Sergey M. <dstftw@gmail.com> | 2014-02-24 12:52:02 +0700 |
commit | a2dafe2887acc745b70eff811a2932098048cd64 (patch) | |
tree | d941759736832ec33866d398ff0d85dd30b18f78 /youtube_dl/extractor | |
parent | 92661c994b4f01bb39204d05652f57e7f6491579 (diff) |
[youtube] Fix mix video regex
Attributes' order in <li> is arbitrary and changes every time playlist
page is fetched, so we can't rely on `data-index` to be before
`data-video-username`.
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r-- | youtube_dl/extractor/youtube.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py index f868b1929..f65052a89 100644 --- a/youtube_dl/extractor/youtube.py +++ b/youtube_dl/extractor/youtube.py @@ -1492,11 +1492,10 @@ class YoutubePlaylistIE(YoutubeBaseInfoExtractor): title_span = (search_title('playlist-title') or search_title('title long-title') or search_title('title')) title = clean_html(title_span) - video_re = r'''(?x)data-index="\d+".*? - data-video-username="(.*?)".*? + video_re = r'''(?x)data-video-username="(.*?)".*? href="/watch\?v=([0-9A-Za-z_-]{11})&[^"]*?list=%s''' % re.escape(playlist_id) matches = orderedSet(re.findall(video_re, webpage, flags=re.DOTALL)) - # Some of the videos may have beend deleted, their username field is empty + # Some of the videos may have been deleted, their username field is empty ids = [video_id for (username, video_id) in matches if username] url_results = self._ids_to_results(ids) |