1 from __future__ import unicode_literals
5 from .common import InfoExtractor
12 class FiveMinIE(InfoExtractor):
15 (?:https?://[^/]*?5min\.com/Scripts/PlayerSeed\.js\?(.*?&)?playList=|
22 # From http://www.engadget.com/2013/11/15/ipad-mini-retina-display-review/
23 'url': 'http://pshared.5min.com/Scripts/PlayerSeed.js?sid=281&width=560&height=345&playList=518013791',
24 'md5': '4f7b0b79bf1a470e5004f7112385941d',
28 'title': 'iPad Mini with Retina Display Review',
32 # From http://on.aol.com/video/how-to-make-a-next-level-fruit-salad-518086247
33 'url': '5min:518086247',
34 'md5': 'e539a9dd682c288ef5a498898009f69e',
38 'title': 'How to Make a Next-Level Fruit Salad',
44 def _build_result(cls, video_id):
45 return cls.url_result('5min:%s' % video_id, cls.ie_key())
47 def _real_extract(self, url):
48 mobj = re.match(self._VALID_URL, url)
49 video_id = mobj.group('id')
50 embed_url = 'https://embed.5min.com/playerseed/?playList=%s' % video_id
51 embed_page = self._download_webpage(embed_url, video_id,
52 'Downloading embed page')
53 sid = self._search_regex(r'sid=(\d+)', embed_page, 'sid')
54 query = compat_urllib_parse.urlencode({
58 'isPlayerSeed': 'true',
61 info = self._download_json(
62 'https://syn.5min.com/handlers/SenseHandler.ashx?' + query,
63 video_id)['binding'][0]
65 second_id = compat_str(int(video_id[:-2]) + 1)
67 for quality, height in [(1, 320), (2, 480), (4, 720), (8, 1080)]:
68 if any(r['ID'] == quality for r in info['Renditions']):
70 'format_id': compat_str(quality),
71 'url': 'http://avideos.5min.com/%s/%s/%s_%s.mp4' % (second_id[-3:], second_id, video_id, quality),
77 'title': info['Title'],