summaryrefslogtreecommitdiffhomepage
path: root/youtube_dl/extractor
diff options
context:
space:
mode:
authorPhilipp Hagemeister <[email protected]>2014-04-13 03:19:56 +0200
committerPhilipp Hagemeister <[email protected]>2014-04-13 03:22:24 +0200
commitde906ef54373bcc397895f770992854004248cc4 (patch)
treeb5ae9e811fcc262f6a5cacd6bad61e147f2d4a16 /youtube_dl/extractor
parent2fb3deeca166821cdfe45804b7aa4e27dfdbff62 (diff)
downloadyoutube-dl-de906ef54373bcc397895f770992854004248cc4.tar.gz
youtube-dl-de906ef54373bcc397895f770992854004248cc4.zip
[aol] Add support for playlists (Fixes #2730)
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r--youtube_dl/extractor/aol.py41
1 files changed, 39 insertions, 2 deletions
diff --git a/youtube_dl/extractor/aol.py b/youtube_dl/extractor/aol.py
index abc668912..a7bfe5a5c 100644
--- a/youtube_dl/extractor/aol.py
+++ b/youtube_dl/extractor/aol.py
@@ -8,7 +8,18 @@ from .fivemin import FiveMinIE
class AolIE(InfoExtractor):
IE_NAME = 'on.aol.com'
- _VALID_URL = r'http://on\.aol\.com/video/.*-(?P<id>\d+)($|\?)'
+ _VALID_URL = r'''(?x)
+ (?:
+ aol-video:|
+ http://on\.aol\.com/
+ (?:
+ video/.*-|
+ playlist/(?P<playlist_display_id>[^/?#]+?)-(?P<playlist_id>[0-9]+)[?#].*_videoid=
+ )
+ )
+ (?P<id>[0-9]+)
+ (?:$|\?)
+ '''
_TEST = {
'url': 'http://on.aol.com/video/u-s--official-warns-of-largest-ever-irs-phone-scam-518167793?icid=OnHomepageC2Wide_MustSee_Img',
@@ -24,5 +35,31 @@ class AolIE(InfoExtractor):
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('id')
- self.to_screen('Downloading 5min.com video %s' % video_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))
+
+ 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 FiveMinIE._build_result(video_id)