diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2014-12-13 11:02:24 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2014-12-13 12:35:45 +0100 |
commit | 5e1912cfc102f457fb9cb2472fb93c973cb68732 (patch) | |
tree | 5e0dd6bdd0424cfbef75cdae180804b065352262 /youtube_dl/extractor/aol.py | |
parent | 293f0f39ce955b9aa8284d461a0444e27491c392 (diff) |
[5min] Remove helper method and modernize
Previously, other extractor would go call a private(!) helper method. Instead, just hardcode the 5min:video_id format - it's not if that would ever change.
Diffstat (limited to 'youtube_dl/extractor/aol.py')
-rw-r--r-- | youtube_dl/extractor/aol.py | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/youtube_dl/extractor/aol.py b/youtube_dl/extractor/aol.py index 47f8e4157..185ee3693 100644 --- a/youtube_dl/extractor/aol.py +++ b/youtube_dl/extractor/aol.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals import re from .common import InfoExtractor -from .fivemin import FiveMinIE class AolIE(InfoExtractor): @@ -42,31 +41,31 @@ class AolIE(InfoExtractor): def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) video_id = mobj.group('id') - playlist_id = mobj.group('playlist_id') - if playlist_id and not self._downloader.params.get('noplaylist'): - self.to_screen('Downloading playlist %s - add --no-playlist to just download video %s' % (playlist_id, video_id)) + if not playlist_id or self._downloader.params.get('noplaylist'): + return self.url_result('5min:%s' % video_id) + + self.to_screen('Downloading playlist %s - add --no-playlist to just download video %s' % (playlist_id, video_id)) - webpage = self._download_webpage(url, playlist_id) - title = self._html_search_regex( - r'<h1 class="video-title[^"]*">(.+?)</h1>', webpage, 'title') - playlist_html = self._search_regex( - r"(?s)<ul\s+class='video-related[^']*'>(.*?)</ul>", webpage, - 'playlist HTML') - entries = [{ - '_type': 'url', - 'url': 'aol-video:%s' % m.group('id'), - 'ie_key': 'Aol', - } for m in re.finditer( - r"<a\s+href='.*videoid=(?P<id>[0-9]+)'\s+class='video-thumb'>", - playlist_html)] + webpage = self._download_webpage(url, playlist_id) + title = self._html_search_regex( + r'<h1 class="video-title[^"]*">(.+?)</h1>', webpage, 'title') + playlist_html = self._search_regex( + r"(?s)<ul\s+class='video-related[^']*'>(.*?)</ul>", webpage, + 'playlist HTML') + entries = [{ + '_type': 'url', + 'url': 'aol-video:%s' % m.group('id'), + 'ie_key': 'Aol', + } for m in re.finditer( + r"<a\s+href='.*videoid=(?P<id>[0-9]+)'\s+class='video-thumb'>", + playlist_html)] - return { - '_type': 'playlist', - 'id': playlist_id, - 'display_id': mobj.group('playlist_display_id'), - 'title': title, - 'entries': entries, - } + return { + '_type': 'playlist', + 'id': playlist_id, + 'display_id': mobj.group('playlist_display_id'), + 'title': title, + 'entries': entries, + } - return FiveMinIE._build_result(video_id) |