2 from __future__ import unicode_literals
6 from .common import InfoExtractor
13 class AolIE(InfoExtractor):
14 IE_NAME = 'on.aol.com'
15 _VALID_URL = r'(?:aol-video:|https?://on\.aol\.com/.*-)(?P<id>[^/?-]+)'
19 'url': 'http://on.aol.com/video/u-s--official-warns-of-largest-ever-irs-phone-scam-518167793?icid=OnHomepageC2Wide_MustSee_Img',
20 'md5': '18ef68f48740e86ae94b98da815eec42',
24 'title': 'U.S. Official Warns Of \'Largest Ever\' IRS Phone Scam',
25 'description': 'A major phone scam has cost thousands of taxpayers more than $1 million, with less than a month until income tax returns are due to the IRS.',
26 'timestamp': 1395405060,
27 'upload_date': '20140321',
28 'uploader': 'Newsy Studio',
32 'skip_download': True,
35 # video with vidible ID
36 'url': 'http://on.aol.com/video/netflix-is-raising-rates-5707d6b8e4b090497b04f706?context=PC:homepage:PL1944:1460189336183',
38 'id': '5707d6b8e4b090497b04f706',
40 'title': 'Netflix is Raising Rates',
41 'description': 'Netflix is rewarding millions of it’s long-standing members with an increase in cost. Veuer’s Carly Figueroa has more.',
42 'upload_date': '20160408',
43 'timestamp': 1460123280,
48 'skip_download': True,
51 'url': 'http://on.aol.com/partners/abc-551438d309eab105804dbfe8/sneak-peek-was-haley-really-framed-570eaebee4b0448640a5c944',
52 'only_matching': True,
54 'url': 'http://on.aol.com/shows/park-bench-shw518173474-559a1b9be4b0c3bfad3357a7?context=SH:SHW518173474:PL4327:1460619712763',
55 'only_matching': True,
58 def _real_extract(self, url):
59 video_id = self._match_id(url)
61 response = self._download_json(
62 'https://feedapi.b2c.on.aol.com/v1.0/app/videos/aolon/%s/details' % video_id,
64 if response['statusText'] != 'Ok':
65 raise ExtractorError('%s said: %s' % (self.IE_NAME, response['statusText']), expected=True)
67 video_data = response['data']
69 m3u8_url = video_data.get('videoMasterPlaylist')
71 formats.extend(self._extract_m3u8_formats(
72 m3u8_url, video_id, 'mp4', m3u8_id='hls', fatal=False))
73 for rendition in video_data.get('renditions', []):
74 video_url = rendition.get('url')
77 ext = rendition.get('format')
79 formats.extend(self._extract_m3u8_formats(
80 video_url, video_id, 'mp4', m3u8_id='hls', fatal=False))
84 'format_id': rendition.get('quality'),
86 mobj = re.search(r'(\d+)x(\d+)', video_url)
89 'width': int(mobj.group(1)),
90 'height': int(mobj.group(2)),
93 self._sort_formats(formats, ('width', 'height', 'tbr', 'format_id'))
97 'title': video_data['title'],
98 'duration': int_or_none(video_data.get('duration')),
99 'timestamp': int_or_none(video_data.get('publishDate')),
100 'view_count': int_or_none(video_data.get('views')),
101 'description': video_data.get('description'),
102 'uploader': video_data.get('videoOwner'),
107 class AolFeaturesIE(InfoExtractor):
108 IE_NAME = 'features.aol.com'
109 _VALID_URL = r'https?://features\.aol\.com/video/(?P<id>[^/?#]+)'
112 'url': 'http://features.aol.com/video/behind-secret-second-careers-late-night-talk-show-hosts',
113 'md5': '7db483bb0c09c85e241f84a34238cc75',
117 'title': 'What To Watch - February 17, 2016',
119 'add_ie': ['FiveMin'],
122 def _real_extract(self, url):
123 display_id = self._match_id(url)
124 webpage = self._download_webpage(url, display_id)
125 return self.url_result(self._search_regex(
126 r'<script type="text/javascript" src="(https?://[^/]*?5min\.com/Scripts/PlayerSeed\.js[^"]+)"',
127 webpage, '5min embed url'), 'FiveMin')